全局配置
ts
// .vitepress/config.mts
import { defineConfig } from 'vitepress'
import { getPosts } from '@theojs/solis/utils'
const posts = { posts: await getPosts(6) } //代表一页有6篇文章
export default defineConfig({
themeConfig: {
...posts,
nav: [
{ text: '主页', link: '/' },
{ text: '分类', link: '/pages/category' },
{ text: '归档', link: '/pages/archives' },
{ text: '标签', link: '/pages/tags' }
]
}
...
})
引入页面布局组件
ts
// .vitepress/theme/index.ts
import DefaultTheme from 'vitepress/theme'
import Solistheme, { Twikoo, Info } from '@theojs/solis'
export default {
extends: Solistheme,
Layout() {
return h(DefaultTheme.Layout, null, {
'doc-before': () => h(Info)
})
},
}
...