mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-17 09:10:08 +00:00
Fix .File.UniqueID on zero object warning
This commit is contained in:
parent
41c6cc522f
commit
f7847b6a3a
1 changed files with 4 additions and 3 deletions
|
@ -94,12 +94,14 @@
|
||||||
{{ define "section-tree-nav" }}
|
{{ define "section-tree-nav" }}
|
||||||
{{ $showvisitedlinks := .showvisitedlinks }}
|
{{ $showvisitedlinks := .showvisitedlinks }}
|
||||||
{{ $currentNode := .currentnode }}
|
{{ $currentNode := .currentnode }}
|
||||||
|
{{ $currentFileUniqueID := "" }}
|
||||||
|
{{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
|
||||||
{{with .sect}}
|
{{with .sect}}
|
||||||
{{if and .IsSection ((not .Params.hidden) or $.showhidden)}}
|
{{if and .IsSection ((not .Params.hidden) or $.showhidden)}}
|
||||||
{{safeHTML .Params.head}}
|
{{safeHTML .Params.head}}
|
||||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item
|
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item
|
||||||
{{if .IsAncestor $currentNode }}parent{{end}}
|
{{if .IsAncestor $currentNode }}parent{{end}}
|
||||||
{{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}
|
{{if eq .File.UniqueID $currentFileUniqueID}}active{{end}}
|
||||||
{{if .Params.alwaysopen}}parent{{end}}
|
{{if .Params.alwaysopen}}parent{{end}}
|
||||||
">
|
">
|
||||||
<a href="{{.RelPermalink}}">
|
<a href="{{.RelPermalink}}">
|
||||||
|
@ -137,7 +139,7 @@
|
||||||
</li>
|
</li>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{ if not .Params.Hidden }}
|
{{ if not .Params.Hidden }}
|
||||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item {{if eq .File.UniqueID $currentNode.File.UniqueID}}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}}">
|
||||||
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
||||||
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||||
|
@ -147,4 +149,3 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue