Add order.html

This commit is contained in:
Will Faught
2024-07-19 16:44:43 -07:00
parent 5ec0fd8bb1
commit 457e74db4f
2 changed files with 26 additions and 51 deletions

View File

@@ -0,0 +1,23 @@
{{ $params := . }}
{{ $pages := $params.pages }}
{{ $result := slice }}
{{ $weights := $pages.GroupBy "Weight" }}
{{ range $i, $e := $weights }}
{{ if eq $e.Key 0 }}
{{ $weights = slice | append (first $i $weights) | append (after (add $i 1) $weights) | append $e }}
{{ break }}
{{ end }}
{{ end }}
{{ range $weights }}
{{ range (sort (.Pages.GroupBy "PublishDate") "Key").Reverse }}
{{ range .Pages.ByTitle }}
{{ $result = $result | append . }}
{{ end }}
{{ end }}
{{ end }}
{{ return $result }}