{{ $page := . }} {{ $collections := slice }} {{ $h2size := "h4" }} {{ $manypagegroups := false }} {{ $pagegroups := slice }} {{ $pager := false }} {{ $pages := $page.RegularPages }} {{ $sections := $page.Sections }} {{ range $name, $taxonomy := cond $page.IsHome site.Taxonomies slice }} {{ $collections = $collections | append $taxonomy.Page }} {{ end }} {{ if and (not $pages) (in (slice "taxonomy" "term") $page.Kind) }} {{ $pages = $page.Pages }} {{ end }} {{ $pinned := where $pages "Params.paige.pin" true }} {{ $unpinned := complement $pinned $pages }} {{ $weighted := where $unpinned "Weight" "gt" 0 }} {{ if $weighted }} {{ $h2size = "h5" }} {{ $pager = $page.Paginate $unpinned.ByWeight }} {{ else }} {{ $pager = $page.Paginate ($unpinned.GroupByPublishDate "January 2006") }} {{ $pagegroups = $pager.PageGroups }} {{ $manypagegroups = gt (len $pagegroups) 1 }} {{ if not $manypagegroups }} {{ $h2size = "h5" }} {{ end }} {{ end }} {{ with $collections }}
{{ if or $sections $pages }}

{{ i18n "paige_collections" }}

{{ end }} {{ range .ByWeight }} {{ partial "paige/page.html" . }} {{ end }}
{{ end }} {{ with $sections }}
{{ if or $collections $pages }}

{{ i18n "paige_sections" }}

{{ end }} {{ range .ByWeight }} {{ partial "paige/page.html" . }} {{ end }}
{{ end }} {{ with $pages }}
{{ if or $collections $sections }}

{{ i18n "paige_pages" }}

{{ end }} {{ range $pinned.ByWeight }} {{ partial "paige/page.html" . }} {{ end }} {{ if $pagegroups }} {{ range $pagegroups }} {{ if $manypagegroups }}

{{ .Key }}

{{ end }} {{ range .Pages.ByPublishDate.Reverse }} {{ partial "paige/page.html" . }} {{ end }} {{ end }} {{ else }} {{ range $pager.Pages }} {{ partial "paige/page.html" . }} {{ end }} {{ end }}
{{ if or $pager.HasPrev $pager.HasNext }}
{{ end }} {{ end }}