From 4a80de906eec5708074e6c3cbabd04c018722a63 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Wed, 29 May 2024 22:07:32 -0700 Subject: [PATCH] Fix weight ordering --- layouts/partials/paige/pages.html | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/layouts/partials/paige/pages.html b/layouts/partials/paige/pages.html index 01cfa0d0..3f648314 100644 --- a/layouts/partials/paige/pages.html +++ b/layouts/partials/paige/pages.html @@ -46,19 +46,30 @@ {{ partial "paige/page.html" . }} {{ end }} + {{ $pager := false }} {{ $unpinned := complement $pinned . }} - {{ $pagecollection := $unpinned.GroupByPublishDate "January 2006" }} - {{ $pager := $page.Paginate $pagecollection }} - {{ $pagegroups := $pager.PageGroups}} + {{ $weighted := where $unpinned "Weight" "gt" 0 }} - {{ range $pagegroups }} - {{ if gt (len $pagegroups) 1 }} -

{{ .Key }}

- {{ end }} + {{ if $weighted }} + {{ $pager = $page.Paginate $unpinned.ByWeight }} - {{ range .Pages.ByWeight }} + {{ range $pager.Pages }} {{ partial "paige/page.html" . }} {{ end }} + {{ else }} + {{ $pager = $page.Paginate ($unpinned.GroupByPublishDate "January 2006") }} + + {{ $pagegroups := $pager.PageGroups }} + + {{ range $pagegroups }} + {{ if gt (len $pagegroups) 1 }} +

{{ .Key }}

+ {{ end }} + + {{ range .Pages.ByWeight }} + {{ partial "paige/page.html" . }} + {{ end }} + {{ end }} {{ end }}