mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-12-19 17:25:39 +08:00
docs: 文档更新
This commit is contained in:
17
docs/.vitepress/scripts/generateSideBar.ts
Normal file
17
docs/.vitepress/scripts/generateSideBar.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
export default function generateSideBar() {
|
||||
const articles = fs.readdirSync(path.resolve(__dirname, '../../article'))
|
||||
|
||||
const sidebar = articles.map((article) => {
|
||||
// 移除后缀 `.md`
|
||||
const title = article.replace(/\.md$/, '')
|
||||
return {
|
||||
text: title,
|
||||
link: `/article/${title}`
|
||||
}
|
||||
})
|
||||
|
||||
return sidebar
|
||||
}
|
||||
Reference in New Issue
Block a user