Hugo-theme-stack/layouts/partials/article-list/default.html

22 lines
1.0 KiB
HTML

{{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }}
<article class="{{ if $image.exists }}has-image{{ end }}">
{{ if $image.exists }}
<div class="article-image">
<a href="{{ .Permalink }}">
{{ if $image.resource }}
{{- $thumbnail := $image.resource.Fill "800x250" -}}
{{- $thumbnailRetina := $image.resource.Fill "1600x500" -}}
<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 }}" />
{{ else }}
<img src="{{ $image.permalink }}" loading="lazy" alt="Featured image of post {{ .Title }}" />
{{ end }}
</a>
</div>
{{ end }}
{{ partial "article/components/details" . }}
</article>