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 }} {{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- $pages := .Page.Pages }} {{- $pages := .Page.Pages }}
{{- if .Page.IsHome }} {{- if .Page.Sections}}
{{- $pages = .Page.Sections }}
{{- else if .Page.Sections}}
{{- $pages = (.Page.Pages | union .Page.Sections) }} {{- $pages = (.Page.Pages | union .Page.Sections) }}
{{- end }} {{- end }}
{{- $limit := .Site.Config.Services.RSS.Limit -}} {{- $limit := .Site.Config.Services.RSS.Limit -}}

View file

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

View file

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

View file

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

View file

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