aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/gallery-walk.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-05-03 04:25:49 -0400
committertdro <tdro@noreply.example.com>2022-05-03 04:25:49 -0400
commite92dc018e28ba8d44f1c6cbc9fb0b779dec271e6 (patch)
tree3667043819ab91065019dfe3b4ff83ad625c2b49 /themes/default/layouts/partials/gallery-walk.html
downloadcanory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.gz
canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.bz2
canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.zip
config.yaml: Commission
Diffstat (limited to 'themes/default/layouts/partials/gallery-walk.html')
-rw-r--r--themes/default/layouts/partials/gallery-walk.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/themes/default/layouts/partials/gallery-walk.html b/themes/default/layouts/partials/gallery-walk.html
new file mode 100644
index 0000000..daa27ac
--- /dev/null
+++ b/themes/default/layouts/partials/gallery-walk.html
@@ -0,0 +1,41 @@
+{{- $folder := . }}
+
+{{- if fileExists $folder }}
+ {{- $files := readDir $folder }}
+ {{- if $files }}
+ {{- range $files }}
+
+ {{- if not .IsDir }}
+ {{- $name := index (split .Name ".") 0 }}
+ {{- $extension := lower (index (split .Name ".") 1) }}
+
+ {{- if or
+ (eq $extension "apng")
+ (eq $extension "avif")
+ (eq $extension "gif")
+ (eq $extension "jfif")
+ (eq $extension "jpeg")
+ (eq $extension "jpg")
+ (eq $extension "pjp")
+ (eq $extension "pjpeg")
+ (eq $extension "png")
+ (eq $extension "svg")
+ (eq $extension "webp")
+ }}
+
+ <img
+ title="{{- .Name }}"
+ alt="{{- .Name }}"
+ src="/{{- strings.TrimPrefix "content/" (trim $folder "/") }}/{{- .Name }}"
+ />
+
+ {{- end }}
+ {{- end }}
+
+ {{- if .IsDir }}
+ {{- partial "gallery-walk.html" (path.Join $folder .Name) }}
+ {{- end }}
+
+ {{- end }}
+ {{- end }}
+{{- end }}