Theme

VuePress theme can provide layouts, styles and many other features for you, helping you to focus on writing Markdown content.

VuePress has a default theme out of the box, which is applied to our documentation site you are currently browsing. The default theme provides basic but useful features for documentation site, you can check out Default Theme Config Reference for a full list of config.

However, you might think it is not good enough. Or, you want to build a different type of site, for example, a blog, instead of a documentation. Then, you can try to use a community theme or create a local theme.

Community Theme

Community users have created lots of theme and published them to NPMTheme - 图1open in new window. You should check the theme’s own documentation for detailed guide.

In general, you need to specify the name of the theme to use in theme option:

  1. module.exports = {
  2. theme: 'foo',
  3. }

You can use either theme name or its shorthand:

Theme NameShorthand
vuepress-theme-foofoo
@org/vuepress-theme-bar@org/bar
@vuepress/theme-default@vuepress/default

Local Theme

If you want to use your own custom theme but don’t want to publish it, you can create a local theme.

First, create the local theme directory, typically .vuepress/theme :

  1. └─ docs
  2. ├─ .vuepress
  3. ├─ theme
  4. └─ index.js
  5. └─ config.js
  6. └─ README.md

Then, set the absolute path of the theme directory to use it:

  1. module.exports = {
  2. theme: path.resolve(__dirname, './path/to/docs/.vuepress/theme'),
  3. }

Next, refer to Advanced > Writing a Theme for how to write your own theme.