* refactor: migrate page visibility control from `Params.hidden` to the new `build.list` parameter. * refactor: centralize page filtering logic into a new `helper/pages.html` partial * feat: introduce `SortBy` parameter to enable sorting pages by last modified date * refactor: extract page sorting logic into a new `pages-sort.html` partial
17 lines
510 B
HTML
17 lines
510 B
HTML
{{- $pages := .Pages -}}
|
|
|
|
{{- if .IsHome -}}
|
|
{{- $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
|
{{- else if or (eq .Kind "section") (eq .Kind "taxonomy") (eq .Kind "term") -}}
|
|
{{- $subsections := .Sections -}}
|
|
{{- $pages = .Pages | complement $subsections -}}
|
|
|
|
{{- if eq (len $pages) 0 -}}
|
|
{{- $pages = $subsections -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- $pages := partial "helper/pages-sort.html" (dict "Pages" $pages "Context" .) -}}
|
|
|
|
{{- return $pages -}}
|