博客搭建
博客搭建
teek, vitepress
0 字 / 约 0 分钟
2025/3/7
博客搭建
TODO
- [x] 导航设置
- [x] 添加目录页
- [x] 默认折叠边栏
- [x] vuepress
imageCard转vitepressimgcar - [x] date改createTime
导航设置
- 新建
\.vitepress\CustomCfg\Nav.ts
js
// nav导航栏配置
export const Nav = [
{ text: '首页', link: "/" },
{ text: '博客', link: '/myvp'},
{ text: '版图', link: '/layout'},
{ text: 'EDA',
items: [
{ text: 'Cadence',
items: [
{ text: 'Virtuoso', link: '/virtuoso' },
{ text: 'Abstract', link: '/abstract'},
],
},
{ text: 'Siemens',
items: [
{ text: 'Calibre DRC', link: '/calibre-drc'},
{ text: 'Calibre LVS', link: '/calibre-lvs'},
],
},
{ text: 'Synophys ICC', link: '/synophysICC'},
{ text: 'Linux',
items: [
{ text: 'Find', link: '/linux-find', },
{ text: 'sed', link: '/linux-sed', },
{ text: 'awk', link: '/linux-awk' },
],
},
],
},
{ text: '编程',
items: [
{ text: 'skill', link: '/skill' },
{ text: 'svrf', link: '/svrf' },
{ text: 'tvf', link: '/tvf' },
{ text: 'tcl', link: '/tcl' },
{ text: 'shell', link: '/shell'},
{ text: 'python', link: '/python'},
],
},
{ text: '索引',
items: [
{ text: '分类', link: '/categories' },
{ text: '标签', link: '/tags' },
{ text: '归档', link: '/archives'},
{ text: '清单', link: '/articleOverview'},
],
},
{ text: '关于',
items: [
{ text: '关于我', link: '/about-me' },
{ text: '关于本站', link: '/about-website' },
],
},
]- 在
.vitepress\config.mts中引用Nav.ts
js
import { Nav } from "./CustomCfg/Nav"; - 在
.vitepress\config.mts中调用Nav删除原来的nav:后面[]中的所有内容,新加nav: Nav,
js
export default {
...
themeConfig: {
nav: Nav,
nav: [
{ text: 'Guide', link: '/guide' },
{ text: 'Config', link: '/config' },
{ text: 'Changelog', link: 'https://github.com/...' }
]
}
...
}添加目录页
WARNING
目录页数据来源于 vitepress-plugin-catalogue 插件实现,如果禁用了该插件,目录页将不会生效。
默认折叠边栏
在 .vitepress\config.mts , vitePlugins 中配置sidebarOption
js
vitePlugins: {
sidebar: true, // 是否启用 sidebar 插件
sidebarOption: {
// initItems: false, //这条命令注释后,才会让文档和目录的样式保持一致
collapsed: true, //打开侧边栏自动收缩功能
},
},vuepress imageCard 转vitepress imgcar
参考:vuepress 图片卡片转 vitepress(convert_imagecard)
date改createTime
所有数据经历了wordpress XML -- python --> md --> vuepress --> vitepress 从vitepress的目录copy到vitepress后,frontmatter在原有createTime的基础上加了一行date, 导致所有文章显示的创建时间是copy时间, 通过python脚本将 date值改的和 createTime 一致
参考:刷新 date 值为 createTime(fix-frontmatter-date)