From 25bf63778cffeee951354be47de0db0ffb70ce27 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 5 Mar 2026 13:57:37 +0100 Subject: [PATCH] feat: use thumbnail in section and links image (#1291) * feat: use thumbnail for section image * feat: use thumbnail in links image * fix typo --- .../_partials/article/components/links.html | 22 ++++++++++++------- layouts/list.html | 17 ++++++++++---- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/layouts/_partials/article/components/links.html b/layouts/_partials/article/components/links.html index 134c159..152822f 100644 --- a/layouts/_partials/article/components/links.html +++ b/layouts/_partials/article/components/links.html @@ -1,5 +1,5 @@
- {{ range $i, $link := .Params.links }} + {{ range $link := .Params.links }}
@@ -18,13 +18,19 @@ {{- $image := partial "helper/image" (dict "Image" $link.image "Resources" $.Resources) -}} {{- with $image -}}
- {{ . }} + {{ partial "helper/thumbnail-image" (dict + "Resource" .Resource + "Width" 60 + "Height" 60 + "Resize" $.Site.Params.ImageProcessing.Thumbnail.Enabled + "Attributes" (dict + "src" $image.Permalink + "alt" $link.title + "loading" "lazy" + "width" .Width + "height" .Height + ) + ) }}
{{ end }}
diff --git a/layouts/list.html b/layouts/list.html index d44dc29..d30f851 100644 --- a/layouts/list.html +++ b/layouts/list.html @@ -20,10 +20,19 @@ {{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}} {{ if $image }}
- + {{ partial "helper/thumbnail-image" (dict + "Resource" $image.Resource + "Width" 60 + "Height" 60 + "Resize" .Site.Params.ImageProcessing.Thumbnail.Enabled + "Attributes" (dict + "src" $image.Permalink + "alt" .Title + "loading" "lazy" + "width" $image.Width + "height" $image.Height + ) + ) }}
{{ end }}