From fe9d605d57a9099cc096c60c09f34986a385f180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 21 Jul 2024 21:49:53 +0200 Subject: [PATCH] theme: simplify pagesBy #685 --- layouts/partials/menu.html | 4 ++-- layouts/partials/nested-article.hugo | 4 ++-- layouts/partials/page-meta.hugo | 2 +- layouts/partials/pageHelper/pagesBy.html | 10 ---------- layouts/partials/shortcodes/children.html | 4 ++-- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 532bfebb30..be4c716ab7 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -31,7 +31,7 @@
    - {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .Site.Home "hidden" true) }} + {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .Site.Home) }} {{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }} {{- range $pages }} {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }} @@ -130,7 +130,7 @@ {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} {{- $isActive := $isSelf }} - {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }} + {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- if $hidden }} diff --git a/layouts/partials/nested-article.hugo b/layouts/partials/nested-article.hugo index 2dada9901f..16270724bc 100644 --- a/layouts/partials/nested-article.hugo +++ b/layouts/partials/nested-article.hugo @@ -3,7 +3,7 @@ {{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }} {{- with $page }} {{- $currentNode := . }} - {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }} + {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }} {{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }} {{- if $pages }}
    @@ -23,7 +23,7 @@ {{- with .sect }} {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} - {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }} + {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- if $hidden }} diff --git a/layouts/partials/page-meta.hugo b/layouts/partials/page-meta.hugo index 1dea5e9068..ea157ef321 100644 --- a/layouts/partials/page-meta.hugo +++ b/layouts/partials/page-meta.hugo @@ -50,7 +50,7 @@ {{- end }} {{- end }} - {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node "hidden" true) }} + {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node) }} {{- range $pages }} {{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current }} {{- end }} diff --git a/layouts/partials/pageHelper/pagesBy.html b/layouts/partials/pageHelper/pagesBy.html index b720a02dc6..734d47a3d2 100644 --- a/layouts/partials/pageHelper/pagesBy.html +++ b/layouts/partials/pageHelper/pagesBy.html @@ -32,14 +32,4 @@ {{- $pages = $page.Pages }} {{- end }} -{{- if not $hidden }} - {{- $nonhiddenpages := slice }} - {{- range $page := $pages }} - {{- if not (partial "pageHelper/isHidden.html" $page) }} - {{- $nonhiddenpages := $nonhiddenpages | append $page }} - {{- end }} - {{- end }} - {{- $pages = $nonhiddenpages }} -{{- end }} - {{- return $pages }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/children.html b/layouts/partials/shortcodes/children.html index bd005fa9d4..94ac4c2224 100644 --- a/layouts/partials/shortcodes/children.html +++ b/layouts/partials/shortcodes/children.html @@ -21,7 +21,7 @@ {{- with $page }} {{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }} - {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }} + {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }} {{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} {{ (printf "" $containerstyle)|safeHTML }} {{- end }} @@ -66,7 +66,7 @@ {{- (printf "<%s>" $.containerstyle)|safeHTML }} {{- end }} - {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }} + {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }} {{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} {{- if eq $.style "li" }}