配置
所有配置都在 docs/.vitepress/config.mts 文件中。
站点标题与描述
ts
export default defineConfig({
title: '我的导航站',
description: '基于 VitePress 的 Markdown 导航站'
})顶部导航栏
ts
themeConfig: {
nav: [
{ text: '首页', link: '/' },
{ text: '指南', link: '/guide/getting-started' },
{ text: '参考', link: '/reference/markdown' }
]
}侧边栏
侧边栏按路径前缀分组,不同目录下的页面显示不同的侧边栏:
ts
sidebar: {
'/guide/': [
{
text: '指南',
items: [
{ text: '快速开始', link: '/guide/getting-started' },
{ text: '配置', link: '/guide/configuration' }
]
}
],
'/reference/': [
{
text: '参考',
items: [
{ text: 'Markdown 语法', link: '/reference/markdown' }
]
}
]
}本地搜索
ts
search: {
provider: 'local'
}无需任何外部服务,开箱即用。
社交链接
ts
socialLinks: [
{ icon: 'github', link: 'https://github.com/your-repo' }
]暗黑模式
VitePress 默认支持暗黑模式切换,无需额外配置。