Configuration

Config File

Without any configuration, the VuePress site is pretty minimal. To customize your site, let’s first create a .vuepress directory inside your docs directory. This is where all VuePress-specific files will be placed. Your project structure is probably like this:

  1. ├─ docs
  2. ├─ .vuepress
  3. └─ config.js
  4. └─ README.md
  5. ├─ .gitignore
  6. └─ package.json

The essential file for configuring a VuePress site is .vuepress/config.js, which should export a JavaScript object. If you are using TypeScript, you can use .vuepress/config.ts instead to get better types hint for VuePress Config.

  • JS
  • TS
  1. module.exports = {
  2. lang: 'en-US',
  3. title: 'Hello, VuePress!',
  4. description: 'This is my first VuePress site',
  5. themeConfig: {
  6. logo: 'https://vuejs.org/images/logo.png',
  7. },
  8. }
  1. import { defineUserConfig } from 'vuepress'
  2. import type { DefaultThemeOptions } from 'vuepress'
  3. export default defineUserConfig<DefaultThemeOptions>({
  4. lang: 'en-US',
  5. title: 'Hello VuePress',
  6. description: 'Just playing around',
  7. themeConfig: {
  8. logo: 'https://vuejs.org/images/logo.png',
  9. },
  10. })

TIP

We will refer the config object as VuePress Config.

Config Scopes

You may have noticed that there is a themeConfig option in VuePress Config.

Options outside themeConfig are Site Config, while options inside themeConfig are Theme Config.

Site Config

Site config means that, no matter what theme you are using, these configurations are always valid.

As we know, every site should have its own lang, title, description, etc. Thus, VuePress has built-in support for those options.

TIP

Check out the Config Reference for a full list of site config.

Theme Config

Theme config will be processed by VuePress theme, so it depends on the theme you are using.

If you don’t specify the theme option of VuePress Config, the default theme will be used.

TIP

Check out the Default Theme > Config Reference for theme config of default theme.