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

50 lines
1.5 KiB
HTML
Raw Normal View History

2022-12-27 22:34:31 -05:00
{{ $paginator := .Paginate (where .Pages "Type" "art") }}
<div class="grid">
{{ range $paginator.Pages }}
{{ $full := resources.Get (printf "art/%s.webp" .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 href="{{ .Permalink }}">
{{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}}
{{ $title := .Params.title }}
{{ $image := (resources.Get (printf "art/%s.webp" .Params.slug)).Resize "300x" }}
{{ with $image }}
<img class="grid-item" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $title }}" src="{{ .Permalink }}"/>
{{ else }}
<p>Thumbnail not found!</p>
{{ end }}
{{ else }}
</a>
<em>CANNOT FIND {{.Params.slug }}</em>
{{ end }}
{{ end }}
</div>
{{ with $paginator.Prev }}
<a href="{{ .URL }}">Prev</a>
{{ end }}
{{ with $paginator.Next }}
<a href="{{ .URL }}">Next</a>
{{ end }}
{{ $site := resources.Get "js/site.js" }}
{{ if hugo.IsProduction }}
{{ $site = $site | minify | fingerprint | resources.PostProcess }}
{{ end }}
<script src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>