fix id-first deep links for videoGpt1 seo

This commit is contained in:
root
2026-04-15 16:06:43 +08:00
parent 7ece23688f
commit bd073c6795
5 changed files with 15 additions and 16 deletions

View File

@@ -456,7 +456,7 @@ class DomainSpiderMdRunHelper
'detail',
'详情页',
(string)$row['v_name'],
self::absoluteUrl($host, $urlBuilder->detail((string)$row['v_name_en'], (int)$row['v_id'])),
self::absoluteUrl($host, $urlBuilder->detail('', (int)$row['v_id'])),
'detail'
);
@@ -488,7 +488,7 @@ class DomainSpiderMdRunHelper
'forge',
'详情泛链接',
$forgeKeyword,
self::absoluteUrl($host, $urlBuilder->detailForge((string)$row['v_name_en'], (int)$row['v_id'], $forgeId)),
self::absoluteUrl($host, $urlBuilder->detailForge('', (int)$row['v_id'], $forgeId)),
'detail_forge'
);
}

View File

@@ -1867,15 +1867,12 @@ class SiteStyle
*/
private static function guessDetailUrlFromVideo(array $arrVideo): string
{
$strSlug = (string)($arrVideo['v_name_en'] ?? $arrVideo['v_slug'] ?? $arrVideo['slug'] ?? '');
$intId = (int)($arrVideo['v_id'] ?? 0);
if (!empty($strSlug) && $intId > 0) {
// 你当前详情 URL 示例:/voddetail/qian-long-zai-tian-247979
return '/voddetail/' . $strSlug . '-' . $intId;
}
if ($intId > 0) {
return '/voddetail/' . $intId;
// Keep canonical stable on id-first path. Video pages resolve by v_id,
// while slug is only for presentation and may drift over time.
return '/voddetail/-' . $intId;
}
return '';
}