fix(website): favicon 路径与文档站链接两处 404

实测发现两个问题,均导致线上 404:

1. favicon 不生效
   favicon.svg 放在 website/public/,但 srcDir 是 ./pages,
   VitePress 的 public 目录相对 srcDir 解析,即应为 pages/public/。
   原位置不被打包,每个页面的 /www/favicon.svg 全部 404。
   → 移到 website/pages/public/favicon.svg

2. 「文档中心」导航链接 404
   DOCS_URL 默认 '/docs/',VitePress 会给站内链接自动加 base 前缀,
   实际渲染成 '/www/docs/',而网关没有这个路径(文档站在 /docs/)。
   → 默认值改为完整 URL,VitePress 判定为外链不做前缀拼接

验证(SITE_BASE=/www/ 与 / 两形态)
- 页面引用完整性:146 → 139 条,失效 15 → 0
- HTTP 实测(模拟 nginx alias + try_files):8 页 200、
  CSS/JS/favicon 200、/www 301、不存在页 404
This commit is contained in:
Dai0814
2026-11-04 12:33:08 +08:00
parent d78379486c
commit 9cd518227d
2 changed files with 8 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<rect width="64" height="64" rx="12" fill="#0f766e"/>
<path d="M20 18h24a4 4 0 0 1 4 4v20a4 4 0 0 1-4 4H20a4 4 0 0 1-4-4V22a4 4 0 0 1 4-4z" fill="none" stroke="#fff" stroke-width="3"/>
<path d="M24 28h16M24 36h10" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 344 B