From c79c9cd1fc8291bcd3683e96238ae8f31847112f Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Tue, 30 Jan 2024 12:29:32 +0100 Subject: [PATCH] support reading files from directory --- layouts/shortcodes/snap-gallery.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/layouts/shortcodes/snap-gallery.html b/layouts/shortcodes/snap-gallery.html index 3871b0a..a472d9c 100644 --- a/layouts/shortcodes/snap-gallery.html +++ b/layouts/shortcodes/snap-gallery.html @@ -6,8 +6,13 @@ {{ if .Params.isdir }} - {{/* Get images from folder, somehow put into map */}} + {{/* Get images from folder, put into map */}} + {{ $imgdir := print "/static/" .Params.src }} + {{- range readDir $imgdir -}} + {{ $imgs = $imgs | append (print $.Params.src "/" .Name ) }} + {{ end }} {{ else }} + {{/* Get images from src Param, separated by comma */}} {{ range (split .Params.src ",") }} {{ $imgs = $imgs | append (trim . " ") }} {{ end }}