English | 中文 |
---|
A documentation template build by vitepress
See live example
- International Multi language supported
- Search in Chinese (Not perfect)
- Auto redirect to browser langugage when no language code specified in url
/
->/en-US/
/Donate
->/en-US/Donate
- URL search params parsing
?search=%s
Once page is loaded, open search box and auto search?autolang
Auto jump to the language provided bynavigator.language
/zh-CN/changelog
->/en-US/changelog
For example, language ID is ru
.
- Create folder
docs/ru
- Add locale config
docs/.vitepress/locales/ru.mts
- Add locale define in
docs/.vitepress/locales.mts
const langs = [ 'en-US', 'zh-CN', 'ru', ]; ...
For example, sector name is readme
- Create directory
docs/readme/
- Create index page
docs/readme/index.md
- Add to nav bar
Edit every locale script under
docs/.vitepress/locales/
... themeConfig: { nav: [ ... // Add to nav bar { text: 'Readme', link: `/${lang}/readme/` }, ], sidebar: { ... // Auto generate sidebar '/zh-CN/readme': buildSidebar(`/${lang}/readme`), } } ...
For example, set base to Third-Person
Just modify .vitepress/config.mts
export default defineConfig({
base: 'Third-Person',
...
});
For example, change source root to pages
- Edit
docs/.vitepress/config.mts
export default defineConfig({ srcDir: 'pages', ... })
- Edit
docs/.vitepress/builders.mts
export function buildSidebar(dir: string, docsRoot: string = 'pages'): any { ...