refactor: add example for forks in other languages

This commit is contained in:
Ryan Yin 2024-11-14 14:24:41 +08:00
parent 24c9d45f0d
commit 9021679b53
2 changed files with 31 additions and 7 deletions

View File

@ -6,6 +6,11 @@ import { zh } from './zh'
export default defineConfig({ export default defineConfig({
...shared, ...shared,
title: "NixOS & Flakes Book",
rewrites: {
"en/:rest*": ":rest*",
},
locales: { locales: {
root: { root: {
label: 'English', label: 'English',
@ -15,6 +20,31 @@ export default defineConfig({
label: '简体中文', label: '简体中文',
...zh ...zh
}, },
} },
// For forks in other languages, here is an example of how to add a new locale:
// rewrites: {
// "ja/:rest*": ":rest*",
// },
// // Exclude the original language's markdown files when build dist
// // NOTE: You can still preview the original language's pages in dev mode
// srcExclude: ['zh/**/*.md', 'en/**/*.md'],
// locales: {
// // Your language's root configuration
// root: {
// label: 'Japanese',
// ...ja,
// },
//
// // Languages maintained by the original author
// en: {
// label: 'English',
// link: "https://nixos-and-flakes.thiscute.world/",
// },
// zh: {
// label: '简体中文',
// link: "https://nixos-and-flakes.thiscute.world/zh/",
// },
// },
}) })

View File

@ -5,12 +5,6 @@ import { PageData, defineConfig } from "vitepress"
const require = createRequire(import.meta.url) const require = createRequire(import.meta.url)
export const shared = defineConfig({ export const shared = defineConfig({
title: "NixOS & Flakes Book",
rewrites: {
"en/:rest*": ":rest*",
},
// Whether to get the last updated timestamp for each page using Git. // Whether to get the last updated timestamp for each page using Git.
lastUpdated: true, lastUpdated: true,
// remove trailing `.html` // remove trailing `.html`