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

55 lines
2.2 KiB
HTML

{{ $base := "art" }}
{{ if .Params.threed }}
{{ $base = "3d" }}
{{ end }}
{{ if .Params.animation }}
{{ $base = "animation" }}
{{ end }}
{{ $full := resources.Get (printf "%s/%s.webp" $base .Params.slug) }}
{{ if $full }}
{{ $filename_without_ext := .Params.slug }}
{{ $month := 1 }}
{{ $year := 1 }}
{{ if .Params.date }}
{{ $split := split .Params.date "-" }}
{{ $month = index $split 0 }}
{{ $year = index $split 3 }}
{{ end }}
<a aria-label="Gallery Item" class="no-decoration grid-item" href="{{ .RelPermalink }}">
{{ $path := printf "/%s/%d/%.2d/%s" $base (int $year) (int $month) $filename_without_ext}}
{{ $title := .Params.title }}
{{ $image := (resources.Get (printf "%s/%s.webp" $base .Params.slug)).Resize "400x webp q90 drawing" }}
{{ if .Params.nsfw }}
{{ $image = $image | images.Filter (images.GaussianBlur 6) (images.Pixelate 8) }}
{{ end }}
{{ with $image }}
{{ if $.Params.threed }}
{{ with resources.Get "3d.png" }}
<img alt="Viewable 3D" 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="Viewable Animation" title="Viewable Animation" style="z-index: 1; position: absolute; left: 10px; top: 10px; border: none" src="{{ .RelPermalink }}">
{{ end }}
{{ end }}
<img style="width: 100%; height: auto;" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $title }}" title="{{ $title }}" src="{{ .RelPermalink }}">
{{ else }}
<p>Thumbnail not found!</p>
{{ end }}
</a>
{{ else }}
<em>CANNOT FIND {{ .Params.slug }}</em>
{{ end }}