diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 9c6666f1..0f8cecec 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -20,7 +20,9 @@
{{- with $img -}} - {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }} + {{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }} + {{ $webp := $.Page.Site.Params.enableImageWebp | default true }} + {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "x2" $x2 "lazy" $lazy "webp" $webp) }} {{- else -}} {{ $altText }} {{- end -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2a4935d4..2d92ba4e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -18,7 +18,8 @@
{{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }} {{ $class := "mb-6 -mt-4 rounded-md" }} - {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }} + {{ $webp := $.Page.Site.Params.enableImageWebp | default true }} + {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "lazy" false "webp" $webp) }} {{ with $.Params.coverCaption }}
{{ . | markdownify }}
{{ end }} diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html index 75c23994..11dd3d75 100644 --- a/layouts/partials/picture.html +++ b/layouts/partials/picture.html @@ -1,8 +1,8 @@ {{ $img := .img }} {{ $alt := .alt }} {{ $class := .class }} -{{ $lazy := .lazy | default $.Page.Site.Params.enableImageLazyLoading | default true }} -{{ $webp := .webp | default $.Page.Site.Params.enableImageWebp | default true }} +{{ $lazy := .lazy }} +{{ $webp := .webp }} {{ $lqip := .lqip | default false }} {{ $x2 := .x2 | default false }} diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index bc536c3e..25eca581 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -19,7 +19,9 @@ {{ with $href }}{{ end }} {{- with $img -}} - {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class) }} + {{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }} + {{ $webp := $.Page.Site.Params.enableImageWebp | default true }} + {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "lazy" $lazy "webp" $webp) }} {{- else -}} {{ $altText }} {{- end -}} diff --git a/layouts/shortcodes/screenshot.html b/layouts/shortcodes/screenshot.html index 13f09e7f..793efc30 100644 --- a/layouts/shortcodes/screenshot.html +++ b/layouts/shortcodes/screenshot.html @@ -13,7 +13,9 @@ {{ $altText = (.Get "caption") | markdownify | plainify }} {{ end }} - {{ partial "picture.html" (dict "img" $image "alt" $altText "x2" true) }} + {{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }} + {{ $webp := $.Page.Site.Params.enableImageWebp | default true }} + {{ partial "picture.html" (dict "img" $image "alt" $altText "x2" true "lazy" $lazy "webp" $webp) }} {{- if .Get "href" }}{{ end -}} {{- if .Get "caption" -}}