summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSho Sakuma <me@m1sk9.dev>2026-03-09 13:37:15 +0900
committerGitHub <noreply@github.com>2026-03-09 13:37:15 +0900
commit384178d694b109c5f83ab73a03b01aa78b06d670 (patch)
treec1a595627c62b23c05622d59d801e70accc0af81
parent04c6a0899093e56552587bddf61256fe434ffebe (diff)
parenta2c11989f8d826a5b6141b6f48b0899f44840c83 (diff)
downloadLunaticChat-384178d694b109c5f83ab73a03b01aa78b06d670.tar.gz
LunaticChat-384178d694b109c5f83ab73a03b01aa78b06d670.tar.bz2
LunaticChat-384178d694b109c5f83ab73a03b01aa78b06d670.zip
Merge pull request #136 from m1sk9/fix/docs-version-switcher
fix(docs): prevent double-slash URL in version switcher for root locale
-rw-r--r--docs/.vitepress/theme/VersionSwitcher.vue6
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/.vitepress/theme/VersionSwitcher.vue b/docs/.vitepress/theme/VersionSwitcher.vue
index e534426..d3ecd62 100644
--- a/docs/.vitepress/theme/VersionSwitcher.vue
+++ b/docs/.vitepress/theme/VersionSwitcher.vue
@@ -47,7 +47,8 @@ const activeVersion = computed(() => {
const { currentVersion } = props.versioningPlugin;
const segments = pathSegments.value;
const locale = currentLocale.value;
- const versionCandidate = segments[0] === locale ? segments[1] : segments[0];
+ const hasLocalePrefix = locale !== '' && segments[0] === locale;
+ const versionCandidate = hasLocalePrefix ? segments[1] : segments[0];
return versionSet.value.has(versionCandidate) ? versionCandidate : currentVersion;
});
@@ -64,7 +65,8 @@ const shouldShowCurrentVersion = computed(
);
function isLocaleFirst(segments: string[]): boolean {
- return segments[0] === currentLocale.value;
+ const locale = currentLocale.value;
+ return locale !== '' && segments[0] === locale;
}
function removeVersionSegments(segments: string[]): string[] {