feat: use thumbnail in section and links image (#1291)

* feat: use thumbnail for section image

* feat: use thumbnail in links image

* fix typo
This commit is contained in:
Jimmy
2026-03-05 13:57:37 +01:00
committed by GitHub
parent a95d0e7c85
commit 25bf63778c
2 changed files with 27 additions and 12 deletions
@@ -1,5 +1,5 @@
<div class="article-list--compact links"> <div class="article-list--compact links">
{{ range $i, $link := .Params.links }} {{ range $link := .Params.links }}
<article> <article>
<a href="{{ $link.website }}" target="_blank" rel="noopener"> <a href="{{ $link.website }}" target="_blank" rel="noopener">
<div class="article-details"> <div class="article-details">
@@ -18,13 +18,19 @@
{{- $image := partial "helper/image" (dict "Image" $link.image "Resources" $.Resources) -}} {{- $image := partial "helper/image" (dict "Image" $link.image "Resources" $.Resources) -}}
{{- with $image -}} {{- with $image -}}
<div class="article-image"> <div class="article-image">
<img {{ partial "helper/thumbnail-image" (dict
src="{{ .Permalink }}" "Resource" .Resource
loading="lazy" "Width" 60
{{ with $link.alt }} alt="{{ . }}"{{ end }} "Height" 60
{{ with .Width }} width="{{ . }}"{{ end }} "Resize" $.Site.Params.ImageProcessing.Thumbnail.Enabled
{{ with .Height }} height="{{ . }}"{{ end }} "Attributes" (dict
> "src" $image.Permalink
"alt" $link.title
"loading" "lazy"
"width" .Width
"height" .Height
)
) }}
</div> </div>
{{ end }} {{ end }}
</a> </a>
+13 -4
View File
@@ -20,10 +20,19 @@
{{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}} {{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}}
{{ if $image }} {{ if $image }}
<div class="section-image"> <div class="section-image">
<img src="{{ $image.Permalink }}" {{ partial "helper/thumbnail-image" (dict
width="{{ $image.Width }}" "Resource" $image.Resource
height="{{ $image.Height }}" "Width" 60
loading="lazy"> "Height" 60
"Resize" .Site.Params.ImageProcessing.Thumbnail.Enabled
"Attributes" (dict
"src" $image.Permalink
"alt" .Title
"loading" "lazy"
"width" $image.Width
"height" $image.Height
)
) }}
</div> </div>
{{ end }} {{ end }}
</div> </div>