From 0c6c30fec166f18310264433929ff69a442637ca Mon Sep 17 00:00:00 2001 From: stereobooster Date: Sun, 26 Nov 2023 14:38:27 +0100 Subject: [PATCH] do not lazy load the feature image --- layouts/_default/_markup/render-image.html | 2 +- layouts/_default/single.html | 2 +- layouts/partials/picture.html | 2 +- layouts/partials/pictureDefaults.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 6c80f343..d8a5136d 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -10,7 +10,7 @@ {{ $img = resources.Get $path }} {{ end -}} -{{/* https://github.com/gohugoio/hugo/pull/10666/files */}} +{{/* https://github.com/gohugoio/hugo/pull/10666 */}} {{- $params := $url.Query -}} {{- $x2Param := $params.Get "2x" -}} {{- $x2 := false -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 90e41daa..199a3235 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -17,7 +17,7 @@
{{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }} {{ $class := "mb-6 -mt-4 rounded-md" }} - {{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class) }} + {{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }} {{ with $.Params.coverCaption }}
{{ . | markdownify }}
{{ end }} diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html index 33553667..f0bc2f49 100644 --- a/layouts/partials/picture.html +++ b/layouts/partials/picture.html @@ -4,7 +4,7 @@ {{ $lazy := .lazy }} {{ $webp := .webp }} {{ $lqip := .lqip }} -{{ $x2 := .x2 | default false }} +{{ $x2 := .x2 }} {{ with $img }} {{ if (eq .MediaType.SubType "svg") }} diff --git a/layouts/partials/pictureDefaults.html b/layouts/partials/pictureDefaults.html index 01eb0986..9ce43084 100644 --- a/layouts/partials/pictureDefaults.html +++ b/layouts/partials/pictureDefaults.html @@ -1,7 +1,7 @@ {{ $img := .img }} {{ $alt := .alt }} {{ $class := .class }} -{{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }} +{{ $lazy := .lazy | default $.Page.Site.Params.enableImageLazyLoading | default true }} {{ $webp := $.Page.Site.Params.enableImageWebp | default true }} {{ $lqip := false }} {{ $x2 := .x2 }}