Skip to content

⚙️ Configuration

The VitePress config file is located at docs/.vitepress/config.ts.

Basic Config

ts
export default defineConfig({
  title: 'My Docs',
  description: 'A VitePress docs template',
  base: '/',
  lang: 'zh-CN',
  lastUpdated: true,
  cleanUrls: true,
})

i18n Config

ts
locales: {
  root: { label: 'Chinese', lang: 'zh-CN', link: '/' },
  en: { label: 'English', lang: 'en-US', link: '/en/' },
}

TIP

root is the default locale. link must be /. Other locales need their own link path.

ts
themeConfig: {
  nav: [
    { text: 'Guide', link: '/guide/getting-started' },
    { text: 'Dev', link: '/dev/basic' },
    {
      text: 'More',
      items: [
        { text: 'Changelog', link: 'https://github.com/...' },
      ],
    },
  ],
}
ts
themeConfig: {
  sidebar: {
    '/guide/': [
      {
        text: 'Getting Started',
        collapsed: false,
        items: [
          { text: 'Quick Start', link: '/guide/getting-started' },
          { text: 'Configuration', link: '/guide/configuration' },
        ],
      },
    ],
  },
}

Local search is enabled by default. Customize search text:

ts
search: {
  provider: 'local',
  options: {
    locales: {
      en: {
        translations: {
          button: { buttonText: 'Search' },
          modal: { noResultsText: 'No results found' },
        },
      },
    },
  },
}

Config Reference

OptionTypeDescription
titlestringSite title
descriptionstringSite description
basestringDeploy base path
langstringDefault language
lastUpdatedbooleanShow last updated time
cleanUrlsbooleanClean URLs (no .html)
headHeadConfig[]HTML head tags
localesLocalesi18n config
themeConfigThemeConfigTheme config

See VitePress Site Config for full reference.

最近更新

基于 VitePress + Teek 主题构建