Skip to content

Configuration

All site configuration lives in astro.config.mjs.

astro.config.mjs
const VERSION = process.env.VERSION || 'main';
const base = VERSION === 'main' ? '/' : `/${VERSION}/`;
export default defineConfig({
site: 'https://read.wiki',
base,
output: 'server',
adapter: node({ mode: 'standalone' }),
// ...
});

Build commands:

Terminal window
# Main version
pnpm build
# Older version
VERSION=v2.0 pnpm build

Drop each output under a sibling path on the same origin (/, /v2.0/, /v1.0/).

starlight({
defaultLocale: 'zh',
locales: {
zh: { label: '简体中文', lang: 'zh-CN' },
en: { label: 'English' },
},
});

Sources live under src/content/docs/{zh,en}/.... Keep the two trees structurally parallel — the language switcher swaps locale segments by string match.

components: {
Banner: './src/components/Banner.astro',
Header: './src/components/Header.astro',
Search: './src/components/Search.astro',
Head: './src/components/Head.astro',
},
customCss: ['./src/styles/custom.css'],
  • Head.astro delegates to Starlight’s default Head, then appends JSON-LD, AI-discovery <link>s, and robots.
  • Header.astro adds the version dropdown and the search-shortcut hint.
  • custom.css overrides --sl-color-accent-* to the site’s ink-teal palette.
VariablePurposeDefault
VERSIONBuild version → base pathmain
BUILD_TIMEGenerated timestamp in /llms-full.txtmodule load time
SOURCE_DATE_EPOCHSame, but Unix seconds — useful for reproducible builds