theme: allow pages on top level #434

This commit is contained in:
Sören Weber 2023-01-22 22:16:31 +01:00
parent fe2d96f386
commit 0c10cc8af3
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
5 changed files with 12 additions and 21 deletions

View file

@ -1,8 +1,6 @@
{{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- $pages := .Page.Pages }}
{{- if .Page.IsHome }}
{{- $pages = .Page.Sections }}
{{- else if .Page.Sections}}
{{- if .Page.Sections}}
{{- $pages = (.Page.Pages | union .Page.Sections) }}
{{- end }}
{{- $limit := .Site.Config.Services.RSS.Limit -}}

View file

@ -29,11 +29,11 @@
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
{{- if eq $currentOrdersectionsby "title" }}
{{- range .Site.Home.Sections.ByTitle }}
{{- range .Site.Home.Pages.ByTitle }}
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
{{- end }}
{{- else }}
{{- range .Site.Home.Sections.ByWeight }}
{{- range .Site.Home.Pages.ByWeight }}
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
{{- end }}
{{- end }}
@ -134,9 +134,7 @@
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $isActive := $isSelf }}
{{- $pages := .Pages }}
{{- if .Page.IsHome }}
{{- $pages = .Sections }}
{{- else if .Page.Sections}}
{{- if .Sections}}
{{- $pages = (.Pages | union .Sections) }}
{{- end }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}

View file

@ -14,7 +14,10 @@
{{- end }}
{{- end }}
{{- end }}
{{- $pages := .Site.Home.Sections }}
{{- $pages := .Site.Home.Pages }}
{{- if .Site.Home.Sections}}
{{- $pages = (.Site.Home.Pages | union .Site.Home.Sections) }}
{{- end }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- if $isShortcut }}
@ -53,9 +56,7 @@
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $isActive = or $isSelf $isActive }}
{{- $pages := .Pages }}
{{- if .Page.IsHome }}
{{- $pages = .Sections }}
{{- else if .Page.Sections}}
{{- if .Sections}}
{{- $pages = (.Pages | union .Sections) }}
{{- end }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}

View file

@ -52,9 +52,7 @@
{{- end }}
{{- $pages := .node.Pages }}
{{- if .node.IsHome }}
{{- $pages = .node.Sections }}
{{- else if .node.Sections }}
{{- if .node.Sections }}
{{- $pages = (.node.Pages | union .node.Sections) }}
{{- end }}
{{- $defaultOrdersectionsby := .defaultOrdersectionsby }}

View file

@ -18,9 +18,7 @@
{{- with $context }}
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
{{- $pages := .Page.Pages }}
{{- if .Page.IsHome }}
{{- $pages = .Page.Sections }}
{{- else if .Page.Sections}}
{{- if .Page.Sections}}
{{- $pages = (.Page.Pages | union .Page.Sections) }}
{{- end }}
@ -89,9 +87,7 @@
{{- end }}
{{- $pages := .Page.Pages }}
{{- if .Page.IsHome }}
{{- $pages = .Page.Sections }}
{{- else if .Page.Sections}}
{{- if .Page.Sections}}
{{- $pages = (.Page.Pages | union .Page.Sections) }}
{{- end }}