73 lines
2.6 KiB
HTML
73 lines
2.6 KiB
HTML
{{ $base := "art" }}
|
|
|
|
{{ if .Params.threed }}
|
|
{{ $base = "3d" }}
|
|
{{ end }}
|
|
|
|
{{ if .Params.animation }}
|
|
{{ $base = "animation" }}
|
|
{{ end }}
|
|
|
|
{{ $month := 1 }}
|
|
{{ $year := 1 }}
|
|
|
|
{{ if .Params.date }}
|
|
{{ $split := split .Params.date "-" }}
|
|
{{ $year = int (index $split 0) }}
|
|
{{ $month = int (index $split 3) }}
|
|
{{ end }}
|
|
|
|
{{ $use_newformat := false }}
|
|
{{ if ge (int $year) 2023 }}
|
|
{{ $use_newformat = true }}
|
|
{{ end }}
|
|
|
|
{{ if in .File.Dir "art/guest" }}
|
|
{{ $use_newformat = false }}
|
|
{{ end }}
|
|
|
|
{{ $full := "" }}
|
|
{{ $jpeg := "" }}
|
|
{{ if and $use_newformat (eq $base "art") }}
|
|
{{ $full = printf "https://images.redstrate.com/thumb/%s.avif" .Params.slug }}
|
|
{{ $jpeg = printf "https://images.redstrate.com/thumb/%s.jpg" .Params.slug }}
|
|
{{ else }}
|
|
{{ $full = resources.Get (printf "%s/%s.webp" $base .Params.slug) }}
|
|
{{ end }}
|
|
|
|
{{ if $full }}
|
|
{{ $filename_without_ext := .Params.slug }}
|
|
|
|
<a aria-label="Gallery Item" class="no-decoration grid-item" href="{{ .RelPermalink }}">
|
|
|
|
{{ $title := .Params.title }}
|
|
|
|
{{ with $full }}
|
|
{{ if $.Params.threed }}
|
|
{{ with resources.Get "3d.png" }}
|
|
<img alt="3D cube icon" title="Viewable 3D" style="z-index: 1; position: absolute; left: 10px; top: 10px; border: none" src="{{ .RelPermalink }}">
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if $.Params.animation }}
|
|
{{ with resources.Get "play-circle.png" }}
|
|
<img alt="Play animation icon" title="Viewable Animation" style="z-index: 1; position: absolute; left: 10px; top: 10px; border: none" src="{{ .RelPermalink }}">
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if and $use_newformat (eq $base "art") }}
|
|
<picture>
|
|
<source srcset="{{ $full }}" type="image/avif"/>
|
|
<img style="width: 100%; height: auto;" alt="{{ $.Params.alt_text }}" title="{{ $title }}" src="{{ $jpeg }}"/>
|
|
</picture>
|
|
{{ else }}
|
|
<img style="width: 100%; height: auto;" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $.Params.alt_text }}" title="{{ $title }}" src="{{ .RelPermalink }}">
|
|
{{ end }}
|
|
{{ else }}
|
|
<p>Thumbnail not found!</p>
|
|
{{ end }}
|
|
</a>
|
|
{{ else }}
|
|
<em>CANNOT FIND {{ .Params.slug }} {{ $use_newformat }}</em>
|
|
{{ end }}
|
|
|