1.初始化项目
pnpm vitepress init
文件结构
.
├─ docs
│ ├─ .vitepress
│ │ └─ config.js
│ ├─ api-examples.md
│ ├─ markdown-examples.md
│ └─ index.md
└─ package.json
2.修改配置文件
// .vitepress/config.js
import { defineConfig } from 'vitepress'
export default defineConfig({
title: 'My Blog',
description: 'Just playing around',
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: 'Guide', link: '/guide/' },
{ text: 'External', link: 'https://google.com' }
],
sidebar: {
'/guide/': [
{
text: 'Guide', items: [
{ text: 'Index', link: '/guide/' },
{ text: 'Markdown Examples', link: '/guide/markdown-examples' },
{ text: 'API Examples', link: '/guide/api-examples' }
]
}
]
}
}
})
3.启动项目
pnpm docs:dev
4.打包项目
pnpm docs:build