redstrate.com/themes/red/layouts/shortcodes/featured-art.html
2022-12-27 21:47:12 -05:00

43 lines
1.2 KiB
HTML

<h3>Featured Artwork</h3>
<div class="gallery-con">
{{ with .Site.GetPage "/art" }}
{{ range .Param "featured" }}
<figure class="gallery-fig">
{{ $full := resources.Get (printf "art/%s" .filename) }}
{{ if $full }}
{{ $filename_without_ext := strings.TrimSuffix (path.Ext .filename) .filename }}
{{ $month := 1 }}
{{ if .date }}
{{ $split := split .date "-" }}
{{ $month = index $split 0 }}
{{ end }}
{{ $path := printf "/art/%d/%.2d/%s" (int .year) (int $month) $filename_without_ext}}
<a href="{{ $path }}" aria-label="Click to view details">
{{ $title := .title }}
{{ with resources.Get (printf "art-thumbs/%s" .filename) }}
<img class="gallery-img" alt="{{ $title }}" width="128" height="128" src="{{ .Permalink }}"/>
{{ else }}
<p>Thumbnail not found!</p>
{{ end }}
</a>
<figcaption>
{{ with .title }}
"{{ . }}"
{{ end }}
</figcaption>
{{ else }}
<em>CANNOT FIND {{ .filename }}</em>
{{ end }}
</figure>
{{ end }}
{{ end }}
</div>