fix(site): 资源用绝对路径,根治相对路径导致样式丢失#73
Merged
Merged
Conversation
详情页/子路径页面若相对引用 styles.css/app.js,在某些情况下(如缓存旧
HTML、Cloudflare 把不存在路径回退成 200-HTML)会解析到 /skills/styles.css
等不存在的路径,返回 HTML 而非 CSS,叠加 X-Content-Type-Options: nosniff
被浏览器拒绝应用 → 整页无样式。
站点部署在域名根,改为绝对路径根治:styles.css / app.js / favicon /
brand svg / 扫码二维码 全部 ${base}X → /X,与页面层级/缓存无关、永远正确。
页面导航链接保持 ${base}(跨语言导航逻辑不变)。
验证:重建 42 页,详情页/EN 资源均为 / 绝对路径,无相对 CSS 引用;
CSP 126 内联脚本 0 缺失。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
详情页相对引用 CSS 在缓存/Cloudflare 回退场景会解析到不存在路径返回 HTML,叠加 nosniff 导致整页无样式。改绝对路径根治。