Site Config Reference
Site config defines the global settings of your VitePress site. These options apply regardless of the theme being used.Config File
The config file is resolved from<root>/.vitepress/config.[ext], where [ext] can be .js, .ts, .mjs, or .mts.
Site Metadata
title
string
default:"VitePress"
Title for the site. When using the default theme, this will be displayed in the nav bar and used as the default suffix for all page titles.Can be overridden per page via frontmatter.
titleTemplate
string | boolean
Allows customizing each page’s title suffix or the entire title. Use
:title as a placeholder for the page’s main title.Set to false to disable title suffixes completely.Can be overridden per page via frontmatter.description
string
default:"A VitePress site"
Description for the site. Renders as a
<meta> tag in the page HTML.Can be overridden per page via frontmatter.head
HeadConfig[]
default:"[]"
Additional elements to render in the
<head> tag. User-added tags are rendered before the closing head tag, after VitePress tags.Can be appended per page via frontmatter.- Favicon
- Google Fonts
- Analytics
lang
string
default:"en-US"
The lang attribute for the site. Renders as
<html lang="en-US"> in the page HTML.base
string
default:"/"
The base URL the site will be deployed at. Required if deploying your site under a sub path (e.g., GitHub Pages).Must always start and end with a slash. Automatically prepended to all URLs that start with
/.Routing
cleanUrls
boolean
default:"false"
When
true, VitePress removes trailing .html from URLs.rewrites
Record<string, string> | ((id: string) => string)
Defines custom directory ↔ URL mappings. Allows you to customize the structure of your URLs independently of your file structure.
Build
srcDir
string
default:"."
The directory where your markdown pages are stored, relative to project root.
srcExclude
string[]
A glob pattern for matching markdown files that should be excluded as source content.
outDir
string
default:"./.vitepress/dist"
The build output location for the site, relative to project root.
assetsDir
string
default:"assets"
Directory to nest generated assets under. The path should be inside
outDir and is resolved relative to it.cacheDir
string
default:"./.vitepress/cache"
The directory for cache files, relative to project root.
ignoreDeadLinks
boolean | 'localhostLinks' | (string | RegExp | ((link: string, source: string) => boolean))[]
default:"false"
When
true, VitePress will not fail builds due to dead links.When set to 'localhostLinks', the build will fail on dead links but won’t check localhost links.Can also be an array of exact URL strings, regex patterns, or custom filter functions.metaChunk
boolean
default:"false"
experimentalWhen
true, extract page metadata to a separate JavaScript chunk instead of inlining it in the initial HTML. Makes pages smaller and metadata cacheable.mpa
boolean
default:"false"
experimentalWhen
true, the production app will be built in MPA Mode, shipping 0kb JavaScript by default at the cost of disabling client-side navigation.buildConcurrency
number
default:"64"
experimentalConfigures the concurrency of the build. Lower numbers reduce memory usage but increase build time.
Theming
appearance
boolean | 'dark' | 'force-dark' | 'force-auto' | UseDarkOptions
default:"true"
Whether to enable dark mode (by adding the
.dark class to the <html> element).true: Default theme determined by user’s preferred color scheme'dark': Dark by default, user can togglefalse: No dark mode support'force-dark': Always dark, user cannot toggle'force-auto': Always follows system preference, user cannot toggle- Object: Pass VueUse
useDarkoptions (withinitialValuelimited to'dark' | undefined)
lastUpdated
boolean
default:"false"
Whether to get the last updated timestamp for each page using Git. The timestamp will be included in each page’s data and displayed by the default theme.
themeConfig
ThemeConfig
Theme-specific configuration options. For the default theme, see Theme Config Reference.
Customization
markdown
MarkdownOptions
Configure Markdown parser options. VitePress uses Markdown-it as the parser and Shiki for syntax highlighting.
vue
VuePluginOptions
Pass options to the internal
@vitejs/plugin-vue instance.vite
ViteConfig
Pass raw Vite config to the internal Vite dev server / bundler.
scrollOffset
number | string | string[] | { selector: string | string[]; padding: number }
default:"134"
Configure the scroll offset when the theme has a sticky header. Can be a number, selector element, or array of selectors with fallback.
contentProps
Record<string, any>
Props to pass to the content component.
router
{ prefetchLinks?: boolean }
Router configuration options.
prefetchLinks: Whether to prefetch links on hover (default:true)
locales
LocaleConfig<ThemeConfig>
Locale-specific configuration. Each locale can override any site-level option.
additionalConfig
AdditionalConfigDict | AdditionalConfigLoader
experimentalMulti-layer configuration overloading. Auto-resolves to
docs/.../config.{js,mjs,ts,mts} when unspecified. Set to {} to opt-out.Build Hooks
buildEnd
(siteConfig: SiteConfig) => Awaitable<void>
Build CLI hook that runs after build (SSG) finishes but before VitePress CLI process exits.
postRender
(context: SSGContext) => Awaitable<SSGContext | void>
Build hook called when SSG rendering is done. Allows you to handle teleports content during SSG.
transformHead
(context: TransformContext) => Awaitable<HeadConfig[]>
Build hook to transform the head before generating each page. Return extra entries that will be merged automatically.
transformHtml
(code: string, id: string, context: TransformContext) => Awaitable<string | void>
Build hook to transform the HTML content of each page before saving to disk.
transformPageData
(pageData: PageData, context: TransformPageContext) => Awaitable<Partial<PageData> | void>
Hook to transform the
pageData of each page. You can directly mutate pageData or return changed values which will be merged.sitemap
SitemapStreamOptions & { hostname: string; transformItems?: (items: SitemapItem[]) => Awaitable<SitemapItem[]> }
experimentalSitemap generation options. Requires
hostname to be set.shouldPreload
(link: string, page: string) => boolean
Function to determine which links should be preloaded.
useWebFonts
boolean
Use web fonts instead of emitting font files to dist. The theme should import a file named
fonts.(s)css for this to work.Default: true in webcontainers, false otherwise.