+ {{- with (.Get "dir") -}}
+
+ {{- $files := readDir (path.Join "content/" (path.Dir $.Page.File.Path) "/" .) }}
+ {{- range $files -}}
+
+ {{- $thumbext := $.Get "thumb" | default "-thumb" }}
+ {{- $isthumb := .Name | findRE ($thumbext | printf "%s\\.") }}
+ {{- $isimg := lower .Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp|webp|avif|jxl)" }}
+ {{- if and $isimg (not $isthumb) }}
+ {{- $caption := .Name | replaceRE "\\..*" "" | humanize }}
+ {{- $linkURL := print $baseURL (path.Dir $.Page.File.Path) "/" ($.Get "dir") "/" .Name | absURL }}
+ {{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}
+ {{- $thumbexists := where $files "Name" $thumb }}
+ {{- $thumbURL := print $baseURL (path.Dir $.Page.File.Path) "/" ($.Get "dir") "/" $thumb | absURL }}
+
+
+
+

+
+
+ {{ $caption }}
+
+
+
+
+ {{- end }}
+ {{- end }}
+ {{- else -}}
+
+ {{ .Inner }}
+ {{- end }}
+
diff --git a/layouts/shortcodes/load-photoswipe.html b/layouts/shortcodes/load-photoswipe.html
new file mode 100644
index 0000000..4b3bfad
--- /dev/null
+++ b/layouts/shortcodes/load-photoswipe.html
@@ -0,0 +1,75 @@
+
+
+
+{{ if not ($.Page.Scratch.Get "photoswipeloaded") }}
+ {{ $.Page.Scratch.Set "photoswipeloaded" 1 }}
+
+
+
+
+
+