chore: 调整代码执行细节

This commit is contained in:
ZiuChen
2024-04-02 14:24:17 +08:00
parent f0451e0a72
commit a89c4a8d31
5 changed files with 22 additions and 25 deletions

View File

@@ -0,0 +1,16 @@
import fs from 'fs'
import path from 'path'
/**
* 生成文章侧边栏
*/
export function indexArticleSidebar() {
const articles = fs.readdirSync(path.resolve(__dirname, '../../article'))
return articles
.filter((article) => article.endsWith('.md'))
.map((article) => ({
text: article.replace(/\.md$/, ''),
link: `/article/${article}`
}))
}