{{ $page := . }} {{ $collections := cond $page.IsHome site.Taxonomies slice }} {{ $sections := where $page.Pages "Kind" "section" }} {{ $pages := where $page.Pages "Kind" "in" (slice "page" "term") }} {{ with $collections }}
{{ if or $sections $pages }}

{{ i18n "paige_collections" }}

{{ end }} {{ range $k, $v := . }} {{ partial "paige/subpage.html" (site.GetPage $k) }} {{ end }}
{{ end }} {{ with $sections }}
{{ if or $collections $pages }}

{{ i18n "paige_sections" }}

{{ end }} {{ range . }} {{ partial "paige/subpage.html" . }} {{ end }}
{{ end }} {{ with $pages }} {{ if $page.Param "paige.section_pages.full_pages" }} {{ $pager := $page.Paginate . }}
{{ if or $collections $sections }}

{{ i18n "paige_pages" }}

{{ end }} {{ range $pager.Pages }} {{ partial "paige/article.html" (dict "fullpages" true "page" .) }} {{ end }}
{{ if or $pager.HasPrev $pager.HasNext }}
{{ partial "paige/pagination.html" $page }}
{{ end }} {{ else }}
{{ if or $collections $sections }}

{{ i18n "paige_pages" }}

{{ end }} {{ $pinned := where . "Params.paige.pin" true }} {{ range $pinned.ByPublishDate.Reverse }} {{ partial "paige/subpage.html" . }} {{ end }} {{ $unpinned := complement $pinned . }} {{ $pagegroups := $unpinned.ByPublishDate.Reverse.GroupByPublishDate "January 2006" }} {{ $pager := $page.Paginate $pagegroups }} {{ range $pager.PageGroups }}

{{ .Key }}

{{ range .Pages }} {{ partial "paige/subpage.html" . }} {{ end }} {{ end }}
{{ if or $pager.HasPrev $pager.HasNext }}
{{ partial "paige/pagination.html" $page }}
{{ end }} {{ end }} {{ end }}