menu: remove usage of Hugos UniqueID #131

This commit is contained in:
Sören Weber 2021-10-31 11:16:55 +01:00
parent d3b0b9a6fe
commit a25243d7e7
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -98,9 +98,8 @@
{{- define "section-tree-nav" }} {{- define "section-tree-nav" }}
{{- $showvisitedlinks := .showvisitedlinks }} {{- $showvisitedlinks := .showvisitedlinks }}
{{- $currentNode := .currentnode }} {{- $currentNode := .currentnode }}
{{- $currentFileUniqueID := "" }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- $alwaysopen := .alwaysopen }} {{- $alwaysopen := .alwaysopen }}
{{- with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
{{- with .sect }} {{- with .sect }}
{{- $hidden := and (eq (.Scratch.Get "relearnIsHiddenFromCurrent") true) (not $.showhidden) (not (.IsAncestor $currentNode)) }} {{- $hidden := and (eq (.Scratch.Get "relearnIsHiddenFromCurrent") true) (not $.showhidden) (not (.IsAncestor $currentNode)) }}
{{- if $hidden }} {{- if $hidden }}
@ -109,7 +108,7 @@
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }} {{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- $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}}"><a href="{{.RelPermalink}}"> <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .RelPermalink $currentFileRelPermalink}} active{{end}}{{if .IsAncestor $currentNode }} parent{{end}}{{if $currentAlwaysopen}} alwaysopen{{end}}"><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 }}</a><ul> {{- if $showvisitedlinks }}<i class="fas fa-check read-icon"></i>{{ end }}</a><ul>
{{- $pages := .Pages }} {{- $pages := .Pages }}
@ -129,7 +128,7 @@
{{- end }} {{- end }}
{{- end }}</ul></li> {{- end }}</ul></li>
{{- else }} {{- else }}
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}"><a href="{{.RelPermalink}}"> <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .RelPermalink $currentFileRelPermalink}} active{{end}}"><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 }}</a></li> {{- if $showvisitedlinks }}<i class="fas fa-check read-icon"></i>{{ end }}</a></li>
{{- end }} {{- end }}