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

44 lines
1.3 KiB
HTML
Raw Normal View History

2022-12-27 22:34:31 -05:00
<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 }}
2022-12-27 22:34:31 -05:00
{{ if .date }}
{{ $split := split .date "-" }}
{{ $month = index $split 1 }}
{{ $year = index $split 0 }}
2022-12-27 22:34:31 -05:00
{{ end }}
{{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}}
2022-12-27 22:34:31 -05:00
<a href="{{ $path }}" aria-label="Click to view details" class="no-decoration">
2022-12-27 22:34:31 -05:00
{{ $title := .title }}
{{ with resources.Get (printf "art/%s" .filename) }}
{{ $image := .Resize "500x" }}
2023-04-17 14:18:02 -04:00
<img class="gallery-img featured-art" alt="{{ $title }}" width="{{ $image.Width }}" height="{{ $image.Height }}" src="{{ $image.RelPermalink }}">
2022-12-27 22:34:31 -05:00
{{ else }}
<p>Thumbnail not found!</p>
{{ end }}
</a>
<figcaption>
{{ with .title }}
2023-04-13 17:19:53 -04:00
<i>"{{ . }}"</i>
2022-12-27 22:34:31 -05:00
{{ end }}
</figcaption>
{{ else }}
2023-04-13 17:19:53 -04:00
<em>CANNOT FIND {{ .filename }}</em>
2022-12-27 22:34:31 -05:00
{{ end }}
</figure>
{{ end }}
{{ end }}
</div>