From 4e9e51e48d8eaa2292756b71fd35fa40d956bbee Mon Sep 17 00:00:00 2001 From: Tixie Date: Tue, 21 Feb 2023 21:43:36 +0100 Subject: [PATCH] index: not lazyload the first 3 images (first line on desktop) --- layouts/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/layouts/index.html b/layouts/index.html index 76f7d54..689e14f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -31,7 +31,7 @@
- {{ range sort $paginator.Pages "Date" "desc" }} + {{ range $albumIndex, $album := sort $paginator.Pages "Date" "desc" }} {{ $original := resources.Get .Params.cover }} {{ $originalPermalink := $original.Permalink }} {{ $cover := $original.Resize "x320 webp" }} @@ -48,7 +48,10 @@ style="background-image: url(data:{{ $placeholder.MediaType }};base64,{{ $placeholder.Content | base64Encode }});" src="{{ $cover.Permalink }}" srcset="{{ $cover.Permalink }} 1x, {{ $cover2x.Permalink }} 2x" + {{ if ( gt $albumIndex 3) }} loading="lazy" + decoding="async" + {{ end }} alt="{{ .Title }} album's cover" title="{{ .Title }} album's cover" >