mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
theme: simplify pagesBy #685
This commit is contained in:
parent
1b2e139512
commit
fe9d605d57
5 changed files with 7 additions and 17 deletions
|
@ -31,7 +31,7 @@
|
||||||
<div id="R-content-wrapper" class="highlightable">
|
<div id="R-content-wrapper" class="highlightable">
|
||||||
<div id="R-topics">
|
<div id="R-topics">
|
||||||
<ul class="enlarge morespace collapsible-menu">
|
<ul class="enlarge morespace collapsible-menu">
|
||||||
{{- $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 }}
|
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
|
||||||
{{- range $pages }}
|
{{- range $pages }}
|
||||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
|
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
|
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
|
||||||
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
|
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
|
||||||
{{- $isActive := $isSelf }}
|
{{- $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 }}
|
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
|
||||||
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
|
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
|
||||||
{{- if $hidden }}
|
{{- if $hidden }}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }}
|
{{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }}
|
||||||
{{- with $page }}
|
{{- with $page }}
|
||||||
{{- $currentNode := . }}
|
{{- $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 }}
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
||||||
{{- if $pages }}
|
{{- if $pages }}
|
||||||
<section>
|
<section>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
{{- with .sect }}
|
{{- with .sect }}
|
||||||
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
|
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
|
||||||
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
|
{{- $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 }}
|
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
|
||||||
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
|
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
|
||||||
{{- if $hidden }}
|
{{- if $hidden }}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node "hidden" true) }}
|
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node) }}
|
||||||
{{- range $pages }}
|
{{- range $pages }}
|
||||||
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current }}
|
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -32,14 +32,4 @@
|
||||||
{{- $pages = $page.Pages }}
|
{{- $pages = $page.Pages }}
|
||||||
{{- end }}
|
{{- 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 }}
|
{{- return $pages }}
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
{{- with $page }}
|
{{- with $page }}
|
||||||
{{ (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 := 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" . }}
|
{{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }}
|
||||||
{{ (printf "</%s>" $containerstyle)|safeHTML }}
|
{{ (printf "</%s>" $containerstyle)|safeHTML }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
|
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
|
||||||
{{- end }}
|
{{- 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 }}
|
{{- 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" }}
|
{{- if eq $.style "li" }}
|
||||||
|
|
Loading…
Reference in a new issue