Files
web-log/container/site/layouts/shortcodes/gallery.html
T
nicholas 303476e1c2
Build & Push Hugo Site Image / Build & Push Image (push) Successful in 18s
Grid Gallery
2026-07-09 14:08:24 -05:00

30 lines
787 B
HTML

{{ $slug := .Page.Slug }}
{{ $galleryName := .Get "name" }}
{{ $file := printf "%s.yaml" $galleryName }}
{{ $galleryData := .Page.Resources.GetMatch $file | transform.Unmarshal }}
<div class="gallery gallery-new">
{{ range $galleryData.images }}
{{ $imageURL := printf "%s/%s/%s" site.Params.filesBase $slug .src }}
<figure class="{{ .class | default "" }}">
<a
class="lightgallery"
href="{{ $imageURL }}"
data-thumbnail="{{ $imageURL }}"
{{ with .caption }}data-sub-html="{{ . }}"{{ end }}>
<img
src="{{ $imageURL }}"
alt="{{ .alt | default "" }}"
loading="lazy"
decoding="async" />
</a>
{{ with .caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{ end }}
</div>