fix(seo): normalize GPT sitemap push URLs
This commit is contained in:
@@ -70,8 +70,8 @@ class BaiduPushVideoUrlLogic
|
||||
return ;
|
||||
}
|
||||
|
||||
$strApi = 'http://data.zz.baidu.com/urls?site=https://www.' . $domain . '&token=' . $strBaiduToken;
|
||||
// $strApi = 'http://data.zz.baidu.com/urls?site=https://www.aaggc.com&token=B4bzeDDBHhnoBnov';
|
||||
$strApi = 'http://data.zz.baidu.com/urls?site=https://' . $domain . '&token=' . $strBaiduToken;
|
||||
// $strApi = 'http://data.zz.baidu.com/urls?site=https://aaggc.com&token=B4bzeDDBHhnoBnov';
|
||||
|
||||
// 1️⃣ 读取 txt 文件
|
||||
$txtFiles = glob($domainDir . '/*.txt');
|
||||
|
||||
@@ -213,6 +213,7 @@ EOF;
|
||||
$strMapVideosFileTxt = sprintf('%s/sitemap-videos-%s.txt', $strDomainDir, $intPage);
|
||||
|
||||
file_put_contents($strMapVideosFile, $strHead);
|
||||
file_put_contents($strMapVideosFileTxt, '');
|
||||
|
||||
|
||||
# 取 intpage * limit ~ intpage * (limit+1) 写入以上文件
|
||||
@@ -238,7 +239,7 @@ EOF;
|
||||
} else {
|
||||
$strUri = $DomainModel->getFomartUrlEx($strKey, $strDomain, $strController, $strAction, $arrArgs);
|
||||
}
|
||||
$strUrl = sprintf("https://www.%s%s", $DomainModel->d_domain, $strUri);
|
||||
$strUrl = sprintf("https://%s%s", $DomainModel->d_domain, $strUri);
|
||||
$strPriority = '0.8';
|
||||
$strContent = sprintf($strTemplate, $strUrl, $strPriority);
|
||||
file_put_contents($strMapVideosFile, $strContent, FILE_APPEND);
|
||||
@@ -323,13 +324,13 @@ $arrUrlPool = [];
|
||||
} else {
|
||||
$strRankIndexUri = $DomainModel->getFomartUrlEx("VIDEO_RANK_INDEX_URL", $DomainModel->d_domain, "", "", []);
|
||||
}
|
||||
$strRankIndexUrl = sprintf("https://www.%s%s", $DomainModel->d_domain, $strRankIndexUri);
|
||||
$strRankIndexUrl = sprintf("https://%s%s", $DomainModel->d_domain, $strRankIndexUri);
|
||||
|
||||
$strContent = <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://www.{$DomainModel->d_domain}/</loc>
|
||||
<loc>https://{$DomainModel->d_domain}/</loc>
|
||||
<lastmod>{$this->strDate}</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>1.0</priority>
|
||||
@@ -344,7 +345,7 @@ EOF;
|
||||
|
||||
|
||||
//file_put_contents($strMapIndexFile, $strContent);
|
||||
$arrUrlPool["https://www.{$DomainModel->d_domain}/"] = [
|
||||
$arrUrlPool["https://{$DomainModel->d_domain}/"] = [
|
||||
'lastmod' => $this->strDate,
|
||||
'changefreq' => 'daily',
|
||||
'priority' => '1.0',
|
||||
@@ -371,7 +372,7 @@ EOF;
|
||||
$strUri = $DomainModel->getFomartUrlEx($strKey, $strDomain, $strController, $strAction, $arrArgs);
|
||||
}
|
||||
|
||||
$strUrl = sprintf("https://www.%s%s", $DomainModel->d_domain, $strUri);
|
||||
$strUrl = sprintf("https://%s%s", $DomainModel->d_domain, $strUri);
|
||||
|
||||
$strContent = <<<EOF
|
||||
<url>
|
||||
@@ -419,7 +420,7 @@ EOF;
|
||||
} else {
|
||||
$strUri = $DomainModel->getFomartUrlEx($strKey, $strDomain, $strController, $strAction, $arrArgs);
|
||||
}
|
||||
$strUrl = sprintf("https://www.%s%s", $DomainModel->d_domain, $strUri);
|
||||
$strUrl = sprintf("https://%s%s", $DomainModel->d_domain, $strUri);
|
||||
$strContent = <<<EOF
|
||||
<url>
|
||||
<loc>{$strUrl}</loc>
|
||||
@@ -464,7 +465,7 @@ EOF;
|
||||
$strUri = $DomainModel->getFomartUrlEx($strKey, $strDomain, $strController, $strAction, $arrArgs);
|
||||
}
|
||||
|
||||
$strUrl = sprintf("https://www.%s%s", $DomainModel->d_domain, $strUri);
|
||||
$strUrl = sprintf("https://%s%s", $DomainModel->d_domain, $strUri);
|
||||
|
||||
$strContent = <<<EOF
|
||||
<url>
|
||||
@@ -546,7 +547,7 @@ file_put_contents($strTxtFile, $strTxt);
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap>
|
||||
<loc>https://www.{$DomainModel->d_domain}/sitemap-main.xml</loc>
|
||||
<loc>https://{$DomainModel->d_domain}/sitemap-main.xml</loc>
|
||||
<lastmod>{$this->strDate}</lastmod>
|
||||
</sitemap>
|
||||
EOF;
|
||||
@@ -555,7 +556,7 @@ EOF;
|
||||
for ($intPage = 1; $intPage <= $intTotalPage; $intPage++) {
|
||||
$strContent = <<<EOF
|
||||
<sitemap>
|
||||
<loc>https://www.{$DomainModel->d_domain}/sitemap-videos-{$intPage}.xml</loc>
|
||||
<loc>https://{$DomainModel->d_domain}/sitemap-videos-{$intPage}.xml</loc>
|
||||
<lastmod>{$this->strDate}</lastmod>
|
||||
</sitemap>
|
||||
EOF;
|
||||
@@ -602,7 +603,7 @@ EOF;
|
||||
* {
|
||||
* "keyword": "...",
|
||||
* "site": "...",
|
||||
* "href": "https://www.xxx.com/...",
|
||||
* "href": "https://xxx.com/...",
|
||||
* "url": "#"
|
||||
* }
|
||||
* ]
|
||||
@@ -658,7 +659,7 @@ EOF;
|
||||
);
|
||||
}
|
||||
|
||||
$fullUrl = 'https://www.' . $DomainModel->d_domain . $strUri;
|
||||
$fullUrl = 'https://' . $DomainModel->d_domain . $strUri;
|
||||
|
||||
$row = [
|
||||
'keyword' => (string)$Video->v_name,
|
||||
|
||||
Reference in New Issue
Block a user