fix(seo): normalize GPT sitemap push URLs

This commit is contained in:
www
2026-05-09 11:09:00 +08:00
parent 04242363a8
commit b764e7555d
14 changed files with 713 additions and 30 deletions

View File

@@ -9,10 +9,10 @@ sort_type="news"
d_key="d_key" d_val="Video" cache_life="86400"}
<sitemap>
<loc>https://www.{$DomainModel->d_domain}{site:vurl v_id='$Video.v_id' v_py='$Video.v_name_en'/}</loc>
<loc>https://{$DomainModel->d_domain}{site:vurl v_id='$Video.v_id' v_py='$Video.v_name_en'/}</loc>
<lastmod>{$Video.v_publish_date}</lastmod>
</sitemap>
{/video:list}
</sitemapindex>
</sitemapindex>

View File

@@ -10,11 +10,11 @@ cache_life="3600" func="generateCategoryPager" export_name="resData" /}
{foreach $resData.data as $key=>$Novel}
<url>
<loc>https://www.{$DomainModel->d_domain}{site:nclurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" order="zheng" page="1"/}</loc>
<loc>https://{$DomainModel->d_domain}{site:nclurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" order="zheng" page="1"/}</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
{/foreach}
<!-- 最多 50,000 个 <url> 条目 -->
</urlset>
</urlset>

View File

@@ -10,11 +10,11 @@ cache_life="3600" func="generateCategoryPager" export_name="resData" /}
{foreach $resData.data as $key=>$Novel}
<url>
<loc>https://www.{$DomainModel->d_domain}{site:nurl n_id="$Novel->n_id" n_py="$Novel->n_name_pinyin"/}</loc>
<loc>https://{$DomainModel->d_domain}{site:nurl n_id="$Novel->n_id" n_py="$Novel->n_name_pinyin"/}</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
{/foreach}
</urlset>
</urlset>

View File

@@ -8,7 +8,7 @@ cache_life="3600" func="generateCategoryPager" export_name="resData" /}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{foreach $resData.data as $key=>$Novel}
<url>
<loc>https://www.{$DomainModel->d_domain}{site:lcpurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}</loc>
<loc>https://{$DomainModel->d_domain}{site:lcpurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.6</priority>

View File

@@ -1,14 +1,14 @@
<?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>{:date('Y-m-d')}</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.{$DomainModel->d_domain}{$strRankUrlTemp}</loc>
<loc>https://{$DomainModel->d_domain}{$strRankUrlTemp}</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
@@ -21,7 +21,7 @@
<!-- 状态 -->
{novel:status d_key="status_key" d_val="strStatusName"}
<url>
<loc>https://www.{$DomainModel->d_domain}{site:nflurl category="$strCategoryPinyin" order="$sort_key" status="$status_key" /}</loc>
<loc>https://{$DomainModel->d_domain}{site:nflurl category="$strCategoryPinyin" order="$sort_key" status="$status_key" /}</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
@@ -32,4 +32,4 @@
<!-- 注意 所有链接不要分页,有分页的取第一页即可 -->
</urlset>
</urlset>

View File

@@ -7,14 +7,14 @@ cache_life="3600" func="generateCategoryPager" export_name="resData" /}
<?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>{:date('Y-m-d')}</lastmod>
</sitemap>
<!--小说总数量/50000 得出 sitemap-books 一共有多少个 -->
{for start="0" end="$resData.p_data.pages"}
<sitemap>
<loc>https://www.{$DomainModel->d_domain}/sitemap-books-{$i+1}.xml</loc>
<loc>https://{$DomainModel->d_domain}/sitemap-books-{$i+1}.xml</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
</sitemap>
{/for}
@@ -22,7 +22,7 @@ cache_life="3600" func="generateCategoryPager" export_name="resData" /}
<!-- 小说总数量/50000 得出 sitemap-books-catalog一共有多少个,每个小说只取一个目录链接,分页不需要加入去 -->
{for start="0" end="$resData.p_data.pages"}
<sitemap>
<loc>https://www.{$DomainModel->d_domain}/sitemap-books-catalog-{$i+1}.xml</loc>
<loc>https://{$DomainModel->d_domain}/sitemap-books-catalog-{$i+1}.xml</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
</sitemap>
{/for}
@@ -30,10 +30,10 @@ cache_life="3600" func="generateCategoryPager" export_name="resData" /}
<!-- 小说章节取最新章节 -->
{for start="0" end="$resData.p_data.pages"}
<sitemap>
<loc>https://www.{$DomainModel->d_domain}/sitemap-chapters-{$i+1}.xml</loc>
<loc>https://{$DomainModel->d_domain}/sitemap-chapters-{$i+1}.xml</loc>
<lastmod>{:date('Y-m-d')}</lastmod>
</sitemap>
{/for}
</sitemapindex>
</sitemapindex>

View File

@@ -606,7 +606,7 @@ class SiteContext
continue;
}
$strLoc = 'https://www.' . $strHost . $strPath;
$strLoc = 'https://' . $strHost . $strPath;
$strLastmod = trim((string)($arrVideo['v_publish_date'] ?? ''));
if ($strLastmod === '') {
$strLastmod = trim((string)($arrVideo['updated_at'] ?? ''));

View File

@@ -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');

View File

@@ -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,