diff --git a/scripts/build-perf/content-lint.mjs b/scripts/build-perf/content-lint.mjs index f13a2e8..54d1fdb 100644 --- a/scripts/build-perf/content-lint.mjs +++ b/scripts/build-perf/content-lint.mjs @@ -14,6 +14,8 @@ if (MODE === 'skip') { } const SKIP_PREFIX = ['/admin/', '/photos-originals/']; // admin=CMS 路由;photos-originals=部署期 rsync 叠加层(不在 dist,另有部署链保障) +// 已知不存在的 en 孪生目标(见 targetExists 内注释) +const KNOWN_MISSING_TWIN = new Set(['/en/heatmap-preview/']); const SKIP_FILE = new Set([ '/404.html', // Astro 404 页不参与配对 // 一次性预览路由(预览-选型-落地模式):只有 zh 版,配对检查豁免;选定后随路由一起删 @@ -43,6 +45,9 @@ function decodePath(p) { /** /x/ → dist/x/index.html;/a.svg → dist/a.svg;找不到即 null */ function targetExists(url) { if (SKIP_PREFIX.some((s) => url.startsWith(s))) return true; + // 一次性预览路由的 en 孪生:语言切换器会给预览页生成 /en/… 链接,而预览只有 zh 版 + // (页面本体已在 SKIP_FILE 豁免配对检查;此处豁免切换器链接,选定后随路由一起删) + if (KNOWN_MISSING_TWIN.has(url.split('#')[0].split('?')[0])) return true; const p = decodePath(url.split('#')[0].split('?')[0]); if (!p || p === '/') return existsSync(join(DIST, 'index.html')); if (p.endsWith('/')) return existsSync(join(DIST, p, 'index.html'));