canonical-header
它能做什么
这项技能检查页面的 canonical 信号是否彼此一致。适合同时在 HTML 和 HTTP 标头中设置 canonical 地址的网站所有者和开发者。
适用场景
- ✓当页面同时发送 HTML canonical 标签和 Link 标头时。
- ✓当页面与服务器响应中的 canonical 信号不一致时。
- ✓当搜索中出现重复内容问题时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/canonical-header/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请比较我商品页面上的 canonical 标签和 Link 标头,并使两者保持一致。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会比较 HTML 中的 canonical 标签与 HTTP 的 Link 标头,并更新其中一个,使两者给出相同的 canonical 网址。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Sync HTML canonical tags and Link headers
Conflicting canonical-url signals can lead search engines to ignore both declarations, potentially causing duplicate content issues and incorrect indexing.
Quick Reference
- Ensure the
rel="canonical"tag in your HTML matches theLinkcanonical-url header if both are used - Avoid sending conflicting signals to search engines about the primary version of a page
- Maintain consistency across all methods of declaring your canonical URL
Check
Compare the HTML canonical tag with the HTTP Link header to ensure they point to the exact same URL.
Fix
Update either the HTML tag or the HTTP header so that they provide a consistent canonical URL signal.
Explain
Explain the risks of sending conflicting technical SEO signals to search engine crawlers.
Code Review
Review metadata generation, rendered HTML, structured data, and response headers related to Sync HTML canonical tags and Link headers. Flag exact routes or templates where search-facing output violates the rule, and describe how to verify the final page output.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/seo/canonical-header
常见问题
两者不一致会出什么问题?
这项技能说明,相互冲突的信号可能导致搜索引擎两者都忽略。
应该改哪一个?
两者都可以,只要最终的 canonical 网址在两处相同即可。
这能避免什么问题?
重复内容问题以及错误的收录。
详情
作者的原始描述
Use when auditing metadata, crawlability, structured data, or indexability related to Sync HTML canonical tags and Link headers. Verify the rendered HTML and HTTP response rather than relying only on source files.
热度
- GitHub 星标
- 75k
- 排名
- #2766
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。