Toevoegen van webp-alternatief inclusief dynamic bepalen van afmetingen
This commit is contained in:
parent
627346d466
commit
448c430db3
BIN
static/afbeeldingen/logo/nluug-logo.jpg
Normal file
BIN
static/afbeeldingen/logo/nluug-logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
static/afbeeldingen/logo/nluug-logo.png
Normal file
BIN
static/afbeeldingen/logo/nluug-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
static/afbeeldingen/logo/nluug-logo.webp
Normal file
BIN
static/afbeeldingen/logo/nluug-logo.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
|
@ -4,6 +4,8 @@
|
|||
<header>
|
||||
<div class="header-content">
|
||||
|
||||
<!-- Logo wordt nu benoemd als URL, dus we strippen de eerste slash, vervolgens halen we deze uit de assets directory -->
|
||||
<!-- Logo staat zowel in assets als static, zodat deze gekopieerd worden. Dit is een TODO om te ontdubbelen -->
|
||||
{{ $logoresource := resources.Get (.Site.Params.logoNormal | replaceRE "^/" "") }}
|
||||
|
||||
<a class="logo" href="{{ "/" | relLangURL }}" title="{{ strings.FirstUpper (i18n "back_to_home") }}">
|
||||
|
@ -14,19 +16,19 @@
|
|||
|
||||
{{ if ($isJPG) -}}
|
||||
{{ $webpPath:= replace $logoresource ".jpg" ".webp" }}
|
||||
{{ $webpPathStatic:= printf "%s" $webpPath }}
|
||||
{{ $webpPathStatic:= printf "assets/%s" $webpPath }}
|
||||
|
||||
{{ if (fileExists $webpPathStatic) -}}
|
||||
<source srcset="{{ $webpPath | safeURL }}" type="image/webp">
|
||||
<source srcset="/{{ $webpPath | safeURL }}" type="image/webp">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ if ($isPNG) -}}
|
||||
{{ $webpPath:= replace $logoresource ".png" ".webp" }}
|
||||
{{ $webpPathStatic:= printf "%s" $webpPath }}
|
||||
{{ $webpPathStatic:= printf "assets/%s" $webpPath }}
|
||||
|
||||
{{ if (fileExists $webpPathStatic) -}}
|
||||
<source srcset="{{ $webpPath | safeURL }}" type="image/webp">
|
||||
<source srcset="/{{ $webpPath | safeURL }}" type="image/webp">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
|
Reference in a new issue