mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 03:03:09 +00:00
39 lines
No EOL
1.2 KiB
Go Template
39 lines
No EOL
1.2 KiB
Go Template
{{- $page := .page }}
|
|
{{- /* default sort order for the theme is historically by weight */}}
|
|
{{- $by := .by }}
|
|
{{- if eq $by "auto" }}
|
|
{{- $by = "" }}
|
|
{{- end }}
|
|
{{- $by = $by | default $page.Params.ordersectionsby | default $page.Site.Params.ordersectionsby | default "weight" }}
|
|
|
|
{{- $pages := slice }}
|
|
|
|
{{- if eq $by "weight" }}
|
|
{{- $pages = $page.Pages.ByWeight }}
|
|
{{- else if or (eq $by "name") (eq $by "title") (eq $by "linktitle") }}
|
|
{{- $pages = $page.Pages.ByLinkTitle }}
|
|
{{- else if eq $by "modifieddate" }}
|
|
{{- $pages = $page.Pages.Lastmod }}
|
|
{{- else if eq $by "expirydate" }}
|
|
{{- $pages = $page.Pages.ByExpiryDate }}
|
|
{{- else if eq $by "publishdate" }}
|
|
{{- $pages = $page.Pages.ByPublishDate }}
|
|
{{- else if eq $by "date" }}
|
|
{{- $pages = $page.Pages.ByDate }}
|
|
{{- else if eq $by "length" }}
|
|
{{- $pages = $page.Pages.ByLength }}
|
|
{{- else if eq $by "default" }}
|
|
{{- $pages = $page.Pages }}
|
|
{{- else }}
|
|
{{- warnf "%q: Unknown pages sort order '%s'" $page.File.Filename }}
|
|
{{- $pages = $page.Pages }}
|
|
{{- end }}
|
|
|
|
{{- $filtered_pages := slice }}
|
|
{{- range $pages }}
|
|
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" .) }}
|
|
{{- $filtered_pages = $filtered_pages | append . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- return $filtered_pages }} |