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:
@@ -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
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user