redstrate.com/themes/red/layouts/_default/art-detail.html

132 lines
5.5 KiB
HTML
Raw Normal View History

2024-09-30 17:40:46 -04:00
{{/* Page layout used for art details view, when visiting a specific artwork. */}}
2023-02-23 17:39:20 -05:00
2024-09-30 17:40:46 -04:00
{{ define "main" }}
<h2>{{ .Title }}</h2>
2024-10-17 13:53:59 -04:00
<i style="margin: 0">
Posted on
<time datetime="{{ .Page.Lastmod.Format "2006-01-02" }}" class="text-muted">
{{ $.Date.Format "January 2006" }}
</time>
</i>
{{ if (and (not $.Params.animation) (and (not (in .File.Dir "art/guest")) (and (not $.Params.threed) (not $.Params.comic) )) ) }}
2024-10-13 20:32:26 -04:00
{{ $full := printf "%s/art/%s.avif" $.Site.Params.image_host $.Params.filename }}
{{ $jpeg := printf "%s/art/%s.jpg" $.Site.Params.image_host $.Params.filename }}
<picture>
2024-09-29 18:50:45 -04:00
<source srcset="{{ $full }}" type="image/avif" width="{{ $.Params.width }}" height="{{ $.Params.height }}"/>
<img class="gallery-img" style="display: block; max-height: 1000px; margin-left: auto; margin-right: auto; width: auto; margin-top: 10px; margin-bottom: 10px; max-width: 100%; height: auto" alt="{{ $.Params.alt_text }}" width="{{ $.Params.width }}" height="{{ $.Params.height }}" src="{{ $jpeg }}"/>
</picture>
{{ else }}
2024-09-30 17:40:46 -04:00
{{ if $.Params.threed }}
2024-10-12 14:59:49 -04:00
{{ $file := printf "%s/3d/%s.glb" $.Site.Params.image_host $.Params.slug }}
2024-09-30 17:40:46 -04:00
{{ with $file }}
{{ $cameraorbit := $.Params.orbit }}
{{ $cameratarget := $.Params.target }}
{{ $fov := $.Params.fov }}
<model-viewer style="margin-top: 10px; margin-bottom: 10px;" class="gallery-img" alt="{{ $.Params.alt_text }}" title="{{ $.Params.alt_text }}" src="{{ . }}" shadow-intensity="1" camera-controls touch-action="pan-y" camera-orbit="{{ $cameraorbit }}" camera-target="{{ $cameratarget }}" field-of-view="{{ $fov }}"></model-viewer>
2024-09-30 17:40:46 -04:00
{{ end }}
{{ else }}
2024-10-12 14:59:49 -04:00
{{ $file := printf "%s/animation/%s.webm" $.Site.Params.image_host $.Params.slug }}
2024-09-30 17:40:46 -04:00
{{ with $file }}
{{ if $.Params.animation }}
<div style="text-align: center;">
2024-10-12 16:51:18 -04:00
<video style="max-width: 100%" class="gallery-img" controls loop>
<source src="{{ . }}" type="video/webm">
</video>
</div>
{{ end }}
{{ end }}
2023-04-13 11:45:52 -04:00
{{ end }}
2022-12-28 11:12:01 -05:00
{{ end }}
2022-12-20 19:16:53 -05:00
2024-03-31 12:32:05 -04:00
{{ if $.Params.comic }}
{{ range $.Params.pages }}
2024-10-12 14:59:49 -04:00
{{ $full := printf "%s/art/%s.avif" $.Site.Params.image_host .filename }}
{{ $jpeg := printf "%s/art/%s.jpg" $.Site.Params.image_host .filename}}
2024-03-31 12:32:05 -04:00
<picture>
<source srcset="{{ $full }}" type="image/avif"/>
<img class="gallery-img" style="display: block; max-height: 1000px; margin-left: auto; margin-right: auto; width: auto; margin-top: 10px; margin-bottom: 10px; max-width: 100%; height: auto" alt="{{ .alt_text }}" src="{{ $jpeg }}"/>
</picture>
{{ end }}
{{ end }}
2023-09-04 07:59:34 -04:00
{{ partial "voting" . }}
2024-10-17 13:53:59 -04:00
<div class="generic-con" id="art-detail-inline">
{{ partial "art-detail" . }}
2022-12-20 19:16:53 -05:00
2023-03-08 10:42:43 -05:00
{{ with .Content }}
{{ $.Scratch.Set "header-type" "h3" }}
{{ $.Scratch.Set "header-name" "Commentary" }}
{{ partial "fake-heading.html" $ }}
2022-12-28 11:09:13 -05:00
{{ . }}
2023-03-08 10:42:43 -05:00
{{ end }}
2024-10-17 13:53:59 -04:00
</div>
2022-12-28 11:09:13 -05:00
2023-04-13 11:45:52 -04:00
{{ if .Params.threed }}
{{ $site := resources.Get "js/model-viewer.min.js" }}
{{ if hugo.IsProduction }}
{{ $site = $site | fingerprint | resources.PostProcess }}
{{ end }}
<script type="module" src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
{{ end }}
2024-10-18 15:37:42 -04:00
{{ $related := .Site.RegularPages.Related . | first 3 }}
{{ with $related }}
<h3>Related Art</h3>
<div class="generic-con" style="display: flex; flex-wrap: wrap;">
{{ range . }}
<figure class="gallery-fig">
{{ $filename_without_ext := .Params.slug }}
{{ $month := "1" }}
{{ $year := "1" }}
{{ if .Date }}
{{ $split := split .Date "-" }}
{{ $month = index $split 1 }}
{{ $year = index $split 0 }}
{{ end }}
{{ $path := printf "/art/%s/%s/%s" $year $month $filename_without_ext}}
<a href="{{ $path }}" aria-label="Click to view details {{ $year }}" class="no-decoration">
{{ $title := .Title }}
{{ $full := printf "%s/thumb/%s.avif" $.Site.Params.image_host $filename_without_ext }}
{{ $jpeg := printf "%s/thumb/%s.jpg" $.Site.Params.image_host $filename_without_ext }}
2025-03-17 08:32:30 -04:00
{{ $thumb_width := math.Div (int .Params.thumb_width) 2 }}
{{ $thumb_height := math.Div (int .Params.thumb_height) 2 }}
2024-10-18 15:37:42 -04:00
<picture>
2025-03-17 08:32:30 -04:00
<source srcset="{{ $full }}" width="{{ $thumb_width }}" height="{{ $thumb_height }}" type="image/avif"/>
<img class="gallery-img featured-art" width="{{ $thumb_width }}" height="{{ $thumb_height }}" alt="{{ $title }}" src="{{ $jpeg }}">
2024-10-18 15:37:42 -04:00
</picture>
</a>
<figcaption>
{{ with .Title }}
<i>"{{ . }}"</i>
{{ end }}
</figcaption>
</figure>
{{ end }}
</div>
{{ end }}
2022-12-27 22:34:31 -05:00
{{ partial "comments" . }}
2022-12-20 19:16:53 -05:00
{{ end }}
2024-10-17 13:53:59 -04:00
{{ define "details" }}
{{ partial "art-sidebar" . }}
<hr>
{{ partial "art-detail" . }}
{{ end }}