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

56 lines
2.1 KiB
HTML
Raw Normal View History

2023-04-13 11:45:52 -04:00
{{ $base := "art" }}
2023-04-13 17:19:53 -04:00
2023-04-13 11:45:52 -04:00
{{ if .Params.threed }}
2023-04-13 17:19:53 -04:00
{{ $base = "3d" }}
2023-04-13 11:45:52 -04:00
{{ end }}
{{ if .Params.animation }}
2023-04-13 17:19:53 -04:00
{{ $base = "animation" }}
{{ end }}
2023-04-13 11:45:52 -04:00
{{ $full := resources.Get (printf "%s/%s.webp" $base .Params.slug) }}
2022-12-28 10:24:59 -05:00
{{ if $full }}
2023-04-13 17:19:53 -04:00
{{ $filename_without_ext := .Params.slug }}
2022-12-28 10:24:59 -05:00
2023-04-13 17:19:53 -04:00
{{ $month := 1 }}
{{ $year := 1 }}
2022-12-28 10:24:59 -05:00
2023-04-13 17:19:53 -04:00
{{ if .Params.date }}
{{ $split := split .Params.date "-" }}
{{ $month = index $split 0 }}
{{ $year = index $split 3 }}
{{ end }}
2022-12-28 10:24:59 -05:00
2023-04-13 18:38:37 -04:00
<a aria-label="Gallery Item" class="no-decoration grid-item" href="{{ .Permalink }}">
2023-04-13 11:45:52 -04:00
2023-04-13 17:19:53 -04:00
{{ $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" }}
2023-02-10 14:25:28 -05:00
2023-04-13 17:19:53 -04:00
{{ if .Params.nsfw }}
{{ $image = $image | images.Filter (images.GaussianBlur 6) (images.Pixelate 8) }}
{{ end }}
2023-02-10 14:25:28 -05:00
2023-04-13 17:19:53 -04:00
{{ with $image }}
{{ if $.Params.threed }}
{{ with resources.Get "3d.png" }}
2023-04-17 14:18:02 -04:00
<img alt="Viewable 3D" title="Viewable 3D" style="z-index: 1; position: absolute; left: 10px; top: 10px" src="{{ .Permalink }}">
2023-04-13 17:19:53 -04:00
{{ end }}
{{ end }}
2023-04-13 17:19:53 -04:00
{{ if $.Params.animation }}
{{ with resources.Get "play-circle.png" }}
2023-04-17 14:18:02 -04:00
<img alt="Viewable Animation" title="Viewable Animation" style="z-index: 1; position: absolute; left: 10px; top: 10px" src="{{ .Permalink }}">
2023-04-13 17:19:53 -04:00
{{ end }}
{{ end }}
2023-04-13 18:38:37 -04:00
2023-04-13 17:19:53 -04:00
<img width="{{ .Width }}" height="{{ .Height }}" alt="{{ $title }}" title="{{ $title }}" src="{{ .Permalink }}">
{{ else }}
<p>Thumbnail not found!</p>
{{ end }}
2023-04-13 17:19:53 -04:00
</a>
2022-12-28 10:24:59 -05:00
{{ else }}
2023-04-13 17:19:53 -04:00
<em>CANNOT FIND {{ .Params.slug }}</em>
2022-12-28 10:24:59 -05:00
{{ end }}
2023-04-13 11:45:52 -04:00