From 3439e019b01d4ffacba1970a0ba287439ec54c40 Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Wed, 11 Mar 2020 16:58:53 +0800 Subject: [PATCH] Fix '.File.UniqueID on zero object' warning --- layouts/partials/default.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layouts/partials/default.html b/layouts/partials/default.html index db653b5..142f401 100644 --- a/layouts/partials/default.html +++ b/layouts/partials/default.html @@ -80,8 +80,12 @@ {{ $currentNode := .currentnode }} {{with .sect}} {{safeHTML .Params.head}} +{{ $fileUniqueID := "" }} +{{ with .File }}{{ $fileUniqueID = .UniqueID }}{{ end }} +{{ $currentNodeFileUniqueID := "" }} +{{ with $currentNode.File }}{{ $currentNodeFileUniqueID = .UniqueID }}{{ end }}
  • + {{if eq $fileUniqueID $currentNodeFileUniqueID}}active{{end}}"> {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}