修复产品目录卡片标题指向文章页 #7

Merged
DeepSeek merged 1 commits from fix/directory-card-links into main 2026-11-21 23:23:56 +08:00
Collaborator

目录页的产品卡片标题一直指向底层的文章记录,而不是卡片自己配置的网址。

修复前 /services 的四张卡片:

卡片标题 标题链接 主按钮链接
PAGEPAN 小飞页 /articles/service-1 ❌ /pagepan ✅
HighSpeaker DNS /articles/service-2 ❌ /highspeaker ✅
来笙软著代理 /articles/service-3 ❌ /sc ✅
SHNU 学生软著服务 /articles/service-4 ❌ /shnu-sc ✅

同一个卡片上,标题和按钮指向两个不同目标;标题那条是死路,落到一条只为目录卡片提供数据的空文章上。

改动

  • app/view/services.php:标题与主按钮统一使用卡片配置的 url,未配置时才回退到文章页。这与 /network 现有行为一致(network-groups.php 一直是 card.url ?: articlePath)。
  • 新增 tests/dircheck.php + tests/directory-links.sh:零依赖(bash + php + curl),断言 /services、/network 不再出现 /articles/<slug>,且标题与主按钮目标一致。
== 结果: 21 通过, 0 失败 ==

不在本 PR 范围

12 条目录记录(service-1..4、network-1..8)同时出现在 /articles 列表和 sitemap.xml 里,/articles/service-1 可直接访问且正文为空。这是「目录条目复用 articles 表」带来的结构问题,是否要从文章流与站点地图中排除属于产品决策,单独讨论。

目录页的产品卡片标题一直指向底层的文章记录,而不是卡片自己配置的网址。 修复前 `/services` 的四张卡片: | 卡片标题 | 标题链接 | 主按钮链接 | |---|---|---| | PAGEPAN 小飞页 | `/articles/service-1` ❌ | `/pagepan` ✅ | | HighSpeaker DNS | `/articles/service-2` ❌ | `/highspeaker` ✅ | | 来笙软著代理 | `/articles/service-3` ❌ | `/sc` ✅ | | SHNU 学生软著服务 | `/articles/service-4` ❌ | `/shnu-sc` ✅ | 同一个卡片上,标题和按钮指向两个不同目标;标题那条是死路,落到一条只为目录卡片提供数据的空文章上。 ## 改动 - `app/view/services.php`:标题与主按钮统一使用卡片配置的 `url`,未配置时才回退到文章页。这与 `/network` 现有行为一致(`network-groups.php` 一直是 `card.url ?: articlePath`)。 - 新增 `tests/dircheck.php` + `tests/directory-links.sh`:零依赖(bash + php + curl),断言 `/services`、`/network` 不再出现 `/articles/<slug>`,且标题与主按钮目标一致。 ``` == 结果: 21 通过, 0 失败 == ``` ## 不在本 PR 范围 12 条目录记录(`service-1..4`、`network-1..8`)同时出现在 `/articles` 列表和 `sitemap.xml` 里,`/articles/service-1` 可直接访问且正文为空。这是「目录条目复用 articles 表」带来的结构问题,是否要从文章流与站点地图中排除属于产品决策,单独讨论。
DeepSeek added 1 commit 2026-11-21 23:23:42 +08:00
The services directory built each card title from the backing article, so
/services linked to /articles/service-1..4 instead of the product pages the
card already carries (PAGEPAN, HighSpeaker, /sc, /shnu-sc). Only the primary
button used card.url, which made the title and the button disagree.

Use the card URL for both, keeping the article page as fallback for entries
without a configured URL, and add a dependency-free regression test.
DeepSeek merged commit 1a025353b2 into main 2026-11-21 23:23:56 +08:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: laysense/laysense.cn#7