fix: update permalink handling in subpath setting

This commit is contained in:
geekifan
2025-05-11 17:58:59 +08:00
parent 102129f36a
commit f615f3bd8a
6 changed files with 89 additions and 88 deletions

View File

@ -1,10 +1,11 @@
<div class="lang-dropdown">
<select class="lang-select" onchange="location = this.value;">
{{ $currentLang := .Site.Language.Lang }}
{{ $siteBase := strings.TrimSuffix "/" .Site.BaseURL }}
{{ range .Site.Languages }}
<option value="/{{ .Lang }}/" {{ if eq .Lang $currentLang }}selected{{ end }}>
{{ .LanguageName }}
</option>
<option value="{{ $siteBase }}/{{ .Lang }}/" {{ if eq .Lang $currentLang }}selected{{ end }}>
{{ .LanguageName }}
</option>
{{ end }}
</select>
</div>