From 884bdc6ae099c1cebf70a66be27bc87aa6f93cb9 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Sat, 16 Nov 2024 15:57:43 +0100 Subject: [PATCH] Build slideshow dynamically Signed-off-by: Christian Wolf --- .../img => assets}/banner/Banner-RENOTE.jpg | Bin .../img => assets}/banner/Banner-Show2016.jpg | Bin .../img => assets}/banner/Banner2019.jpg | Bin .../img => assets}/banner/Fotobanner2.jpg | Bin .../img => assets}/banner/Paare_2019.jpg | Bin .../img => assets}/banner/slider-turnier.jpg | Bin .../layouts/partials/page/banner-images.html | 33 +++++++++++------- .../tsc_vfl/layouts/partials/page/head.html | 1 - themes/tsc_vfl/static/js/slider.js | 2 +- 9 files changed, 21 insertions(+), 15 deletions(-) rename {themes/tsc_vfl/static/img => assets}/banner/Banner-RENOTE.jpg (100%) rename {themes/tsc_vfl/static/img => assets}/banner/Banner-Show2016.jpg (100%) rename {themes/tsc_vfl/static/img => assets}/banner/Banner2019.jpg (100%) rename {themes/tsc_vfl/static/img => assets}/banner/Fotobanner2.jpg (100%) rename {themes/tsc_vfl/static/img => assets}/banner/Paare_2019.jpg (100%) rename {themes/tsc_vfl/static/img => assets}/banner/slider-turnier.jpg (100%) diff --git a/themes/tsc_vfl/static/img/banner/Banner-RENOTE.jpg b/assets/banner/Banner-RENOTE.jpg similarity index 100% rename from themes/tsc_vfl/static/img/banner/Banner-RENOTE.jpg rename to assets/banner/Banner-RENOTE.jpg diff --git a/themes/tsc_vfl/static/img/banner/Banner-Show2016.jpg b/assets/banner/Banner-Show2016.jpg similarity index 100% rename from themes/tsc_vfl/static/img/banner/Banner-Show2016.jpg rename to assets/banner/Banner-Show2016.jpg diff --git a/themes/tsc_vfl/static/img/banner/Banner2019.jpg b/assets/banner/Banner2019.jpg similarity index 100% rename from themes/tsc_vfl/static/img/banner/Banner2019.jpg rename to assets/banner/Banner2019.jpg diff --git a/themes/tsc_vfl/static/img/banner/Fotobanner2.jpg b/assets/banner/Fotobanner2.jpg similarity index 100% rename from themes/tsc_vfl/static/img/banner/Fotobanner2.jpg rename to assets/banner/Fotobanner2.jpg diff --git a/themes/tsc_vfl/static/img/banner/Paare_2019.jpg b/assets/banner/Paare_2019.jpg similarity index 100% rename from themes/tsc_vfl/static/img/banner/Paare_2019.jpg rename to assets/banner/Paare_2019.jpg diff --git a/themes/tsc_vfl/static/img/banner/slider-turnier.jpg b/assets/banner/slider-turnier.jpg similarity index 100% rename from themes/tsc_vfl/static/img/banner/slider-turnier.jpg rename to assets/banner/slider-turnier.jpg diff --git a/themes/tsc_vfl/layouts/partials/page/banner-images.html b/themes/tsc_vfl/layouts/partials/page/banner-images.html index fc94137..b37ee0b 100644 --- a/themes/tsc_vfl/layouts/partials/page/banner-images.html +++ b/themes/tsc_vfl/layouts/partials/page/banner-images.html @@ -1,15 +1,22 @@ - - - - - - - +{{- $images := resources.Match "banner/*" -}} +{{- $first := true -}} +{{- range $images }} + {{- $img := .Fit "1220x340 webp" -}} + {{ if $first }} + + {{ $first = false }} + {{ end }} + +{{ end -}}
-
-
-
-
-
-
+ {{- $count := (len $images) -}} + {{- $first := true -}} + {{- range (seq 0 (sub $count 1)) }} +
+ {{ $first = false }} + {{- end }}
+ + diff --git a/themes/tsc_vfl/layouts/partials/page/head.html b/themes/tsc_vfl/layouts/partials/page/head.html index 02df9b0..3546ad2 100644 --- a/themes/tsc_vfl/layouts/partials/page/head.html +++ b/themes/tsc_vfl/layouts/partials/page/head.html @@ -19,7 +19,6 @@ {{ $title }} - diff --git a/themes/tsc_vfl/static/js/slider.js b/themes/tsc_vfl/static/js/slider.js index ade8bc2..fadebe4 100644 --- a/themes/tsc_vfl/static/js/slider.js +++ b/themes/tsc_vfl/static/js/slider.js @@ -1,6 +1,6 @@ $(function () { var index = 0 - const maxIndex = 5 + const maxIndex = numImages - 1 const delay = 6000 const shuffeledIndices = []