Configuration

Config file setup, defineConfig helper, site metadata, and build options

VitePress configuration is defined in .vitepress/config.[js|ts|mjs|mts]. Use defineConfig for TypeScript intellisense.

Basic Config

// .vitepress/config.ts
import { defineConfig } from 'vitepress'

export default defineConfig({
  // Site metadata
  title: 'My Docs',
  description: 'Documentation site',
  lang: 'en-US',
  
  // URL base path (for GitHub Pages: '/repo-name/')
  base: '/',
  
  // Theme configuration
  themeConfig: {
    // See theme-config.md
  }
})

Site Metadata

Build Options

Route Rewrites

Map source paths to different output paths:

Appearance (Dark Mode)

Vite & Vue Configuration

Build Hooks

Dynamic Config

For async configuration:

Key Points

  • Config file supports .js, .ts, .mjs, .mts extensions

  • Use defineConfig for TypeScript support

  • base must start and end with / for sub-path deployments

  • srcDir separates source files from project root

  • Build hooks enable custom transformations and post-processing

Last updated

Was this helpful?