add configuration option

pull/647/head
stereobooster 2023-09-13 09:46:11 +02:00
parent d37a633509
commit afa25640c3
2 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@ enableSearch = true
enableCodeCopy = true
enableImageLazyLoading = true
enableWebp = true
enableLqip = true
# robots = ""
fingerprintAlgorithm = "sha256"

View File

@ -4,6 +4,7 @@
{{ $lazyLoad := .context.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := .context.Page.Site.Params.enableWebp | default true }}
{{ $lqip := .context.Page.Site.Params.enableLqip | default true }}
{{ if findRE "^https?" $url.Scheme }}
<img
@ -22,7 +23,7 @@
{{ $resource = resources.Get ($url.String) }}
{{ end }}
{{ with $resource }}
{{ if ne .MediaType.SubType "svg" }}
{{ if (and (ne .MediaType.SubType "svg") $lqip) }}
{{ $lqip := (.Resize "20x webp").Content | base64Encode }}
<picture
style="background: url(data:image/webp;base64,{{ $lqip }}); background-size: cover"