fix: 文档站子页面左侧目录不加载

docsify 进子目录路由会先请求 <目录>/_sidebar.md,失败(404)才回退根
目录;Cloudflare Pages 无 404.html 时对缺失路径 SPA 回退返回 index.html
且状态 200,docsify 把 HTML 当侧栏 Markdown 解析,左侧目录卡在加载中。
alias 将 docs/、examples/ 的 _sidebar.md 请求映射回根目录 _sidebar.md。
This commit is contained in:
snowy-yang committed 2026-09-24 21:51:40 +08:00
1 parent badf5b3571
commit e66148a75c
2 files changed
+6

No files matched your search

+5
View File
@@ -50,6 +50,11 @@
alias: {
'/examples': '/examples/README.md',
'/examples/': '/examples/README.md',
// 子目录页面的 _sidebar.md 请求映射到根目录的:
// docsify 会先请求 <当前目录>/_sidebar.md,而 Cloudflare Pages 对
// 缺失文件回退 index.html 且状态 200,docsify 误当作侧栏解析导致目录空白
'/docs/_sidebar.md': '/_sidebar.md',
'/examples/_sidebar.md': '/_sidebar.md',
},
plugins: [
// 把 ```mermaid 代码块替换为 div 后交给 mermaid 渲染(架构图/时序图)