feat(news): 正文结构化 + 站内出口 + 实时阅读时长(Batch 2 内页证据密度)

Batch 2 的实现本体。补的是「内容」不是「语法」:`/news` 与 `/insights`
此前各只有 250 字左右的正文。

① 两篇公开正文 238/313 字 → 914/758 字,全部从既有真源派生(METHODOLOGY
   四阶段 / SERVICES 四组 / PRODUCTS 六款 / commitments.ts 响应承诺),
   **零新增客户案例、零新增效果数字**。
② 详情页正文由整块 `whitespace-pre-line` 改为小标题 + 段落
   (`parseArticleBlocks`,三条判据:单行 + ≤20 字 + 不以句末标点收尾 ——
   误判成标题比漏判更糟)。
③ 正文末尾新增站内公开入口(`NEWS_RELATED_LINKS`)。此前详情页是死胡同,
   只有「返回列表」与「预约咨询」。href 由单测**双向**反查:既命中
   PRODUCTS/SERVICES 常量,又要求文件系统里 page.tsx 真实存在。
④ 阅读时长由正文字数实时算出(450 字/分钟),不手写不落库。
⑤ `/insights` 卡片显式写出「收录于」哪个原生栏目。
   **不新增 `/insights/[slug]`** —— 聚合页只能读、不能拥有别的模型的实体,
   复制内容会造成 canonical 冲突。

判别性测试:`news-article.test.ts` 11 例 + `news-detail-content-v3.test.tsx` 4 例
(负对照:关掉解析器 ⇒ 3 条转红)+ e2e UJ-04/UJ-10 三条新断言
(负对照:注回整块渲染后 UJ-04 转红)。
This commit is contained in:
zhangxiang committed 2026-11-25 09:01:10 +08:00
1 parent 9c4dd576d5
commit 59e31c3f6e
12 files changed
+514 -18

No files matched your search

+14
View File
@@ -358,6 +358,20 @@ test.describe('UJ-04: 新闻读者浏览旅程(列表 → 详情 → 返回)
const detailText = await detailContent.textContent();
expect(detailText!.length).toBeGreaterThan(50);
// Batch 2(内页证据密度):正文有**结构**,不是一整坨 pre-line 文本。
// 判据取「≥2 个小标题」而不是硬编码标题文案 —— 改标题是编辑动作,不该让用例红;
// 把 parseArticleBlocks 退回整块渲染才会红(那时 h2 数为 0)。
const articleH2 = detailContent.locator('h2');
expect(await articleH2.count()).toBeGreaterThanOrEqual(2);
// 正文末尾的站内公开入口:此前详情页是死胡同(只有返回列表 + 预约咨询)。
const relatedLinks = page.getByTestId('news-related-links');
await expect(relatedLinks).toBeVisible();
expect(await relatedLinks.locator('a').count()).toBeGreaterThanOrEqual(3);
// 阅读时长由正文字数算出(不是手写标注)
await expect(page.getByTestId('news-reading-minutes')).toContainText('分钟');
// === Step 4: 通过面包屑返回新闻列表 ===
// news-detail-content-v3.tsx:68-71 恒渲染 breadcrumb nav 中的「新闻动态」链接
const breadcrumbNewsLink = page.locator('nav[aria-label="breadcrumb"] a[href="/news"]');