From 9021679b5389efffaf5a6f80c1f6c97508592816 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Thu, 14 Nov 2024 14:24:41 +0800 Subject: [PATCH] refactor: add example for forks in other languages --- docs/.vitepress/config/index.ts | 32 +++++++++++++++++++++++++++++++- docs/.vitepress/config/shared.ts | 6 ------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/docs/.vitepress/config/index.ts b/docs/.vitepress/config/index.ts index 51134ae..78983ba 100644 --- a/docs/.vitepress/config/index.ts +++ b/docs/.vitepress/config/index.ts @@ -6,6 +6,11 @@ import { zh } from './zh' export default defineConfig({ ...shared, + title: "NixOS & Flakes Book", + + rewrites: { + "en/:rest*": ":rest*", + }, locales: { root: { label: 'English', @@ -15,6 +20,31 @@ export default defineConfig({ label: '简体中文', ...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/", + // }, + // }, }) diff --git a/docs/.vitepress/config/shared.ts b/docs/.vitepress/config/shared.ts index 489e6e9..820d433 100644 --- a/docs/.vitepress/config/shared.ts +++ b/docs/.vitepress/config/shared.ts @@ -5,12 +5,6 @@ import { PageData, defineConfig } from "vitepress" const require = createRequire(import.meta.url) export const shared = defineConfig({ - title: "NixOS & Flakes Book", - - rewrites: { - "en/:rest*": ":rest*", - }, - // Whether to get the last updated timestamp for each page using Git. lastUpdated: true, // remove trailing `.html`