From ae40ac5bcb30a92444fb99f11e1adf0e6f33523d Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 6 Jul 2020 21:59:33 +0200 Subject: [PATCH] fix page params loop --- layouts/partials/list.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/layouts/partials/list.html b/layouts/partials/list.html index 780159d..0255798 100644 --- a/layouts/partials/list.html +++ b/layouts/partials/list.html @@ -22,8 +22,11 @@ - {{ range $i, $name := sort .Params.Authors }} - {{ $author := index $.Site.Data.authors $name }} + {{ $.Scratch.Set "author-counter" 0 }} + {{ with .Params.authors }} + {{ range sort . }} + {{ $i := $.Scratch.Get "author-counter" }} + {{ $author := index $.Site.Data.authors . }} {{ with $.Site.GetPage (printf "/authors/%s" $author.name | urlize) }} {{ if eq $i 0 }} @@ -36,9 +39,15 @@ {{ end }} {{ end }} + {{ $.Scratch.Set "author-counter" (add ($i) 1) }} + {{ end }} {{ end }} - {{ range $i, $name := sort .Params.Tags }} + {{ $.Scratch.Set "tag-counter" 0 }} + {{ with .Params.tags }} + {{ range sort . }} + {{ $i := $.Scratch.Get "tag-counter" }} + {{ $name := . }} {{ if eq $i 0 }} @@ -51,6 +60,8 @@ {{ if eq $i 0 }} {{ end }} + {{ $.Scratch.Set "tag-counter" (add ($i) 1) }} + {{ end }} {{ end }}