Use default page order

master
Will Faught 5 months ago
parent 3bcd1c93db
commit b531d3fd36

@ -58,19 +58,17 @@
{{ end }} {{ end }}
{{ with $collections }} {{ with $collections }}
{{ $ordered := partial "paige/order.html" (dict "pages" .) }}
<div id="paige-collections"> <div id="paige-collections">
{{ if or $sections $pages }} {{ if or $sections $pages }}
<h2 class="h5 text-center" id="paige-collections-header">{{ i18n "paige_collections" }}</h2> <h2 class="h5 text-center" id="paige-collections-header">{{ i18n "paige_collections" }}</h2>
{{ end }} {{ end }}
{{ if or $sections $pages }} {{ if or $sections $pages }}
{{ range $ordered }} {{ range . }}
{{ partial "paige/list-item.html" . }} {{ partial "paige/list-item.html" . }}
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ $pager := $page.Paginate $ordered }} {{ $pager := $page.Paginate . }}
{{ range $pager.Pages }} {{ range $pager.Pages }}
{{ partial "paige/list-item.html" . }} {{ partial "paige/list-item.html" . }}
@ -82,19 +80,17 @@
{{ end }} {{ end }}
{{ with $sections }} {{ with $sections }}
{{ $ordered := partial "paige/order.html" (dict "pages" .) }}
<div id="paige-sections"> <div id="paige-sections">
{{ if or $collections $pages }} {{ if or $collections $pages }}
<h2 class="h5 text-center" id="paige-sections-header">{{ i18n "paige_sections" }}</h2> <h2 class="h5 text-center" id="paige-sections-header">{{ i18n "paige_sections" }}</h2>
{{ end }} {{ end }}
{{ if $pages }} {{ if $pages }}
{{ range $ordered }} {{ range . }}
{{ partial "paige/list-item.html" . }} {{ partial "paige/list-item.html" . }}
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ $pager := $page.Paginate $ordered }} {{ $pager := $page.Paginate . }}
{{ range $pager.Pages }} {{ range $pager.Pages }}
{{ partial "paige/list-item.html" . }} {{ partial "paige/list-item.html" . }}
@ -106,14 +102,12 @@
{{ end }} {{ end }}
{{ with $pages }} {{ with $pages }}
{{ $ordered := partial "paige/order.html" (dict "pages" .) }}
<div id="paige-pages"> <div id="paige-pages">
{{ if or $collections $sections }} {{ if or $collections $sections }}
<h2 class="h5 text-center" id="paige-pages-header">{{ i18n "paige_pages" }}</h2> <h2 class="h5 text-center" id="paige-pages-header">{{ i18n "paige_pages" }}</h2>
{{ end }} {{ end }}
{{ $pager := $page.Paginate $ordered }} {{ $pager := $page.Paginate . }}
{{ range $pager.Pages }} {{ range $pager.Pages }}
{{ partial "paige/list-item.html" . }} {{ partial "paige/list-item.html" . }}

@ -1,23 +0,0 @@
{{ $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 }}
Loading…
Cancel
Save