mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-08-17 14:59:34 +08:00
17 lines
390 B
TypeScript
17 lines
390 B
TypeScript
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}`
|
|
}))
|
|
}
|