diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index c2b220ad..e2009a06 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,13 +1,14 @@ {{ $url := urls.Parse .Destination }} {{ $altText := .Text }} {{ $caption := .Title }} +{{ $lazyLoad := $.Page.Site.Params.enableImageLazyLoading | default true }} {{ if findRE "^https?" $url.Scheme }}
{{ $altText }} @@ -39,7 +40,7 @@ {{ end }} {{ end }} alt="{{ $altText }}" - {{ if .Site.Params.enableImageLazyLoading | default true }} + {{ if $lazyLoad }} loading="lazy" {{ end }} /> @@ -51,7 +52,7 @@ class="mx-auto my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" - {{ if .Site.Params.enableImageLazyLoading | default true }} + {{ if $lazyLoad }} loading="lazy" {{ end }} /> diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 9f3c52cd..90c5110b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -31,7 +31,7 @@ {{ end }} {{ end }} alt="{{ $.Params.featureAlt | default $.Params.coverAlt | default "" }}" - {{ if .Site.Params.enableImageLazyLoading | default true }} + {{ if $.Site.Params.enableImageLazyLoading | default true }} loading="lazy" {{ end }} /> diff --git a/layouts/partials/article-link.html b/layouts/partials/article-link.html index f934bae0..689bdf71 100644 --- a/layouts/partials/article-link.html +++ b/layouts/partials/article-link.html @@ -23,7 +23,7 @@ 160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x" src="{{ (.Fill "160x120 smart").RelPermalink }}" {{ end }} - {{ if .Site.Params.enableImageLazyLoading | default true }} + {{ if $.Site.Params.enableImageLazyLoading | default true }} loading="lazy" {{ end }} /> diff --git a/layouts/partials/author.html b/layouts/partials/author.html index ca7b17bc..2d29aa82 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -10,7 +10,7 @@ height="96" alt="{{ $.Site.Author.name | default "Author" }}" src="{{ $authorImage.RelPermalink }}" - {{ if .Site.Params.enableImageLazyLoading | default true }} + {{ if $.Site.Params.enableImageLazyLoading | default true }} loading="lazy" {{ end }} /> diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 324e31f1..24fb6f63 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -14,7 +14,7 @@ height="144" alt="{{ $.Site.Author.name | default "Author" }}" src="{{ $authorImage.RelPermalink }}" - {{ if .Site.Params.enableImageLazyLoading | default true }} + {{ if $.Site.Params.enableImageLazyLoading | default true }} loading="lazy" {{ end }} />