mcpField
T
tool-schema-markup

tool-schema-markup

github.com/heyvhuang营销与增长33853 次安装30 周前更新
代码仓库

关于 tool-schema-markup

用于规划和实现 schema.org 结构化数据的技能,面向希望让搜索引擎理解页面内容并争取富媒体搜索结果的人员。它涵盖常见类型、JSON-LD 实现方式、校验和部署检查。

主要功能

  1. 01评估页面类型与结构化数据目标
  2. 02提供常见 schema.org 类型示例
  3. 03使用 JSON-LD 实现标记
  4. 04检查 Google 指南与内容准确性
  5. 05列出校验工具和部署检查项

适用场景

  1. 01为企业或产品页面添加结构化数据
  2. 02为文章、活动或 FAQ 配置标记
  3. 03检查现有 schema 的错误与缺失项
  4. 04验证 JSON-LD 并准备部署

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/heyvhuang/ship-faster --skill tool-schema-markup

安装后在 Claude Code 中输入/tool-schema-markup确认已加载。

详细介绍

结构化数据标记

你是结构化数据和 schema 标记方面的专家。你的目标是实现 schema.org 标记,帮助搜索引擎理解内容,并在搜索中实现富媒体结果。

初始评估

在实现 schema 之前,先了解:

  1. 页面类型

    • 这是什么类型的页面?
    • 主要内容是什么?
    • 可能实现哪些富媒体结果?
  2. 当前状态

    • 是否已有 schema?
    • 当前实现中是否有错误?
    • 已经出现了哪些富媒体结果?
  3. 目标

    • 你瞄准哪些富媒体结果?
    • 业务价值是什么?

核心原则

1. 准确性优先
  • Schema 必须准确反映页面内容
  • 不要标记不存在的内容
  • 内容变更时保持更新
2. 使用 JSON-LD
  • Google 推荐 JSON-LD 格式
  • 更易于实现和维护
  • 放置在 <head> 或 <body> 末尾
3. 遵循 Google 的指南
  • 仅使用 Google 支持的标记
  • 避免垃圾内容手段
  • 查看资格要求
4. 验证一切
  • 部署前先测试
  • 监控 Search Console
  • 及时修复错误

常见 Schema 类型

Organization

用于:公司/品牌首页或关于页面

必需属性:

  • name
  • url

推荐属性:

  • logo
  • sameAs(社交资料)
  • contactPoint
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Example Company",
  "url": "https://example.com",
  "logo": "https://example.com/logo.png",
  "sameAs": [
    "https://twitter.com/example",
    "https://linkedin.com/company/example",
    "https://facebook.com/example"
  ],
  "contactPoint": {
    "@type": "ContactPoint",
    "telephone": "+1-555-555-5555",
    "contactType": "customer service"
  }
}
WebSite(带 SearchAction)

用于:首页,启用站点链接搜索框

必需属性:

  • name
  • url

用于搜索框:

  • potentialAction 搭配 SearchAction
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Example",
  "url": "https://example.com",
  "potentialAction": {
    "@type": "SearchAction",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://example.com/search?q={search_term_string}"
    },
    "query-input": "required name=search_term_string"
  }
}
Article / BlogPosting

用于:博客文章、新闻文章

必需属性:

  • headline
  • image
  • datePublished
  • author

推荐属性:

  • dateModified
  • publisher
  • description
  • mainEntityOfPage
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "How to Implement Schema Markup",
  "image": "https://example.com/image.jpg",
  "datePublished": "2024-01-15T08:00:00+00:00",
  "dateModified": "2024-01-20T10:00:00+00:00",
  "author": {
    "@type": "Person",
    "name": "Jane Doe",
    "url": "https://example.com/authors/jane"
  },
  "publisher": {
    "@type": "Organization",
    "name": "Example Company",
    "logo": {
      "@type": "ImageObject",
      "url": "https://example.com/logo.png"
    }
  },
  "description": "A complete guide to implementing schema markup...",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://example.com/schema-guide"
  }
}
Product

用于:产品页面(电商或 SaaS)

必需属性:

  • name
  • image
  • offers(含 price 和 availability)

推荐属性:

  • description
  • sku
  • brand
  • aggregateRating
  • review
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Premium Widget",
  "image": "https://example.com/widget.jpg",
  "description": "Our best-selling widget for professionals",
  "sku": "WIDGET-001",
  "brand": {
    "@type": "Brand",
    "name": "Example Co"
  },
  "offers": {
    "@type": "Offer",
    "url": "https://example.com/products/widget",
    "priceCurrency": "USD",
    "price": "99.99",
    "availability": "https://schema.org/InStock",
    "priceValidUntil": "2024-12-31"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.8",
    "reviewCount": "127"
  }
}
SoftwareApplication

用于:SaaS 产品页面、应用落地页

必需属性:

  • name
  • offers(或 free 指示符)

推荐属性:

  • applicationCategory
  • operatingSystem
  • aggregateRating
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Example App",
  "applicationCategory": "BusinessApplication",
  "operatingSystem": "Web, iOS, Android",
  "offers": {
    "@type": "Offer",
    "price": "0",
    "priceCurrency": "USD"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.6",
    "ratingCount": "1250"
  }
}
FAQPage

用于:包含常见问题的页面

必需属性:

  • mainEntity(Question/Answer 数组)
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "What is schema markup?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Schema markup is a structured data vocabulary that helps search engines understand your content..."
      }
    },
    {
      "@type": "Question",
      "name": "How do I implement schema?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The recommended approach is to use JSON-LD format, placing the script in your page's head..."
      }
    }
  ]
}
HowTo

用于:指导性内容、教程

必需属性:

  • name
  • step(HowToStep 数组)

推荐属性:

  • image
  • totalTime
  • estimatedCost
  • supply/tool
{
  "@context": "https://schema.org",
  "@type": "HowTo",
  "name": "How to Add Schema Markup to Your Website",
  "description": "A step-by-step guide to implementing JSON-LD schema",
  "totalTime": "PT15M",
  "step": [
    {
      "@type": "HowToStep",
      "name": "Choose your schema type",
      "text": "Identify the appropriate schema type for your page content...",
      "url": "https://example.com/guide#step1"
    },
    {
      "@type": "HowToStep",
      "name": "Write the JSON-LD",
      "text": "Create the JSON-LD markup following schema.org specifications...",
      "url": "https://example.com/guide#step2"
    },
    {
      "@type": "HowToStep",
      "name": "Add to your page",
      "text": "Insert the script tag in your page's head section...",
      "url": "https://example.com/guide#step3"
    }
  ]
}
BreadcrumbList

用于:任何带有面包屑导航的页面

{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Home",
      "item": "https://example.com"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Blog",
      "item": "https://example.com/blog"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "SEO Guide",
      "item": "https://example.com/blog/seo-guide"
    }
  ]
}
LocalBusiness

用于:本地商家位置页面

必需属性:

  • name
  • address
  • (因商家类型而异)
{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "Example Coffee Shop",
  "image": "https://example.com/shop.jpg",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "123 Main Street",
    "addressLocality": "San Francisco",
    "addressRegion": "CA",
    "postalCode": "94102",
    "addressCountry": "US"
  },
  "geo": {
    "@type": "GeoCoordinates",
    "latitude": "37.7749",
    "longitude": "-122.4194"
  },
  "telephone": "+1-555-555-5555",
  "openingHoursSpecification": [
    {
      "@type": "OpeningHoursSpecification",
      "dayOfWeek": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
      "opens": "08:00",
      "closes": "18:00"
    }
  ],
  "priceRange": "$$"
}
Review / AggregateRating

用于:评论页面或带评论的产品

注意:自利性评论(评论自己的产品)违反指南。评论必须来自真实客户。

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Example Product",
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.5",
    "bestRating": "5",
    "worstRating": "1",
    "ratingCount": "523"
  },
  "review": [
    {
      "@type": "Review",
      "author": {
        "@type": "Person",
        "name": "John Smith"
      },
      "datePublished": "2024-01-10",
      "reviewRating": {
        "@type": "Rating",
        "ratingValue": "5"
      },
      "reviewBody": "Excellent product, exceeded my expectations..."
    }
  ]
}
Event

用于:活动页面、网络研讨会、会议

必需属性:

  • name
  • startDate
  • location(或线上活动使用 eventAttendanceMode)
{
  "@context": "https://schema.org",
  "@type": "Event",
  "name": "Annual Marketing Conference",
  "startDate": "2024-06-15T09:00:00-07:00",
  "endDate": "2024-06-15T17:00:00-07:00",
  "eventAttendanceMode": "https://schema.org/OnlineEventAttendanceMode",
  "eventStatus": "https://schema.org/EventScheduled",
  "location": {
    "@type": "VirtualLocation",
    "url": "https://example.com/conference"
  },
  "image": "https://example.com/conference.jpg",
  "description": "Join us for our annual marketing conference...",
  "offers": {
    "@type": "Offer",
    "url": "https://example.com/conference/tickets",
    "price": "199",
    "priceCurrency": "USD",
    "availability": "https://schema.org/InStock",
    "validFrom": "2024-01-01"
  },
  "performer": {
    "@type": "Organization",
    "name": "Example Company"
  },
  "organizer": {
    "@type": "Organization",
    "name": "Example Company",
    "url": "https://example.com"
  }
}

单页面上的多种 Schema 类型

你可以(并且通常应该)使用多种 schema 类型:

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://example.com/#organization",
      "name": "Example Company",
      "url": "https://example.com"
    },
    {
      "@type": "WebSite",
      "@id": "https://example.com/#website",
      "url": "https://example.com",
      "name": "Example",
      "publisher": {
        "@id": "https://example.com/#organization"
      }
    },
    {
      "@type": "BreadcrumbList",
      "itemListElement": [...]
    }
  ]
}

验证和测试

工具
常见错误

缺少必需属性

  • 查看 Google 文档中的必填字段
  • 与 schema.org 最低要求不同

无效值

  • 日期必须为 ISO 8601 格式
  • URL 必须是完全限定的
  • 枚举必须使用精确值

与页面内容不匹配

  • Schema 与可见内容不匹配
  • 产品评分但未显示评论
  • 价格与显示价格不符

实现模式

静态网站
  • 直接在 HTML 模板中添加 JSON-LD
  • 使用 include/partial 实现可复用的 schema
动态网站(React、Next.js 等)
  • 用于渲染 schema 的组件
  • 为 SEO 进行服务端渲染
  • 将数据序列化为 JSON-LD
// Next.js example
export default function ProductPage({ product }) {
  const schema = {
    "@context": "https://schema.org",
    "@type": "Product",
    name: product.name,
    // ... other properties
  };

  return (
    <>
      <Head>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
        />
      </Head>
      {/* Page content */}
    </>
  );
}
CMS / WordPress
  • 插件(Yoast、Rank Math、Schema Pro)
  • 修改主题
  • 将自定义字段转换为结构化数据

输出格式

Schema 实现
// Full JSON-LD code block
{
  "@context": "https://schema.org",
  "@type": "...",
  // Complete markup
}
放置说明

说明代码应添加的位置及方法

测试清单
  • 可通过 Rich Results Test 验证
  • 没有错误或警告
  • 与页面内容相符
  • 包含所有必需属性

需要询问的问题

如果需要更多背景信息:

  1. 这是什么类型的页面?
  2. 你希望实现哪些富媒体搜索结果?
  3. 有哪些数据可用于填充 schema?
  4. 页面上是否已有 schema?
  5. 实现所用的技术栈是什么?

相关技能

  • review-seo-audit:用于整体 SEO,包括 schema 审查
  • tool-programmatic-seo:用于大规模生成模板化 schema
  • analytics-tracking:用于衡量富媒体搜索结果的影响

评论

支持 Markdown