From 8aaa1228b5848d280422d74cf376f68a31b163e1 Mon Sep 17 00:00:00 2001
From: Ajay Singh <37625112+Ajay-singh1@users.noreply.github.com>
Date: Fri, 16 May 2025 04:32:14 +0530
Subject: [PATCH] fix : Hugo partial rendering error (#16475)
---
layouts/partials/navigation_level.html | 30 +++++++++++++++-----------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/layouts/partials/navigation_level.html b/layouts/partials/navigation_level.html
index 9b2f901ed0..28b30c0673 100644
--- a/layouts/partials/navigation_level.html
+++ b/layouts/partials/navigation_level.html
@@ -23,7 +23,7 @@
{{ end }}
{{ end }}
-
+
{{ range $pages }}
{{ $pageLocation := (path.Dir (path.Dir .File.Dir)) }}
{{ if and (eq $parentDir $pageLocation) (not .Params.draft) }}
@@ -42,22 +42,28 @@
{{ end }}
{{ if not .IsPage }}
- -
+
-
{{ $collapse := not (.IsAncestor $current) }}
{{ if eq . $current }}
{{ $collapse = true }}
{{ end }}
- {{if lt (len $pageLocation) 6 -}}
- {{ $linktitle}}
- {{ partial "navigation_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" false "top" false "labelledby" "" ) .CurrentSection }}
- {{ else if (.CurrentSection.IsAncestor $current) }}
- {{ $linktitle}}
- {{ partial "navigation_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "" ) }}
- {{- else -}}
- {{ $linktitle}}
- {{ partialCached "navigation_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "" ) .CurrentSection }}
- {{- end -}}
+ {{ if lt (len $pageLocation) 6 }}
+ {{ $linktitle }}
+ {{ if and .CurrentSection (ne .CurrentSection .) (ne .CurrentSection $parent) (ne .CurrentSection $current) .CurrentSection.Pages }}
+ {{ partial "navigation_level.html" (dict "pages" .CurrentSection.Pages "parent" . "current" $current "collapse" false "top" false "labelledby" "") }}
+ {{ end }}
+ {{ else if .CurrentSection.IsAncestor $current }}
+ {{ $linktitle }}
+ {{ if and .CurrentSection (ne .CurrentSection .) (ne .CurrentSection $parent) (ne .CurrentSection $current) .CurrentSection.Pages }}
+ {{ partial "navigation_level.html" (dict "pages" .CurrentSection.Pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "") }}
+ {{ end }}
+ {{ else }}
+ {{ $linktitle }}
+ {{ if and .CurrentSection (ne .CurrentSection .) (ne .CurrentSection $parent) (ne .CurrentSection $current) .CurrentSection.Pages }}
+ {{ partial "navigation_level.html" (dict "pages" .CurrentSection.Pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "") }}
+ {{ end }}
+ {{ end }}
{{ else }}
-