7.5 KiB
Baidu Indexing Frontend Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Correct the public indexing contract for www.scs8888.cn and make the homepage and free-article template expose useful SEO metadata without changing backend behavior.
Architecture: Static crawl directives and homepage semantics live in their existing files. CommonUtil.freeArticleHref remains the owner of the public free-article URL, while html/mianfei.html derives page metadata from the fetched article. A dependency-free Node regression script verifies the contract; deployment-only requirements are documented separately.
Tech Stack: Static HTML, browser JavaScript, XML, robots.txt, Node.js built-ins.
Global Constraints
- Do not modify backend APIs, databases, or production Nginx configuration.
- Keep all existing JavaScript data fetching and interaction behavior.
- Index only the homepage and public free articles.
- Public free-article URLs use
/mianfei/{id}.html. - Do not include paid, authentication, publishing, user, or finance pages in sitemap.
Task 1: Encode and test the indexing contract
Files:
- Create:
tmp/seo-indexing-test.js - Modify:
robots.txt - Modify:
sitemap.xml
Interfaces:
-
Consumes: public origin
https://www.scs8888.cn -
Produces: crawl directives and a homepage-only static sitemap
-
Step 1: Write the failing regression test
Create a Node script that reads robots.txt, sitemap.xml, html/index.html, html/mianfei.html, and utils/CommonUtil.js. Assert that the old origin is absent, the new sitemap URL and homepage URL exist, only the new origin appears in <loc>, private routes are absent from sitemap, homepage metadata/static copy exist, the article template exposes metadata hooks, and freeArticleHref owns /mianfei/{id}.html.
- Step 2: Run the test and verify RED
Run: node tmp/seo-indexing-test.js
Expected: FAIL because robots.txt and sitemap.xml still contain 3d.3dyjs.cn.
- Step 3: Implement the minimal crawl-file correction
Set the sitemap directive to:
Sitemap: https://www.scs8888.cn/sitemap.xml
Make sitemap.xml contain exactly the confirmed indexable static URL:
<url>
<loc>https://www.scs8888.cn/</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
Use /html/... paths in robots for the actual private frontend files, while also retaining root-form rules where the deployment rewrite may expose them.
- Step 4: Run the focused test
Run: node tmp/seo-indexing-test.js
Expected: crawl-file assertions pass; later homepage/article assertions remain RED until their tasks.
- Step 5: Commit
git add tmp/seo-indexing-test.js robots.txt sitemap.xml
git commit -m "fix: correct baidu crawl configuration"
Task 2: Add crawlable homepage semantics
Files:
- Modify:
html/index.html - Test:
tmp/seo-indexing-test.js
Interfaces:
-
Consumes: existing homepage dynamic renderers
-
Produces: useful initial HTML without changing dynamic containers
-
Step 1: Tighten the failing homepage assertions
Assert the homepage contains:
<meta name="description"
<link rel="canonical" href="https://www.scs8888.cn/"
<h1 class="seo-heading">神彩算彩票数据分析与免费预测文章</h1>
Also assert a static paragraph mentions开奖数据、走势分析和免费文章 without being inside an HTML comment.
- Step 2: Run the test and verify RED
Run: node tmp/seo-indexing-test.js
Expected: FAIL on missing homepage description/canonical/active H1.
- Step 3: Add minimal homepage metadata and copy
Add a unique description and canonical in <head>. Add a visually integrated SEO introduction near the existing hero content, including one active H1 and a short factual description. Do not duplicate dynamic article or draw data and do not add keyword stuffing.
- Step 4: Run verification
Run:
node tmp/seo-indexing-test.js
node tmp/topbar-navigation-mode-test.js
Expected: homepage assertions and existing navigation checks pass.
- Step 5: Commit
git add html/index.html tmp/seo-indexing-test.js
git commit -m "fix: add crawlable homepage metadata"
Task 3: Keep free-article metadata synchronized
Files:
- Modify:
html/mianfei.html - Test:
tmp/seo-indexing-test.js
Interfaces:
-
Consumes:
articleId,data.title, anddata.contentfrom the existing free-article detail request -
Produces:
updateArticleSeo(data)and a canonical URL athttps://www.scs8888.cn/mianfei/{id}.html -
Step 1: Add failing article metadata assertions
Assert the template contains default description and robots metadata, a canonical link with an ID, and an updateArticleSeo function called by renderArticle.
- Step 2: Run the test and verify RED
Run: node tmp/seo-indexing-test.js
Expected: FAIL because updateArticleSeo and article meta elements do not exist.
- Step 3: Implement article SEO synchronization
Add default <meta name="description">, <meta name="robots" content="index, follow">, and <link id="canonicalUrl" rel="canonical">. Implement helpers that convert article HTML to normalized plain text, truncate the description, set document.title to {article title} - 神彩算, update description, and set canonical to:
`https://www.scs8888.cn/mianfei/${encodeURIComponent(articleId)}.html`
Call the helper from the existing renderArticle(data) after setting the H1. Leave error handling and all article interactions unchanged.
- Step 4: Run verification
Run:
node tmp/seo-indexing-test.js
node tmp/cai-single-lottery-test.js
Expected: both scripts exit 0.
- Step 5: Commit
git add html/mianfei.html tmp/seo-indexing-test.js
git commit -m "fix: synchronize free article seo metadata"
Task 4: Document the deployment boundary and run final verification
Files:
- Create:
docs/baidu-indexing-deployment.md - Test:
tmp/seo-indexing-test.js
Interfaces:
-
Consumes: frontend public URL contract
-
Produces: an actionable handoff for the backend deployment owner
-
Step 1: Add a failing documentation assertion
Assert docs/baidu-indexing-deployment.md contains the public article rewrite, real 404 behavior, canonical host redirect, dynamic sitemap generation, Baiduspider access checks, and a clear statement that initial article-body rendering requires deployment/backend prerendering.
- Step 2: Run the test and verify RED
Run: node tmp/seo-indexing-test.js
Expected: FAIL because the deployment document does not exist.
- Step 3: Write the deployment handoff
Document requirements without inventing an unverified Nginx configuration: expected source URL, destination entry, 301 rules, 404 requirement, sitemap ownership/update triggers, response checks for normal and Baiduspider user agents, and Baidu Search Resource Platform submission steps.
- Step 4: Run all relevant verification
Run:
node tmp/seo-indexing-test.js
node tmp/topbar-navigation-mode-test.js
node tmp/cai-single-lottery-test.js
git diff --check
Expected: all Node scripts exit 0 and git diff --check reports no errors.
- Step 5: Commit
git add docs/baidu-indexing-deployment.md tmp/seo-indexing-test.js
git commit -m "docs: add baidu indexing deployment handoff"