feat(seo): robots.txt 与 SEO 解封操作单(blog-5f T1)

robots 404 补齐(Allow 全站/Disallow admin+draft/Sitemap 行);
操作单三步走:nginx snippet 剥 noindex+内部 vhost 补回+admin 局部
保留、ESA purge+TTL+绕缓存、curl 三验证——用户侧执行入口。

验证: T1 verify 命令全过(robots 三断言+操作单节存在)

Spec: 2026-10-26_blog-5f

Co-authored-by: GLM-5.3
This commit is contained in:
wait4xandGLM-5.3 committed 2026-11-01 09:06:54 +08:00
1 parent 5d18591967
commit 22930cfffd
2 files changed
+34

No files matched your search

+25
View File
@@ -36,3 +36,28 @@ sudo bash infra/deploy/rollback.sh --exec # 秒级回 Halo
- 新文章工作流:本地或 gitea web 写 md → push main → webhook 自动构建发布
- 新照片:上传 content/photos/ 后跑 `python3 scripts/photos_ingest.py` 再 commit
- 翻译:新文章 push 后跑 `python3 scripts/translate/translate_posts.py`(幂等)
---
## SEO 解封操作单(Phase 5f T1,2026-10-26 立案)
**背景**:生产全站自上线起带 `X-Robots-Tag: noindex`(/etc/nginx/snippets/esa-origin-ssl.conf:11 共享片段误伤博客 vhost)+ robots.txt 404 + ESA 将带 noindex 的响应头缓存 30 天——搜索引擎全站不可见。
**第一步:nginx(需 sudo)**
1. 编辑 `/etc/nginx/snippets/esa-origin-ssl.conf`:删除第 11 行 `add_header X-Robots-Tag noindex always;`(改前备份 .bak)
2. 给确实需要 noindex 的内部服务 vhost(api/oj/token/fc/latex/cpa/git)各 server 块补回该行
3. 博客 vhost 补局部:`location /admin/ { add_header X-Robots-Tag noindex always; }`
4. `sudo nginx -t && sudo systemctl reload nginx`
**第二步:ESA 控制台(不做则 noindex 再活 30 天)**
1. 全站 purge `wait4x.online`
2. HTML 边缘 TTL 调 ≤1h(当前 2592000s,靠回源重验证更新——头会固化)
3. 加规则:`/artalk/api/*` 绕过缓存(GET stats 有 Age 头实锤,pv 数字会冻)
**第三步:验证**
```bash
curl -sI https://wait4x.online/ | grep -ci x-robots-tag # 期望 0
curl -s https://wait4x.online/robots.txt | head -3 # 期望 User-agent + Sitemap
curl -sI https://wait4x.online/admin/ | grep -ci noindex # 期望 1(局部保留)
```
仓库侧已就绪:public/robots.txt(本提交);生产 Lighthouse SEO≥95 复测随后入档。