Provide images as regex filter

This commit is contained in:
Mircea-Pavel ANTON 2023-01-18 09:35:19 +00:00
parent 61f1e46f28
commit 3904461926

View file

@ -1,12 +1,13 @@
{{ $time := now.UnixNano }}
{{ $id := delimit (slice "gallery" $time) "-" }}
{{ $aspect := default "ratio-16-9" (.Get "aspectRatio") }}
{{ $aspect := default "16-9" (.Get "aspectRatio") }}
{{ $images := .Page.Resources.Match (.Get "images") }}
<div id="{{ $id }}" class="carousel slide relative" data-bs-ride="carousel">
<div class="carousel-indicators absolute right-0 bottom-0 left-0 flex justify-center p-0 mb-2">
{{ $num := 0 }}
{{ range .Params }}
{{ range $images }}
<button type="button" data-bs-target="#{{ $id }}" data-bs-slide-to="{{ $num }}"
{{ if eq $num 0 }} class="active" aria-current="true" {{ end }} aria-label="Slide {{ $num }}"></button>
@ -18,9 +19,9 @@
<div class="carousel-inner relative w-full overflow-hidden">
{{ $num := 0 }}
{{ range .Params }}
{{ range $images }}
<div class="carousel-item {{ if eq $num 0 }} active {{ end }} relative float-left w-full {{ $aspect }}single_hero_background"
<div class="carousel-item {{ if eq $num 0 }} active {{ end }} relative float-left w-full ratio-{{ $aspect }} single_hero_background"
style="background-image:url({{ . }})"
></div>
{{ $num = add $num 1 }}