mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
menu: always hide hidden sub pages #77
This commit is contained in:
parent
a57b650388
commit
c969f3b13f
4 changed files with 12 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
||||||
{{- $pages := slice }}
|
{{- $pages := slice }}
|
||||||
{{- range .Site.Pages }}
|
{{- range .Site.Pages }}
|
||||||
{{- if or (ne (.Scratch.Get "relearnIsHiddenTree") true) (ne .Site.Params.disableSearchHiddenPages true) }}
|
{{- if or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) }}
|
||||||
{{- $pages = $pages | append (dict "uri" .RelPermalink "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }}
|
{{- $pages = $pages | append (dict "uri" .RelPermalink "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -59,16 +59,15 @@
|
||||||
{{- $isPostSelf := and ($isSelfFound) (not $isSelf) }}
|
{{- $isPostSelf := and ($isSelfFound) (not $isSelf) }}
|
||||||
|
|
||||||
{{- $hidden_node := or (.node.Params.hidden) (eq .node.Title "") }}
|
{{- $hidden_node := or (.node.Params.hidden) (eq .node.Title "") }}
|
||||||
{{- $hidden_tree:= or $hidden_node .hidden }}
|
{{- $hidden_stem:= or $hidden_node .hidden }}
|
||||||
{{- $hidden_from_current := or (and $hidden_node (not $isAncestor) (not $isSelf) ) (and .hidden (or $isPreSelf $isPostSelf $isDescendant) ) }}
|
{{- $hidden_from_current := or (and $hidden_node (not $isAncestor) (not $isSelf) ) (and .hidden (or $isPreSelf $isPostSelf $isDescendant) ) }}
|
||||||
{{- .node.Scratch.Set "relearnIsHiddenNode" $hidden_node}}
|
{{- .node.Scratch.Set "relearnIsHiddenNode" $hidden_node}}
|
||||||
{{- .node.Scratch.Set "relearnIsHiddenTree" $hidden_tree}}
|
{{- .node.Scratch.Set "relearnIsHiddenStem" $hidden_stem}}
|
||||||
{{- .node.Scratch.Set "relearnIsHiddenFromCurrent" $hidden_from_current}}
|
|
||||||
|
|
||||||
{{- if not $hidden_from_current }}
|
{{- if not $hidden_from_current }}
|
||||||
{{- if and $isPreSelf (or $isOther $isAncestor ) }}
|
{{- if $isPreSelf }}
|
||||||
{{- $currentNode.Scratch.Set "relearnPrevPage" .node }}
|
{{- $currentNode.Scratch.Set "relearnPrevPage" .node }}
|
||||||
{{- else if and $isPostSelf (or $isOther $isDescendant) (eq ($currentNode.Scratch.Get "relearnNextPage") nil) }}
|
{{- else if and $isPostSelf (eq ($currentNode.Scratch.Get "relearnNextPage") nil) }}
|
||||||
{{- $currentNode.Scratch.Set "relearnNextPage" .node }}
|
{{- $currentNode.Scratch.Set "relearnNextPage" .node }}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -105,11 +105,12 @@
|
||||||
{{ $alwaysopen := .alwaysopen }}
|
{{ $alwaysopen := .alwaysopen }}
|
||||||
{{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
|
{{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
|
||||||
{{with .sect}}
|
{{with .sect}}
|
||||||
{{ $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
{{ $hidden := and (eq (.Scratch.Get "relearnIsHiddenStem") true) (not $.showhidden) (not (.IsAncestor $currentNode))}}
|
||||||
{{if .IsSection }}
|
{{if $hidden }}
|
||||||
|
{{else if .IsSection }}
|
||||||
{{safeHTML .Params.head}}
|
{{safeHTML .Params.head}}
|
||||||
{{ $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
|
{{ $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
|
||||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}{{if .IsAncestor $currentNode }} parent{{end}}{{if $currentAlwaysopen}} alwaysopen{{end}}{{if $hidden}} hidden{{end}}">
|
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}{{if .IsAncestor $currentNode }} parent{{end}}{{if $currentAlwaysopen}} alwaysopen{{end}}">
|
||||||
<a href="{{.RelPermalink}}">
|
<a href="{{.RelPermalink}}">
|
||||||
{{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }}
|
{{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }}
|
||||||
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||||
|
|
|
@ -210,7 +210,7 @@ textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[typ
|
||||||
#sidebar ul.topics.searched ul {
|
#sidebar ul.topics.searched ul {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
#sidebar ul.topics ul, #sidebar ul.topics li.hidden {
|
#sidebar ul.topics ul {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#sidebar ul.topics > li > ul > li:last-child {
|
#sidebar ul.topics > li > ul > li:last-child {
|
||||||
|
@ -219,8 +219,8 @@ textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[typ
|
||||||
#sidebar ul.topics ul ul {
|
#sidebar ul.topics ul ul {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
#sidebar ul.topics li.parent > ul, #sidebar ul.topics li.parent.hidden,
|
#sidebar ul.topics li.parent > ul,
|
||||||
#sidebar ul.topics li.active > ul, #sidebar ul.topics li.active.hidden,
|
#sidebar ul.topics li.active > ul,
|
||||||
#sidebar ul.topics li.alwaysopen > ul {
|
#sidebar ul.topics li.alwaysopen > ul {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue