mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
menu: show hidden pages if accessed directly #60
This commit is contained in:
parent
c81bf82ced
commit
d3f70bd846
5 changed files with 16 additions and 23 deletions
|
@ -1,5 +1,6 @@
|
|||
+++
|
||||
chapter = true
|
||||
hidden = true
|
||||
title = "This could be yours"
|
||||
weight = 4
|
||||
+++
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
{{ define "menu-nextprev" }}
|
||||
{{$currentNode := .currentnode }}
|
||||
{{ if and (ne .menu.Params.hidden true) (ne .menu.Title "") }}
|
||||
{{ $hidden := or (.menu.Params.hidden) (eq .menu.Title "") }}
|
||||
{{ if not $hidden }}
|
||||
{{if hasPrefix $currentNode.RelPermalink .menu.RelPermalink }}
|
||||
{{ $currentNode.Scratch.Set "NextPageOK" "OK" }}
|
||||
{{ $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") }}
|
||||
|
|
|
@ -105,14 +105,11 @@
|
|||
{{ $alwaysopen := .alwaysopen }}
|
||||
{{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
|
||||
{{with .sect}}
|
||||
{{if and .IsSection (or (and (not .Params.hidden) (ne .Title "")) $.showhidden )}}
|
||||
{{ $page_hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||
{{if .IsSection }}
|
||||
{{safeHTML .Params.head}}
|
||||
{{ $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}}
|
||||
">
|
||||
<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 $page_hidden}} hidden{{end}}">
|
||||
<a href="{{.RelPermalink}}">
|
||||
{{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }}
|
||||
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||
|
@ -126,25 +123,17 @@
|
|||
|
||||
{{if eq .Site.Params.ordersectionsby "title"}}
|
||||
{{ range $pages.ByTitle }}
|
||||
{{ if and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||
{{else}}
|
||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||
{{end}}
|
||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||
{{ end }}
|
||||
{{else}}
|
||||
{{ range $pages.ByWeight }}
|
||||
{{ if and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||
{{else}}
|
||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||
{{end}}
|
||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||
{{ end }}
|
||||
{{end}}
|
||||
</ul>
|
||||
</li>
|
||||
{{else if and (not .Params.hidden) (ne .Title "") }}
|
||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item
|
||||
{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}
|
||||
">
|
||||
{{else}}
|
||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}">
|
||||
<a href="{{ .RelPermalink}}">
|
||||
{{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }}
|
||||
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
|
||||
{{ define "childs" }}
|
||||
{{ range .menu }}
|
||||
{{ if and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||
{{else}}
|
||||
{{ $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||
{{ if not $hidden }}
|
||||
{{if not .IsHome}}
|
||||
{{if hasPrefix $.style "h"}}
|
||||
{{$num := sub ( int (trim $.style "h") ) 1 }}
|
||||
|
|
|
@ -210,7 +210,7 @@ textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[typ
|
|||
#sidebar ul.topics.searched ul {
|
||||
display: block;
|
||||
}
|
||||
#sidebar ul.topics ul {
|
||||
#sidebar ul.topics ul, #sidebar ul.topics li.hidden {
|
||||
display: none;
|
||||
}
|
||||
#sidebar ul.topics > li > ul > li:last-child {
|
||||
|
@ -219,7 +219,9 @@ textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[typ
|
|||
#sidebar ul.topics ul ul {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
#sidebar ul.topics li.parent > ul, #sidebar ul.topics li.active > ul, #sidebar ul.topics li.alwaysopen > ul {
|
||||
#sidebar ul.topics li.parent > ul, #sidebar ul.topics li.parent.hidden,
|
||||
#sidebar ul.topics li.active > ul, #sidebar ul.topics li.active.hidden,
|
||||
#sidebar ul.topics li.alwaysopen > ul {
|
||||
display: block;
|
||||
}
|
||||
#sidebar ul.topics > li > a {
|
||||
|
|
Loading…
Reference in a new issue