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://<USERNAME>.github.io/<REPO>/`.

* Update sidebar.html

---------

Co-authored-by: Xin <xin@imfing.com>
This commit is contained in:
Pat David 2025-03-01 02:39:36 -06:00 committed by GitHub
parent 662d9202dc
commit 6a2f11d780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,7 +144,13 @@
<span class="hx-cursor-default">{{ $name }}</span> <span class="hx-cursor-default">{{ $name }}</span>
</li> </li>
{{ else }} {{ else }}
<li>{{ template "sidebar-item-link" dict "active" false "title" $name "link" (.URL | relLangURL) }}</li> {{- $link := .URL -}}
{{- with .PageRef -}}
{{- if hasPrefix . "/" -}}
{{- $link = relLangURL (strings.TrimPrefix "/" .) -}}
{{- end -}}
{{- end -}}
<li>{{ template "sidebar-item-link" dict "active" false "title" $name "link" $link }}</li>
{{ end }} {{ end }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}