From 05907377febe5e6e8f34d36e9c34a02bdf7e2e77 Mon Sep 17 00:00:00 2001 From: Gregory Trolliet Date: Fri, 8 Sep 2023 14:23:33 +0200 Subject: [PATCH] [THEME] Fix the gallery for the archives --- layouts/archives/single.html | 17 +++++++++++------ static/css/style.css | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/layouts/archives/single.html b/layouts/archives/single.html index a219df3..596ca63 100644 --- a/layouts/archives/single.html +++ b/layouts/archives/single.html @@ -11,23 +11,28 @@ {{ $img := newScratch }} {{ $folder := (print "/content/" .File.Dir "gallery/") }} {{ $files := readDir $folder }} + {{ $img.Set "max" 0 }} {{ range sort $files "Name" "asc" }} {{ if not .IsDir }} - {{ $img.Add "list" (slice .Name) }} + {{ if not (in .Name "thumb") }} + {{ $img.Add "list" (slice .Name) }} + {{ $img.Set "max" (add ($img.Get "max") 1) }} + {{ end }} {{ end }} {{ end }} - {{ with ($img.Get "list") }} - {{ $img.Set "max" (add 1 (int (index (split (index (split (index (last 1 .) 0) ".") 0) "img") 1))) }} - {{ end }} {{ range $index, $val := $img.Get "list" }} {{ $curr := index (split $val ".") 0 }} {{ $prec := mod (add (sub $index 1) ($img.Get "max")) ($img.Get "max") }} {{ $next := mod (add $index 1) ($img.Get "max") }} - + + + + + -