tags: don't count tags if page is hidden #310

This commit is contained in:
Sören Weber 2022-07-15 21:36:41 +02:00
parent 3abd1225e5
commit 000b399e0c
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 12 additions and 4 deletions

View file

@ -5,8 +5,14 @@
<h1>{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}</h1>
<ul>
{{- range .Data.Terms.Alphabetical }}
{{- if and .Page.Title (or (ne (.Page.Scratch.Get "relearnIsHiddenStem") true) (ne .Page.Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> ({{ len .Pages }})</li>
{{- $len := 0 }}
{{- range .Pages }}
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
{{- $len = add $len 1 }}
{{- end }}
{{- end }}
{{- if $len }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> ({{ $len }})</li>
{{- end }}
{{- else }}
{{- range sort .Pages "Title" }}

View file

@ -38,8 +38,10 @@
{{- $hidden_stem:= or $hidden_node .hiddenstem }}
{{- $hidden_current_stem:= or $hidden_node .hiddencurrent }}
{{- $hidden_from_current := or (and $hidden_node (not $isAncestor) (not $isSelf) ) (and .hiddencurrent (or $isPreSelf $isPostSelf $isDescendant) ) }}
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenNode" .node.RelPermalink $hidden_node }}
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenStem" .node.RelPermalink $hidden_stem }}
{{- if $isSelf }}
{{- $currentNode.Scratch.Set "relearnIsHiddenNode" $hidden_node }}
{{- $currentNode.Scratch.Set "relearnIsHiddenStem" $hidden_stem }}
{{- end}}
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenFrom" .node.RelPermalink $hidden_current_stem }}
{{- if not $hidden_from_current }}