redstrate.com/themes/retro/layouts/partials/featured-art.html
2023-10-07 09:38:42 -04:00

45 lines
1.3 KiB
HTML

<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" }}
{{ $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">
{{ $title := .title }}
{{ with resources.Get (printf "art/%s" .filename) }}
{{ $image := .Resize "500x" }}
<img class="gallery-img featured-art" alt="{{ $title }}" width="{{ $image.Width }}" height="{{ $image.Height }}" src="{{ $image.RelPermalink }}"/>
{{ else }}
<p>Thumbnail not found!</p>
{{ end }}
</a>
<figcaption>
{{ with .title }}
<i>"{{ . }}"</i>
{{ end }}
</figcaption>
{{ else }}
<em>CANNOT FIND {{ .filename }}</em>
{{ end }}
</figure>
{{ end }}
{{ end }}
</div>