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
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
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
Description for the site. Renders as a
<meta> tag in the page HTML.Can be overridden per page via frontmatter.head
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
The lang attribute for the site. Renders as
<html lang="en-US"> in the page HTML.base
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
When
true, VitePress removes trailing .html from URLs.rewrites
Defines custom directory ↔ URL mappings. Allows you to customize the structure of your URLs independently of your file structure.
Build
srcDir
The directory where your markdown pages are stored, relative to project root.
srcExclude
A glob pattern for matching markdown files that should be excluded as source content.
outDir
The build output location for the site, relative to project root.
assetsDir
Directory to nest generated assets under. The path should be inside
outDir and is resolved relative to it.cacheDir
The directory for cache files, relative to project root.
ignoreDeadLinks
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
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
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
experimentalConfigures the concurrency of the build. Lower numbers reduce memory usage but increase build time.
Theming
appearance
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
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
Theme-specific configuration options. For the default theme, see Theme Config Reference.
Customization
markdown
Configure Markdown parser options. VitePress uses Markdown-it as the parser and Shiki for syntax highlighting.
vue
Pass options to the internal
@vitejs/plugin-vue instance.vite
Pass raw Vite config to the internal Vite dev server / bundler.
scrollOffset
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
Props to pass to the content component.
router
Router configuration options.
prefetchLinks: Whether to prefetch links on hover (default:true)
locales
Locale-specific configuration. Each locale can override any site-level option.
additionalConfig
experimentalMulti-layer configuration overloading. Auto-resolves to
docs/.../config.{js,mjs,ts,mts} when unspecified. Set to {} to opt-out.Build Hooks
buildEnd
Build CLI hook that runs after build (SSG) finishes but before VitePress CLI process exits.
postRender
Build hook called when SSG rendering is done. Allows you to handle teleports content during SSG.
transformHead
Build hook to transform the head before generating each page. Return extra entries that will be merged automatically.
transformHtml
Build hook to transform the HTML content of each page before saving to disk.
transformPageData
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
sitemap
SitemapStreamOptions & { hostname: string; transformItems?: (items: SitemapItem[]) => Awaitable<SitemapItem[]> }
experimentalSitemap generation options. Requires
hostname to be set.shouldPreload
Function to determine which links should be preloaded.
useWebFonts
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.