fix id-first deep links for videoGpt1 seo
This commit is contained in:
@@ -456,7 +456,7 @@ class DomainSpiderMdRunHelper
|
|||||||
'detail',
|
'detail',
|
||||||
'详情页',
|
'详情页',
|
||||||
(string)$row['v_name'],
|
(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'
|
'detail'
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ class DomainSpiderMdRunHelper
|
|||||||
'forge',
|
'forge',
|
||||||
'详情泛链接',
|
'详情泛链接',
|
||||||
$forgeKeyword,
|
$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'
|
'detail_forge'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1867,15 +1867,12 @@ class SiteStyle
|
|||||||
*/
|
*/
|
||||||
private static function guessDetailUrlFromVideo(array $arrVideo): string
|
private static function guessDetailUrlFromVideo(array $arrVideo): string
|
||||||
{
|
{
|
||||||
$strSlug = (string)($arrVideo['v_name_en'] ?? $arrVideo['v_slug'] ?? $arrVideo['slug'] ?? '');
|
|
||||||
$intId = (int)($arrVideo['v_id'] ?? 0);
|
$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) {
|
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 '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,10 @@
|
|||||||
{block name="description"}{site:seotkd code="description" page="play" /}{/block}
|
{block name="description"}{site:seotkd code="description" page="play" /}{/block}
|
||||||
|
|
||||||
{block name="head"}
|
{block name="head"}
|
||||||
<meta name="robots" content="index,follow">
|
<meta name="robots" content="noindex,follow">
|
||||||
|
|
||||||
{if $Request.route.intVId }
|
{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}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,9 @@ class VideoService
|
|||||||
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
||||||
|
|
||||||
if ($strTmpCode == 'videoGpt1') {
|
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 {
|
} else {
|
||||||
$strKey = 'VIDEO_INFO_URL';
|
$strKey = 'VIDEO_INFO_URL';
|
||||||
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
||||||
@@ -106,7 +108,7 @@ class VideoService
|
|||||||
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
||||||
|
|
||||||
if ($strTmpCode == 'videoGpt1') {
|
if ($strTmpCode == 'videoGpt1') {
|
||||||
return $this->SiteContext->UrlBuilder->detailForge($strPinYin, $intVId, $intVForgeId);
|
return $this->SiteContext->UrlBuilder->detailForge('', $intVId, $intVForgeId);
|
||||||
} else {
|
} else {
|
||||||
$strKey = 'FORGE_VIDEO_INFO_URL';
|
$strKey = 'FORGE_VIDEO_INFO_URL';
|
||||||
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
||||||
@@ -132,7 +134,7 @@ class VideoService
|
|||||||
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
$strTmpCode = $this->SiteContext->TemplatesModel['t_code'];
|
||||||
|
|
||||||
if ($strTmpCode == 'videoGpt1') {
|
if ($strTmpCode == 'videoGpt1') {
|
||||||
return $this->SiteContext->UrlBuilder->play($strPinYin, $intVId, $strPlayType, $intPlayIndex);
|
return $this->SiteContext->UrlBuilder->play('', $intVId, $strPlayType, $intPlayIndex);
|
||||||
} else {
|
} else {
|
||||||
$strKey = 'VIDEO_PLAY_URL';
|
$strKey = 'VIDEO_PLAY_URL';
|
||||||
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ EOF;
|
|||||||
$strAction = "";
|
$strAction = "";
|
||||||
$arrArgs = [
|
$arrArgs = [
|
||||||
'intVId' => $Video->v_id,
|
'intVId' => $Video->v_id,
|
||||||
'strPinYin' => $Video->v_name_en,
|
'strPinYin' => '',
|
||||||
'strPinyin' => $Video->v_name_en,
|
'strPinyin' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($arrUrlFamily && !empty($arrUrlFamily)) {
|
if ($arrUrlFamily && !empty($arrUrlFamily)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user