Add configuration flag

pull/649/head
stereobooster 2023-09-12 21:19:27 +02:00
parent 759982fd4a
commit 86dd65776f
2 changed files with 3 additions and 1 deletions

View File

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

View File

@ -2,6 +2,7 @@
{{ $altText := .Text }}
{{ $caption := .Title }}
{{ $lazyLoad := $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := $.Page.Site.Params.enableWebp | default true }}
{{ if findRE "^https?" $url.Scheme }}
<figure>
<img
@ -24,7 +25,7 @@
{{ with $resource }}
<figure>
<picture>
{{ if ne .MediaType.SubType "svg" }}
{{ if (and (ne .MediaType.SubType "svg") $webp) }}
<source
{{ if lt .Width 660 }}
{{ with .Resize (printf "%dx%d webp" .Width .Height) }}