mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-08-17 23:19:55 +08:00
fix: 侧栏生成规则
This commit is contained in:
parent
7294bbdd21
commit
bf9926dd6a
@ -4,11 +4,8 @@ import path from 'path'
|
|||||||
export default function generateSideBar() {
|
export default function generateSideBar() {
|
||||||
const articles = fs.readdirSync(path.resolve(__dirname, '../../article'))
|
const articles = fs.readdirSync(path.resolve(__dirname, '../../article'))
|
||||||
|
|
||||||
// 排除掉资源文件夹
|
|
||||||
const folders = ['assets']
|
|
||||||
|
|
||||||
const sidebar = articles
|
const sidebar = articles
|
||||||
.filter((article) => !folders.includes(article))
|
.filter((article) => article.endsWith('.md'))
|
||||||
.map((article) => {
|
.map((article) => {
|
||||||
// 移除后缀 `.md`
|
// 移除后缀 `.md`
|
||||||
const title = article.replace(/\.md$/, '')
|
const title = article.replace(/\.md$/, '')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user