fixing-metadata
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese1.0.1 license: MIT
1.0.1 许可证:MIT
Workflow
工作流程
- Identify pages with missing or incorrect metadata (titles, descriptions, canonical, OG tags)
- Audit against the priority rules below — fix critical issues (duplicates, indexing) first
- Ensure title, description, canonical, and og:url all agree with each other
- Verify social cards render correctly on a real URL, not localhost
- Keep diffs minimal and scoped to metadata only — do not refactor unrelated code
- 识别缺少元数据或元数据(标题、描述、规范URL、OG标签)存在错误的页面
- 根据以下优先级规则开展审计——优先修复关键问题(重复内容、索引设置)
- 确保标题、描述、规范URL和og:url保持一致
- 在真实URL而非本地环境(localhost)上验证社交卡片的渲染效果
- 尽量减少代码变更范围,仅聚焦于元数据修改——不要重构无关代码
when to apply
适用场景
Reference these guidelines when:
- adding or changing page titles, descriptions, canonical, robots
- implementing Open Graph or Twitter card metadata
- setting favicons, app icons, manifest, theme-color
- building shared SEO components or layout metadata defaults
- adding structured data (JSON-LD)
- changing locale, alternate languages, or canonical routing
- shipping new pages, marketing pages, or shareable links
在以下场景中参考本指南:
- 添加或修改页面标题、描述、规范URL、robots指令
- 实现Open Graph或Twitter卡片元数据
- 设置网站图标、应用图标、manifest文件、主题色
- 构建共享SEO组件或布局元数据默认配置
- 添加结构化数据(JSON-LD)
- 修改语言区域、备选语言或规范路由规则
- 上线新页面、营销页面或可分享链接
rule categories by priority
按优先级划分的规则类别
| priority | category | impact |
|---|---|---|
| 1 | correctness and duplication | critical |
| 2 | title and description | high |
| 3 | canonical and indexing | high |
| 4 | social cards | high |
| 5 | icons and manifest | medium |
| 6 | structured data | medium |
| 7 | locale and alternates | low-medium |
| 8 | tool boundaries | critical |
| 优先级 | 类别 | 影响程度 |
|---|---|---|
| 1 | 正确性与重复内容 | 关键 |
| 2 | 标题与描述 | 高 |
| 3 | 规范URL与索引设置 | 高 |
| 4 | 社交卡片 | 高 |
| 5 | 图标与manifest | 中等 |
| 6 | 结构化数据 | 中等 |
| 7 | 语言区域与备选页面 | 低-中等 |
| 8 | 工具边界 | 关键 |
quick reference
快速参考
1. correctness and duplication (critical)
1. 正确性与重复内容(关键)
- define metadata in one place per page, avoid competing systems
- do not emit duplicate title, description, canonical, or robots tags
- metadata must be deterministic, no random or unstable values
- escape and sanitize any user-generated or dynamic strings
- every page must have safe defaults for title and description
- 每个页面的元数据仅在一处定义,避免冲突的配置系统
- 不要生成重复的标题、描述、规范URL或robots标签
- 元数据必须是确定的,不能包含随机或不稳定的值
- 对任何用户生成或动态字符串进行转义和清理
- 每个页面必须为标题和描述设置安全的默认值
2. title and description (high)
2. 标题与描述(高)
- every page must have a title
- use a consistent title format across the site
- keep titles short and readable, avoid stuffing
- shareable or searchable pages should have a meta description
- descriptions must be plain text, no markdown or quote spam
- 每个页面必须设置标题
- 全站使用统一的标题格式
- 标题应简洁易读,避免关键词堆砌
- 可分享或可搜索的页面应设置元描述
- 描述必须为纯文本,不能包含markdown或垃圾引用内容
3. canonical and indexing (high)
3. 规范URL与索引设置(高)
- canonical must point to the preferred URL for the page
- use noindex only for private, duplicate, or non-public pages
- robots meta must match actual access intent
- previews or staging pages should be noindex by default when possible
- paginated pages must have correct canonical behavior
- 规范URL必须指向页面的首选访问地址
- 仅对私密、重复或非公开页面使用noindex指令
- robots元标签必须与实际的访问意图匹配
- 预览页面或 staging 页面应尽可能默认设置为noindex
- 分页页面必须配置正确的规范URL行为
4. social cards (high)
4. 社交卡片(高)
- shareable pages must set Open Graph title, description, and image
- Open Graph and Twitter images must use absolute URLs
- prefer correct image dimensions and stable aspect ratios
- og:url must match the canonical URL
- use a sensible og:type, usually website or article
- set twitter:card appropriately, summary_large_image by default
- 可分享页面必须设置Open Graph标题、描述和图片
- Open Graph和Twitter图片必须使用绝对URL
- 优先使用正确的图片尺寸和稳定的宽高比
- og:url必须与规范URL保持一致
- 设置合理的og:type,通常为website或article
- 适当设置twitter:card,默认优先使用summary_large_image
5. icons and manifest (medium)
5. 图标与manifest(中等)
- include at least one favicon that works across browsers
- include apple-touch-icon when relevant
- manifest must be valid and referenced when used
- set theme-color intentionally to avoid mismatched UI chrome
- icon paths should be stable and cacheable
- 至少包含一个可在各浏览器正常显示的网站图标
- 相关场景下添加apple-touch-icon
- 使用manifest文件时必须确保其有效且已正确引用
- 有意设置theme-color,避免与UI浏览器控件样式不匹配
- 图标路径应稳定且可被缓存
6. structured data (medium)
6. 结构化数据(中等)
- do not add JSON-LD unless it clearly maps to real page content
- JSON-LD must be valid and reflect what is actually rendered
- do not invent ratings, reviews, prices, or organization details
- prefer one structured data block per page unless required
- 除非与页面实际内容明确匹配,否则不要添加JSON-LD
- JSON-LD必须有效且与页面实际渲染内容一致
- 不要虚构评分、评论、价格或组织信息
- 除非有必要,否则每个页面仅保留一个结构化数据块
7. locale and alternates (low-medium)
7. 语言区域与备选页面(低-中等)
- set the html lang attribute correctly
- set og:locale when localization exists
- add hreflang alternates only when pages truly exist
- localized pages must canonicalize correctly per locale
- 正确设置html lang属性
- 存在本地化内容时设置og:locale
- 仅当对应页面真实存在时添加hreflang备选链接
- 本地化页面必须按语言区域正确配置规范URL
8. tool boundaries (critical)
8. 工具边界(关键)
- prefer minimal changes, do not refactor unrelated code
- do not migrate frameworks or SEO libraries unless requested
- follow the project's existing metadata pattern (Next.js metadata API, react-helmet, manual head, etc.)
- 优先进行最小化修改,不要重构无关代码
- 除非有明确要求,否则不要迁移框架或SEO库
- 遵循项目已有的元数据配置模式(如Next.js metadata API、react-helmet、手动配置head等)
review guidance
审核指南
- fix critical issues first (duplicates, canonical, indexing)
- ensure title, description, canonical, and og:url agree
- verify social cards on a real URL, not localhost
- prefer stable, boring metadata over clever or dynamic
- keep diffs minimal and scoped to metadata only
- 优先修复关键问题(重复内容、规范URL、索引设置)
- 确保标题、描述、规范URL和og:url保持一致
- 在真实URL而非本地环境(localhost)上验证社交卡片
- 优先选择稳定、常规的元数据配置,而非复杂的动态配置
- 尽量减少代码变更范围,仅聚焦于元数据修改