aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/gallery-walk.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-06-24 07:35:37 -0400
committertdro <tdro@noreply.example.com>2022-06-24 07:35:37 -0400
commit1188758a10f43fbbf9b946132af6b474ff67836a (patch)
treebc57ab47af62561d2e5eebd8cc73433773aca0ab /themes/default/layouts/partials/gallery-walk.html
parent967726d135c19b3472dd2a77d08447f1cdfcd6e9 (diff)
downloadcanory-1188758a10f43fbbf9b946132af6b474ff67836a.tar.gz
canory-1188758a10f43fbbf9b946132af6b474ff67836a.tar.bz2
canory-1188758a10f43fbbf9b946132af6b474ff67836a.zip
themes/default/layouts/partials/gallery-walk: Don't recurse
Diffstat (limited to 'themes/default/layouts/partials/gallery-walk.html')
-rw-r--r--themes/default/layouts/partials/gallery-walk.html107
1 files changed, 70 insertions, 37 deletions
diff --git a/themes/default/layouts/partials/gallery-walk.html b/themes/default/layouts/partials/gallery-walk.html
index 392e336..d341022 100644
--- a/themes/default/layouts/partials/gallery-walk.html
+++ b/themes/default/layouts/partials/gallery-walk.html
@@ -1,49 +1,82 @@
{{- $folder := . -}}
+{{- $files := slice -}}
{{- $dimensions := "320x320" -}}
-{{- if fileExists $folder }}
- {{- $files := where (readDir $folder) "Name" "not in" (slice "page" "rss.xml" "index.html") }}
- {{- if $files }}
- {{- range first 5 $files }}
+{{- if fileExists $folder -}}
- {{- if not .IsDir }}
+ {{- range readDir $folder -}}
- {{- $name := index (split .Name ".") 0 }}
- {{- $extension := path.Ext .Name }}
- {{- $path := path.Join $folder .Name }}
-
- {{- 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")
- }}
- {{- with $image := resources.Get $path -}}
- {{- $imageContent := (.Content | resources.FromString (print (partial "function-paths-media.html") "/gallery-walker_" (path.Base .))).Fit $dimensions }}
- <img
- alt="{{- .Name }}"
- title="{{- .Name }}"
- width="{{ $imageContent.Width }}"
- height="{{ $imageContent.Height }}"
- src="{{ $imageContent.RelPermalink }}"
- />
- {{ end }}
- {{- end -}}
+ {{- $name := index (split .Name ".") 0 -}}
+ {{- $extension := path.Ext .Name -}}
- {{- end -}}
+ {{- 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")
+ (eq $extension ".webp")
+ -}}
+ {{-
+ $files = $files | append (dict
+ "Name" .Name
+ "Path" (path.Join $folder .Name)
+ )
+ -}}
+ {{- end -}}
+ {{- end -}}
+
+ {{- range readDir (path.Join $folder "profile") -}}
+
+ {{- $name := index (split .Name ".") 0 -}}
+ {{- $extension := path.Ext .Name -}}
- {{- if .IsDir }}
- {{- partial "gallery-walk.html" (path.Join $folder .Name) }}
- {{- end }}
+ {{- 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")
+ (eq $extension ".webp")
+ -}}
+ {{-
+ $files = $files | append (dict
+ "Name" .Name
+ "Path" (path.Join $folder "profile" .Name)
+ )
+ -}}
+ {{- end -}}
+ {{- end -}}
+
+ {{- if $files }}
+ {{- range first 6 $files }}
+ {{- if not .IsDir }}
+ {{- with $image := resources.Get .Path -}}
+ {{- $imageContent := (.Content | resources.FromString (print (partial "function-paths-media.html") "/gallery-walker_" (path.Base .))).Fit $dimensions }}
+ <img
+ alt="{{- .Name }}"
+ title="{{- .Name }}"
+ width="{{ $imageContent.Width }}"
+ height="{{ $imageContent.Height }}"
+ src="{{ $imageContent.RelPermalink }}"
+ />
+ {{ end }}
+ {{- end -}}
{{- end -}}
+
{{- else -}}
<footer>
<code>No media found!</code>