hugo-theme-stack-stars/layouts/partials/article-list/default.html

22 lines
1.1 KiB
HTML
Raw Normal View History

{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" }}
2020-09-11 14:01:01 +00:00
<article class="{{ if $image.exists }}has-image{{ end }}">
{{ if $image.exists }}
<div class="article-image">
<a href="{{ .Permalink }}">
2020-09-11 14:01:01 +00:00
{{ if $image.resource }}
{{- $thumbnail := $image.resource.Fill "800x250" -}}
{{- $thumbnailRetina := $image.resource.Fill "1600x500" -}}
<img src="{{ $thumbnail.RelPermalink }}"
srcset="{{ $thumbnail.RelPermalink }} 800w, {{ $thumbnailRetina.RelPermalink }} 1600w"
width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}" loading="lazy"
alt="Featured image of post {{ .Title }}" />
{{ else }}
2020-09-11 14:01:01 +00:00
<img src="{{ $image.permalink }}" loading="lazy" alt="Featured image of post {{ .Title }}" />
{{ end }}
</a>
</div>
2020-08-22 11:20:08 +00:00
{{ end }}
{{ partialCached "article/components/details" . .RelPermalink }}
2020-08-22 11:20:08 +00:00
</article>