Harness engineering beginner tutorial, from 0 to 1
TypeScript agentagenticagentic-aiaiai-agentai-agentsdshdsh-pluginharnessharness-engineeringharness-frameworkllm
Fix duplicate Chinese locale in language switcher
sanbuphya924ad6d0ec9
diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.jsindex d6964ee..4bf9dfd 100644--- a/docs/.vitepress/theme/index.js+++ b/docs/.vitepress/theme/index.js@@ -1,3 +1,29 @@import DefaultTheme from 'vitepress/theme'-export default DefaultTheme+function syncRootLocaleLabel(siteData, href = '') {+ const locales = siteData.value?.locales+ if (!locales?.root || !locales.en || !locales.zh) return++ const base = siteData.value.base || '/'+ const normalized = href || (typeof window !== 'undefined' ? window.location.pathname : '')+ const relative = normalized.startsWith(base)+ ? normalized.slice(base.length - 1)+ : normalized++ locales.root.label = relative.startsWith('/en/') ? locales.en.label : locales.zh.label+}++export default {+ extends: DefaultTheme,+ enhanceApp(ctx) {+ syncRootLocaleLabel(ctx.siteData)++ const previous = ctx.router.onAfterRouteChange+ ctx.router.onAfterRouteChange = async (to) => {+ syncRootLocaleLabel(ctx.siteData, to)+ if (previous) {+ await previous(to)+ }+ }+ }+}