Hugo-theme-stack/layouts/partials/article-list/tile.html
Jimmy Cai 32732d4bf1 feat: avoid regenerate color scheme when image URL is changed
Use MD5 as key to identify images, and .Slug as id
2020-08-28 12:11:02 +02:00

18 lines
740 B
HTML

<article class="{{ if .context.Params.image }}has-image{{ end }}">
<a href="{{ .context.Permalink }}">
{{ if .context.Params.image }}
{{- $image := partial "helper/image" .context | resources.Fingerprint "md5" -}}
{{- $thumbnail := $image.Fill .size -}}
<div class="article-image">
<img src="{{ $thumbnail.RelPermalink }}" width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}"
loading="lazy" data-id="{{ .context.Slug }}" data-key="{{ $image.Data.Integrity }}">
</div>
{{ end }}
<div class="article-details">
<h2 class="article-title">
{{- .context.Title -}}
</h2>
</div>
</a>
</article>