redstrate.com/themes/red/layouts/partials/render-art.html

42 lines
1.6 KiB
HTML

{{/* Partial used to display a thumbnail of an artwork. */}}
{{ $full := printf "%s/thumb/%s.avif" $.Site.Params.image_host .Params.filename }}
{{ $jpeg := printf "%s/thumb/%s.jpg" $.Site.Params.image_host .Params.filename }}
<a aria-label="Gallery Item" class="no-decoration grid-item" href="{{ .RelPermalink }}">
{{ $title := .Title }}
{{ $year := .Date.Format "2006" }}
{{ with $full }}
<picture>
<source srcset="{{ $full }}" type="image/avif" width="{{ $.Params.thumb_width }}" height="{{ $.Params.thumb_height }}"/>
<img style="width: 100%; height: auto;" alt="{{ $.Params.alt_text }}" width="{{ $.Params.thumb_width }}" height="{{ $.Params.thumb_height }}" src="{{ $jpeg }}"/>
</picture>
<span>
{{ $title }}, {{ $year }}
{{ if $.Params.threed }}
{{ with resources.Get "3d.png" }}
<img width="16" height="16" alt="3D cube icon" title="Viewable 3D Model" src="{{ .RelPermalink }}">
{{ end }}
{{ end }}
{{ if $.Params.comic }}
{{ with resources.Get "comic.png" }}
<img width="16" height="16" alt="Comic icon" title="Viewable Comic" src="{{ .RelPermalink }}">
{{ end }}
{{ end }}
{{ if $.Params.animation }}
{{ with resources.Get "play-circle.png" }}
<img width="16" height="16" alt="Play animation icon" title="Viewable Animation" src="{{ .RelPermalink }}">
{{ end }}
{{ end }}
</span>
{{ end }}
</a>