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>
|
<header>
|
||||||
<div class="header-content">
|
<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 "^/" "") }}
|
{{ $logoresource := resources.Get (.Site.Params.logoNormal | replaceRE "^/" "") }}
|
||||||
|
|
||||||
<a class="logo" href="{{ "/" | relLangURL }}" title="{{ strings.FirstUpper (i18n "back_to_home") }}">
|
<a class="logo" href="{{ "/" | relLangURL }}" title="{{ strings.FirstUpper (i18n "back_to_home") }}">
|
||||||
|
@ -14,19 +16,19 @@
|
||||||
|
|
||||||
{{ if ($isJPG) -}}
|
{{ if ($isJPG) -}}
|
||||||
{{ $webpPath:= replace $logoresource ".jpg" ".webp" }}
|
{{ $webpPath:= replace $logoresource ".jpg" ".webp" }}
|
||||||
{{ $webpPathStatic:= printf "%s" $webpPath }}
|
{{ $webpPathStatic:= printf "assets/%s" $webpPath }}
|
||||||
|
|
||||||
{{ if (fileExists $webpPathStatic) -}}
|
{{ if (fileExists $webpPathStatic) -}}
|
||||||
<source srcset="{{ $webpPath | safeURL }}" type="image/webp">
|
<source srcset="/{{ $webpPath | safeURL }}" type="image/webp">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{ if ($isPNG) -}}
|
{{ if ($isPNG) -}}
|
||||||
{{ $webpPath:= replace $logoresource ".png" ".webp" }}
|
{{ $webpPath:= replace $logoresource ".png" ".webp" }}
|
||||||
{{ $webpPathStatic:= printf "%s" $webpPath }}
|
{{ $webpPathStatic:= printf "assets/%s" $webpPath }}
|
||||||
|
|
||||||
{{ if (fileExists $webpPathStatic) -}}
|
{{ if (fileExists $webpPathStatic) -}}
|
||||||
<source srcset="{{ $webpPath | safeURL }}" type="image/webp">
|
<source srcset="/{{ $webpPath | safeURL }}" type="image/webp">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
Reference in a new issue