笔记相关配置
约 245 字小于 1 分钟
2025-09-12
添加导航栏入口和同级分类
为笔记添加导航栏入口
更新导航栏配置,修改
docs/.vuepress/navbar.ts
文件修改后的导航栏配置如下:
docs/.vuepress/navbar.tsexport default defineNavbarConfig([ { text: '首页', link: '/' }, { text: '博客', link: '/blog/' }, { text: '标签', link: '/blog/tags/' }, { text: '归档', link: '/blog/archives/' }, { text: '笔记', items: [ { text: '示例', link: '/demo/' }, { text: '博客搭建指北', link: '/blog_construct/' } ] }, ])
创建与demo同级的新笔记分类
创建新分类目录结构
在 docs/notes 目录下创建 new-category 目录
在该目录下创建 README.md 作为分类索引页
在该目录下创建 example-1.md 作为示例笔记
更新配置文件
修改
docs/.vuepress/notes.ts
文件,添加了新分类的配置将新分类配置添加到 notes 数组中,使其与demo分类同级显示
docs/.vuepress/notes.tsconst newCategoryNote = defineNoteConfig({ dir: 'new-category', link: '/new-category', sidebar: 'auto', }) export default defineNotesConfig({ dir: 'notes', link: '/', notes: [demoNote, newCategoryNote], // 两个分类同级显示 })