From 6a2f11d780f326baf5ac840135f5a10b9b2037f0 Mon Sep 17 00:00:00 2001 From: Pat David Date: Sat, 1 Mar 2025 02:39:36 -0600 Subject: [PATCH] fix: sidebar more menu item link with multilingual (#594) * sidebar: fix more menu item with multilingual Fixes #593 Correctly parses multilingual URL in sidebar, particularly if lang code follows a nested sub directory. For instance, GH pages hosting where the baseurl might be of the format `https://.github.io//`. * Update sidebar.html --------- Co-authored-by: Xin --- layouts/partials/sidebar.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 318d240..748d734 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -144,7 +144,13 @@ {{ $name }} {{ else }} -
  • {{ template "sidebar-item-link" dict "active" false "title" $name "link" (.URL | relLangURL) }}
  • + {{- $link := .URL -}} + {{- with .PageRef -}} + {{- if hasPrefix . "/" -}} + {{- $link = relLangURL (strings.TrimPrefix "/" .) -}} + {{- end -}} + {{- end -}} +
  • {{ template "sidebar-item-link" dict "active" false "title" $name "link" $link }}
  • {{ end }} {{- end -}} {{- end -}}