summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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[] {