From 2228ac170f85ca151fdc7526edba3e7f4ca0e8d2 Mon Sep 17 00:00:00 2001 From: rain Date: Mon, 20 Jul 2026 10:55:20 +0800 Subject: [PATCH] fix: correct baidu crawl configuration --- robots.txt | 32 ++++++++++---- sitemap.xml | 12 +----- tmp/seo-indexing-test.js | 92 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 tmp/seo-indexing-test.js diff --git a/robots.txt b/robots.txt index 098cbf2..35105c8 100644 --- a/robots.txt +++ b/robots.txt @@ -1,26 +1,40 @@ -# 对所有搜索引擎生效 User-agent: * - -# 允许抓取网站所有公开页面 Allow: / -# 屏蔽登录/注册/用户中心页面 +# 登录、注册和用户中心 Disallow: /login.html Disallow: /reg.html Disallow: /repwd.html Disallow: /usercenter.html +Disallow: /html/login.html +Disallow: /html/reg.html +Disallow: /html/repwd.html +Disallow: /html/usercenter.html -# 屏蔽财务相关页面 +# 财务页面 Disallow: /chongzhi.html Disallow: /tixian.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: /zhuanjiashoucang.html Disallow: /wodefenxiao.html Disallow: /fenxiao.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://3d.3dyjs.cn/sitemap.xml \ No newline at end of file +Sitemap: https://www.scs8888.cn/sitemap.xml diff --git a/sitemap.xml b/sitemap.xml index 9ad7f2b..af7d8b9 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1,18 +1,8 @@ - https://3d.3dyjs.cn/ + https://www.scs8888.cn/ daily 1.0 - - https://3d.3dyjs.cn/zhuanjia.html - daily - 0.9 - - - https://3d.3dyjs.cn/kaijiang.html - daily - 0.8 - diff --git a/tmp/seo-indexing-test.js b/tmp/seo-indexing-test.js new file mode 100644 index 0000000..c573d6a --- /dev/null +++ b/tmp/seo-indexing-test.js @@ -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>/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(/神彩算彩票数据分析与免费预测文章'), + "homepage crawlable H1 missing", +); +assert( + index.includes("开奖数据、走势分析和免费文章"), + "homepage crawlable site description missing", +); + +assert(/ { + assert(deploymentDoc.includes(requiredText), `deployment handoff missing: ${requiredText}`); +}); + +console.log("SEO indexing checks passed");