meta-in-body
它能做什么
这项技能检查 meta 标签,例如 noindex、canonical、description 和 viewport,是否位于页面的 head 部分中。适用于希望搜索引擎和浏览器能读取这些标签的网页制作者。
适用场景
- ✓当你请智能体检查页面 HTML 结构中是否有放错位置的标签的时候。
- ✓当插件或脚本可能把 meta 标签加到了 body 中,而搜索指令似乎被忽略的时候。
- ✓当页面意外被收录或被移除,你需要确认其 meta 指令位于正确位置的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/meta-in-body/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我页面中的部分 meta 标签可能放错了位置。请帮我检查并修复。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会解析页面,查找位于 body 内或 head 结束之后的 meta 元素。然后它会把这些元素移到 head 中,或修改插入它们的脚本,使其指向 head。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Meta Tags in Body
Meta tags placed in the document body are ignored by search engines and most browsers—directives like noindex or canonical-url are silently ineffective, causing pages to be indexed or de-indexed unexpectedly.
Quick Reference
- All <meta> tags must appear inside <head>, never inside <body>
- Browsers may ignore or move misplaced meta tags, making them ineffective
- Crawlers like Googlebot only process meta tags found in <head>
- Validate with HTML validator or inspect parsed DOM to confirm placement
Check
Parse the HTML and check whether any <meta> elements appear outside <head>—i.e., inside <body> or after the </head> closing tag. Flag each misplaced tag by name/property.
Fix
Move all <meta> tags into the <head> section before </head>. If they are injected by a script after the DOM is built, refactor the injection to target document.head instead of document.body.
Explain
Meta tags are document-level metadata and must live in <head>. When placed in <body>, they fall outside the metadata model of the document—search engines and browsers do not honour them, so directives like noindex or canonical-url will have no effect.
Code Review
Parse the rendered HTML and check the DOM structure. Find all <meta> elements. For each one, traverse up the parent chain — if any ancestor is <body> or if the element appears after </head> in the source, flag it. Pay special attention to: meta name='robots', meta name='description', meta property='og:*', and link rel='canonical' placed in body.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/seo/meta-in-body
常见问题
放错位置的 meta 标签为什么重要?
搜索引擎和浏览器可能会忽略它们,因此 noindex 或 canonical 等指令将不起作用。
如果是脚本添加的标签怎么办?
这项技能建议修改脚本,把标签添加到文档的 head 中,而不是 body 中。
如何检查位置是否正确?
这项技能建议使用 HTML 验证器,或检查解析后的页面结构。
详情
作者的原始描述
Use when auditing HTML document structure. Applies to any page where meta tags (noindex, canonical-url, description, viewport, OG tags) may have been injected into the body by CMS plugins, widgets, or JavaScript rendering.
热度
- GitHub 星标
- 75k
- 排名
- #2935
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。