fix: correct baidu crawl configuration
This commit is contained in:
+23
-9
@@ -1,26 +1,40 @@
|
|||||||
# 对所有搜索引擎生效
|
|
||||||
User-agent: *
|
User-agent: *
|
||||||
|
|
||||||
# 允许抓取网站所有公开页面
|
|
||||||
Allow: /
|
Allow: /
|
||||||
|
|
||||||
# 屏蔽登录/注册/用户中心页面
|
# 登录、注册和用户中心
|
||||||
Disallow: /login.html
|
Disallow: /login.html
|
||||||
Disallow: /reg.html
|
Disallow: /reg.html
|
||||||
Disallow: /repwd.html
|
Disallow: /repwd.html
|
||||||
Disallow: /usercenter.html
|
Disallow: /usercenter.html
|
||||||
|
Disallow: /html/login.html
|
||||||
|
Disallow: /html/reg.html
|
||||||
|
Disallow: /html/repwd.html
|
||||||
|
Disallow: /html/usercenter.html
|
||||||
|
|
||||||
# 屏蔽财务相关页面
|
# 财务页面
|
||||||
Disallow: /chongzhi.html
|
Disallow: /chongzhi.html
|
||||||
Disallow: /tixian.html
|
Disallow: /tixian.html
|
||||||
Disallow: /tixianlist.html
|
Disallow: /tixianlist.html
|
||||||
|
Disallow: /jine.html
|
||||||
|
Disallow: /html/chongzhi.html
|
||||||
|
Disallow: /html/tixian.html
|
||||||
|
Disallow: /html/tixianlist.html
|
||||||
|
Disallow: /html/jine.html
|
||||||
|
|
||||||
# 屏蔽收藏/分销/推广相关页面
|
# 用户收藏、分销、推广和发布页面
|
||||||
Disallow: /mianfeishoucang.html
|
Disallow: /mianfeishoucang.html
|
||||||
Disallow: /zhuanjiashoucang.html
|
|
||||||
Disallow: /wodefenxiao.html
|
Disallow: /wodefenxiao.html
|
||||||
Disallow: /fenxiao.html
|
Disallow: /fenxiao.html
|
||||||
Disallow: /tuiguang.html
|
Disallow: /tuiguang.html
|
||||||
|
Disallow: /fabumianfeiwenzhang.html
|
||||||
|
Disallow: /fufei.html
|
||||||
|
Disallow: /apply.html
|
||||||
|
Disallow: /html/mianfeishoucang.html
|
||||||
|
Disallow: /html/wodefenxiao.html
|
||||||
|
Disallow: /html/fenxiao.html
|
||||||
|
Disallow: /html/tuiguang.html
|
||||||
|
Disallow: /html/fabumianfeiwenzhang.html
|
||||||
|
Disallow: /html/fufei.html
|
||||||
|
Disallow: /html/apply.html
|
||||||
|
|
||||||
# 提交 sitemap,搜索引擎根据 sitemap 快速抓取
|
Sitemap: https://www.scs8888.cn/sitemap.xml
|
||||||
Sitemap: https://3d.3dyjs.cn/sitemap.xml
|
|
||||||
|
|||||||
+1
-11
@@ -1,18 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
<url>
|
<url>
|
||||||
<loc>https://3d.3dyjs.cn/</loc>
|
<loc>https://www.scs8888.cn/</loc>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
<priority>1.0</priority>
|
<priority>1.0</priority>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
|
||||||
<loc>https://3d.3dyjs.cn/zhuanjia.html</loc>
|
|
||||||
<changefreq>daily</changefreq>
|
|
||||||
<priority>0.9</priority>
|
|
||||||
</url>
|
|
||||||
<url>
|
|
||||||
<loc>https://3d.3dyjs.cn/kaijiang.html</loc>
|
|
||||||
<changefreq>daily</changefreq>
|
|
||||||
<priority>0.8</priority>
|
|
||||||
</url>
|
|
||||||
</urlset>
|
</urlset>
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
function read(path) {
|
||||||
|
return fs.readFileSync(path, "utf8");
|
||||||
|
}
|
||||||
|
|
||||||
|
function assert(condition, message) {
|
||||||
|
if (!condition) throw new Error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
const robots = read("robots.txt");
|
||||||
|
const sitemap = read("sitemap.xml");
|
||||||
|
const index = read("html/index.html");
|
||||||
|
const article = read("html/mianfei.html");
|
||||||
|
const commonUtil = read("utils/CommonUtil.js");
|
||||||
|
|
||||||
|
assert(!robots.includes("3d.3dyjs.cn"), "robots should not reference the old domain");
|
||||||
|
assert(!sitemap.includes("3d.3dyjs.cn"), "sitemap should not reference the old domain");
|
||||||
|
assert(
|
||||||
|
robots.includes("Sitemap: https://www.scs8888.cn/sitemap.xml"),
|
||||||
|
"robots should advertise the production sitemap",
|
||||||
|
);
|
||||||
|
|
||||||
|
const sitemapLocations = Array.from(sitemap.matchAll(/<loc>([^<]+)<\/loc>/g), (match) => match[1]);
|
||||||
|
assert(sitemapLocations.length === 1, "static sitemap should contain only the confirmed homepage");
|
||||||
|
assert(
|
||||||
|
sitemapLocations[0] === "https://www.scs8888.cn/",
|
||||||
|
"static sitemap homepage should use the canonical production origin",
|
||||||
|
);
|
||||||
|
|
||||||
|
[
|
||||||
|
"login",
|
||||||
|
"reg",
|
||||||
|
"usercenter",
|
||||||
|
"chongzhi",
|
||||||
|
"tixian",
|
||||||
|
"fabumianfeiwenzhang",
|
||||||
|
"fufei",
|
||||||
|
].forEach((privateRoute) => {
|
||||||
|
assert(!sitemap.includes(privateRoute), `private route must not appear in sitemap: ${privateRoute}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(/<meta\s+name="description"/i.test(index), "homepage description metadata missing");
|
||||||
|
assert(
|
||||||
|
/<link\s+rel="canonical"\s+href="https:\/\/www\.scs8888\.cn\/"/i.test(index),
|
||||||
|
"homepage canonical metadata missing",
|
||||||
|
);
|
||||||
|
assert(
|
||||||
|
index.includes('<h1 class="seo-heading">神彩算彩票数据分析与免费预测文章</h1>'),
|
||||||
|
"homepage crawlable H1 missing",
|
||||||
|
);
|
||||||
|
assert(
|
||||||
|
index.includes("开奖数据、走势分析和免费文章"),
|
||||||
|
"homepage crawlable site description missing",
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(/<meta\s+name="description"/i.test(article), "article default description metadata missing");
|
||||||
|
assert(
|
||||||
|
/<meta\s+name="robots"\s+content="index, follow"/i.test(article),
|
||||||
|
"article robots metadata missing",
|
||||||
|
);
|
||||||
|
assert(
|
||||||
|
/<link\s+id="canonicalUrl"\s+rel="canonical"/i.test(article),
|
||||||
|
"article canonical hook missing",
|
||||||
|
);
|
||||||
|
assert(article.includes("function updateArticleSeo(data)"), "article SEO updater missing");
|
||||||
|
assert(article.includes("updateArticleSeo(data);"), "article renderer should update SEO metadata");
|
||||||
|
assert(
|
||||||
|
article.includes("https://www.scs8888.cn/mianfei/"),
|
||||||
|
"article canonical should use the public pretty URL",
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(
|
||||||
|
/return `\/mianfei\/\$\{id\}\.html`/.test(commonUtil),
|
||||||
|
"CommonUtil.freeArticleHref should own the public article URL",
|
||||||
|
);
|
||||||
|
|
||||||
|
const deploymentDocPath = "docs/baidu-indexing-deployment.md";
|
||||||
|
assert(fs.existsSync(deploymentDocPath), "backend deployment handoff missing");
|
||||||
|
const deploymentDoc = read(deploymentDocPath);
|
||||||
|
[
|
||||||
|
"/mianfei/{id}.html",
|
||||||
|
"404",
|
||||||
|
"301",
|
||||||
|
"动态 sitemap",
|
||||||
|
"Baiduspider",
|
||||||
|
"预渲染",
|
||||||
|
].forEach((requiredText) => {
|
||||||
|
assert(deploymentDoc.includes(requiredText), `deployment handoff missing: ${requiredText}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("SEO indexing checks passed");
|
||||||
Reference in New Issue
Block a user