mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
theme: treat pages without title as hidden #59
This commit is contained in:
parent
e6459c4d5c
commit
d04bbaad4e
3 changed files with 8 additions and 8 deletions
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
{{ define "menu-nextprev" }}
|
{{ define "menu-nextprev" }}
|
||||||
{{$currentNode := .currentnode }}
|
{{$currentNode := .currentnode }}
|
||||||
{{ if ne .menu.Params.hidden true}}
|
{{ if and (ne .menu.Params.hidden true) (ne .menu.Title "") }}
|
||||||
{{if hasPrefix $currentNode.RelPermalink .menu.RelPermalink }}
|
{{if hasPrefix $currentNode.RelPermalink .menu.RelPermalink }}
|
||||||
{{ $currentNode.Scratch.Set "NextPageOK" "OK" }}
|
{{ $currentNode.Scratch.Set "NextPageOK" "OK" }}
|
||||||
{{ $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") }}
|
{{ $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") }}
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
{{ $alwaysopen := .alwaysopen }}
|
{{ $alwaysopen := .alwaysopen }}
|
||||||
{{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
|
{{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
|
||||||
{{with .sect}}
|
{{with .sect}}
|
||||||
{{if and .IsSection (or (not .Params.hidden) $.showhidden)}}
|
{{if and .IsSection (or (and (not .Params.hidden) (ne .Title "")) $.showhidden )}}
|
||||||
{{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{{else if .IsAncestor $currentNode }} parent{{else if $currentAlwaysopen}} parent{{end}}">
|
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{else if .IsAncestor $currentNode }} parent{{else if $currentAlwaysopen}} parent{{end}}">
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
{{ 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}}
|
||||||
</a>
|
</a>
|
||||||
{{ $numberOfPages := (add (len ( where .Pages "Params.hidden" "ne" true )) (len ( where .Sections "Params.hidden" "ne" true ))) }}
|
{{ $numberOfPages := (add (len (where (where .Pages "Params.hidden" "ne" true ) "Title" "ne" "" )) (len (where (where .Sections "Params.hidden" "ne" true ) "Title" "ne" "" )) ) }}
|
||||||
{{ if ne $numberOfPages 0 }}
|
{{ if ne $numberOfPages 0 }}
|
||||||
<ul>
|
<ul>
|
||||||
{{ $currentNode.Scratch.Set "pages" .Pages }}
|
{{ $currentNode.Scratch.Set "pages" .Pages }}
|
||||||
|
@ -124,14 +124,14 @@
|
||||||
|
|
||||||
{{if eq .Site.Params.ordersectionsby "title"}}
|
{{if eq .Site.Params.ordersectionsby "title"}}
|
||||||
{{ range $pages.ByTitle }}
|
{{ range $pages.ByTitle }}
|
||||||
{{ if and .Params.hidden (not $.showhidden) }}
|
{{ if and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{ range $pages.ByWeight }}
|
{{ range $pages.ByWeight }}
|
||||||
{{ if and .Params.hidden (not $.showhidden) }}
|
{{ if and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</li>
|
</li>
|
||||||
{{else if not .Params.Hidden }}
|
{{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}}">
|
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{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" . }}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
{{ define "childs" }}
|
{{ define "childs" }}
|
||||||
{{ range .menu }}
|
{{ range .menu }}
|
||||||
{{ if and .Params.hidden (not $.showhidden) }}
|
{{ if and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if not .IsHome}}
|
{{if not .IsHome}}
|
||||||
{{if hasPrefix $.style "h"}}
|
{{if hasPrefix $.style "h"}}
|
||||||
|
|
Loading…
Reference in a new issue