Merge pull request #135 from life1347/fix-zero-obj-warning

Fix '.File.UniqueID on zero object' warning
This commit is contained in:
Mehedi Sharif Titas 2020-03-11 15:24:40 +06:00 committed by GitHub
commit 3356704ddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,8 +80,12 @@
{{ $currentNode := .currentnode }}
{{with .sect}}
{{safeHTML .Params.head}}
{{ $fileUniqueID := "" }}
{{ with .File }}{{ $fileUniqueID = .UniqueID }}{{ end }}
{{ $currentNodeFileUniqueID := "" }}
{{ with $currentNode.File }}{{ $currentNodeFileUniqueID = .UniqueID }}{{ end }}
<li data-nav-id="{{.Permalink}}" title="{{.Title}}" class="sidelist
{{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}">
{{if eq $fileUniqueID $currentNodeFileUniqueID}}active{{end}}">
<a href="{{.Permalink}}">
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
</a>