fix id-first deep links for videoGpt1 seo
This commit is contained in:
@@ -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'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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 '';
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
{block name="description"}{site:seotkd code="description" page="play" /}{/block}
|
||||
|
||||
{block name="head"}
|
||||
<meta name="robots" content="index,follow">
|
||||
<meta name="robots" content="noindex,follow">
|
||||
|
||||
{if $Request.route.intVId }
|
||||
<link rel="canonical" href='https://{$DomainModel->d_domain}{site:vpurl v_id="$arrVideo.v_id" v_py="$arrVideo.v_name_en" play_type="default" play_index="1" /}'>
|
||||
<link rel="canonical" href='https://{$DomainModel->d_domain}{site:vurl v_id="$arrVideo.v_id" v_py="" /}'>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -214,4 +214,4 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/hls.js/dist/hls.min.js"></script>
|
||||
|
||||
{/block}
|
||||
{/block}
|
||||
|
||||
@@ -82,7 +82,9 @@ class VideoService
|
||||
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
||||
|
||||
if ($strTmpCode == 'videoGpt1') {
|
||||
return $this->SiteContext->UrlBuilder->detail($strPinYin, $intVId);
|
||||
// videoGpt1 runtime resolves detail data by v_id.
|
||||
// Use id-first urls to avoid stale slug drift creating dead deep links.
|
||||
return $this->SiteContext->UrlBuilder->detail('', $intVId);
|
||||
} else {
|
||||
$strKey = 'VIDEO_INFO_URL';
|
||||
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
||||
@@ -106,7 +108,7 @@ class VideoService
|
||||
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
||||
|
||||
if ($strTmpCode == 'videoGpt1') {
|
||||
return $this->SiteContext->UrlBuilder->detailForge($strPinYin, $intVId, $intVForgeId);
|
||||
return $this->SiteContext->UrlBuilder->detailForge('', $intVId, $intVForgeId);
|
||||
} else {
|
||||
$strKey = 'FORGE_VIDEO_INFO_URL';
|
||||
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
||||
@@ -132,7 +134,7 @@ class VideoService
|
||||
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
||||
|
||||
if ($strTmpCode == 'videoGpt1') {
|
||||
return $this->SiteContext->UrlBuilder->play($strPinYin, $intVId, $strPlayType, $intPlayIndex);
|
||||
return $this->SiteContext->UrlBuilder->play('', $intVId, $strPlayType, $intPlayIndex);
|
||||
} else {
|
||||
$strKey = 'VIDEO_PLAY_URL';
|
||||
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
||||
|
||||
@@ -189,8 +189,8 @@ EOF;
|
||||
$strAction = "";
|
||||
$arrArgs = [
|
||||
'intVId' => $Video->v_id,
|
||||
'strPinYin' => $Video->v_name_en,
|
||||
'strPinyin' => $Video->v_name_en,
|
||||
'strPinYin' => '',
|
||||
'strPinyin' => '',
|
||||
];
|
||||
|
||||
if ($arrUrlFamily && !empty($arrUrlFamily)) {
|
||||
|
||||
Reference in New Issue
Block a user