From 5c69862832f7b6066bf8305fce9909789222dfc9 Mon Sep 17 00:00:00 2001 From: Sped0n Date: Fri, 3 Nov 2023 09:51:44 +0800 Subject: [PATCH] fix(layouts): fix variable name from $name to $dirName in currentMenuItem.html partial to improve semantics and clarity --- layouts/404.html | 2 +- layouts/_default/single.html | 2 +- layouts/partials/function/currentMenuItem.html | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/layouts/404.html b/layouts/404.html index 687f625..a195bd3 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,7 +2,7 @@ {{- $params := .Scratch.Get "params" -}} {{- $currentPage := . -}} {{- with partial "function/currentMenuItem.html" . -}} - {{- partial "resources/imageJSON.html" (dict "Path" .Name "Page" $currentPage) -}} + {{- partial "resources/imageJSON.html" (dict "Path" .DirName "Page" $currentPage) -}} {{- end -}}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 622601d..ddc0d8d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,7 +2,7 @@ {{- $params := .Scratch.Get "params" -}} {{- $currentPage := . -}} {{- with partial "function/currentMenuItem.html" . -}} - {{- partial "resources/imageJSON.html" (dict "Path" .Name "Page" $currentPage) -}} + {{- partial "resources/imageJSON.html" (dict "Path" .DirName "Page" $currentPage) -}} {{- end -}}
diff --git a/layouts/partials/function/currentMenuItem.html b/layouts/partials/function/currentMenuItem.html index d728f0d..a84d487 100644 --- a/layouts/partials/function/currentMenuItem.html +++ b/layouts/partials/function/currentMenuItem.html @@ -1,15 +1,15 @@ {{- $currentPage := . -}} -{{- $name := "" -}} +{{- $dirName := "" -}} {{- $id := -1 -}} {{- range site.Menus.main -}} {{ $menu_item_url := .URL | relLangURL }} {{ $page_url:= $currentPage.RelPermalink | relLangURL }} {{ if eq $menu_item_url $page_url }} - {{- $name = .Identifier -}} + {{- $dirName = .Identifier -}} {{- $id = .Weight -}} {{- end -}} {{- end -}} -{{- return (dict "Name" $name "ID" $id) -}} +{{- return (dict "DirName" $dirName "ID" $id) -}}