mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-27 04:03:48 +01:00
feat(article list/default): better thumbnail
This commit is contained in:
parent
2ab49f97ee
commit
7f3d906f24
1 changed files with 6 additions and 4 deletions
|
@ -1,12 +1,14 @@
|
|||
<article class="{{ if .Params.image }}has-image{{ end }}">
|
||||
{{ if .Params.image }}
|
||||
{{- $image := partial "helper/image" . -}}
|
||||
{{- $thumbnailNotDesktop := $image.Resize "x500 smart" -}}
|
||||
|
||||
{{- $thumbnail := $image.Fill "800x250" -}}
|
||||
{{- $thumbnailRetina := $image.Fill "1600x500" -}}
|
||||
|
||||
<div class="article-image">
|
||||
<a href="{{ .Permalink }}">
|
||||
<img src="{{ $thumbnailNotDesktop.RelPermalink }}"
|
||||
width="{{ $thumbnailNotDesktop.Width }}" height="{{ $thumbnailNotDesktop.Height }}" loading="lazy"
|
||||
<img src="{{ $thumbnail.RelPermalink }}"
|
||||
srcset="{{ $thumbnail.RelPermalink }} 1x, {{ $thumbnailRetina.RelPermalink }} 2x"
|
||||
width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}" loading="lazy"
|
||||
alt="Featured image of post {{ .Title }}" />
|
||||
</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue