hugo-page-test/themes/tsc_vfl/layouts/partials/page/banner-images.html
Christian Wolf 884bdc6ae0
Build slideshow dynamically
Signed-off-by: Christian Wolf <github@christianwolf.email>
2024-11-16 15:57:43 +01:00

23 lines
705 B
HTML

{{- $images := resources.Match "banner/*" -}}
{{- $first := true -}}
{{- range $images }}
{{- $img := .Fit "1220x340 webp" -}}
{{ if $first }}
<img src="{{ $img.RelPermalink }}" class="placeholder">
{{ $first = false }}
{{ end }}
<img src="{{ $img.RelPermalink }}" class="hidden slider-img">
{{ end -}}
<div class="dots">
{{- $count := (len $images) -}}
{{- $first := true -}}
{{- range (seq 0 (sub $count 1)) }}
<div data-index="{{ . }}" class="dot {{ if $first }}active{{ end }}"></div>
{{ $first = false }}
{{- end }}
</div>
<script>
const numImages = {{ $count }};
</script>
<script defer src="{{ relURL "js/slider.js" }}"></script>