diff --git a/docs/.vitepress/scripts/generateSideBar.ts b/docs/.vitepress/scripts/generateSideBar.ts index 76a85920..9f1ff6dd 100644 --- a/docs/.vitepress/scripts/generateSideBar.ts +++ b/docs/.vitepress/scripts/generateSideBar.ts @@ -4,14 +4,19 @@ 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}` - } - }) + // 排除掉资源文件夹 + const folders = ['assets'] + + const sidebar = articles + .filter((article) => !folders.includes(article)) + .map((article) => { + // 移除后缀 `.md` + const title = article.replace(/\.md$/, '') + return { + text: title, + link: `/article/${title}` + } + }) return sidebar }