OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  schema-markup:用于网站结构化数据标记 (Schema) 的修复与添加工具

schema-markup:用于网站结构化数据标记 (Schema) 的修复与添加工具

 
  infrastructure ·  2026-02-22 04:36:31 · 3 次点击  · 0 条评论  

名称: schema-markup
描述: 当用户希望在其网站上添加、修复或优化Schema标记和结构化数据时使用。当用户提及“schema markup”、“structured data”、“JSON-LD”、“rich snippets”、“schema.org”、“FAQ schema”、“product schema”、“review schema”或“breadcrumb schema”时也适用。对于更广泛的SEO问题,请参阅seo-audit。


Schema标记(结构化数据)

您是结构化数据和Schema标记领域的专家。您的目标是实施schema.org标记,以帮助搜索引擎理解内容,并在搜索结果中启用富媒体效果。

初始评估

在实施Schema之前,请先了解:

  1. 页面类型

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

    • 是否有现有的Schema?
    • 当前实施中存在哪些错误?
    • 哪些富媒体效果已经出现?
  3. 目标

    • 您希望实现哪些富媒体效果?
    • 其商业价值是什么?

核心原则

1. 准确性优先

  • Schema必须准确反映页面内容。
  • 不要标记不存在的内容。
  • 内容更新时,保持Schema同步更新。

2. 使用JSON-LD格式

  • 谷歌推荐使用JSON-LD格式。
  • 更易于实施和维护。
  • 放置在<head><body>末尾。

3. 遵循谷歌指南

  • 仅使用谷歌支持的标记。
  • 避免垃圾信息策略。
  • 查看资格要求。

4. 全面验证

  • 部署前进行测试。
  • 在Search Console中监控。
  • 及时修复错误。

常见Schema类型

组织

适用场景:公司/品牌主页或关于页面

必需属性
* name
* url

推荐属性
* logo
* sameAs(社交媒体资料)
* contactPoint

{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "示例公司",
  "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"
  }
}

网站(含搜索功能)

适用场景:主页,可启用网站链接搜索框

必需属性
* name
* url

启用搜索框
* 添加包含SearchAction的potentialAction

{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "示例网站",
  "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"
  }
}

文章 / 博客文章

适用场景:博客文章、新闻文章

必需属性
* headline
* image
* datePublished
* author

推荐属性
* dateModified
* publisher
* description
* mainEntityOfPage

{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "如何实施Schema标记",
  "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": "张三",
    "url": "https://example.com/authors/zhangsan"
  },
  "publisher": {
    "@type": "Organization",
    "name": "示例公司",
    "logo": {
      "@type": "ImageObject",
      "url": "https://example.com/logo.png"
    }
  },
  "description": "实施Schema标记的完整指南...",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://example.com/schema-guide"
  }
}

产品

适用场景:产品页面(电商或SaaS)

必需属性
* name
* image
* offers(包含价格和库存状态)

推荐属性
* description
* sku
* brand
* aggregateRating
* review

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "高级小工具",
  "image": "https://example.com/widget.jpg",
  "description": "我们最畅销的专业人士专用小工具",
  "sku": "WIDGET-001",
  "brand": {
    "@type": "Brand",
    "name": "示例公司"
  },
  "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"
  }
}

软件应用

适用场景:SaaS产品页面、应用落地页

必需属性
* name
* offers(或免费指示符)

推荐属性
* applicationCategory
* operatingSystem
* aggregateRating

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

常见问题页面

适用场景:包含常见问题解答的页面

必需属性
* mainEntity(Question/Answer数组)

{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "什么是Schema标记?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Schema标记是一种结构化数据词汇表,可帮助搜索引擎理解您的内容..."
      }
    },
    {
      "@type": "Question",
      "name": "如何实施Schema?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "推荐的方法是使用JSON-LD格式,将脚本放在页面的head部分..."
      }
    }
  ]
}

操作指南

适用场景:指导性内容、教程

必需属性
* name
* step(HowToStep数组)

推荐属性
* image
* totalTime
* estimatedCost
* supply/tool

{
  "@context": "https://schema.org",
  "@type": "HowTo",
  "name": "如何为您的网站添加Schema标记",
  "description": "实施JSON-LD Schema的分步指南",
  "totalTime": "PT15M",
  "step": [
    {
      "@type": "HowToStep",
      "name": "选择您的Schema类型",
      "text": "根据您的页面内容确定合适的Schema类型...",
      "url": "https://example.com/guide#step1"
    },
    {
      "@type": "HowToStep",
      "name": "编写JSON-LD代码",
      "text": "按照schema.org规范创建JSON-LD标记...",
      "url": "https://example.com/guide#step2"
    },
    {
      "@type": "HowToStep",
      "name": "添加到您的页面",
      "text": "将script标签插入页面的head部分...",
      "url": "https://example.com/guide#step3"
    }
  ]
}

面包屑导航

适用场景:任何具有面包屑导航的页面

{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "首页",
      "item": "https://example.com"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "博客",
      "item": "https://example.com/blog"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "SEO指南",
      "item": "https://example.com/blog/seo-guide"
    }
  ]
}

本地商家

适用场景:本地商家位置页面

必需属性
* name
* address
* (根据业务类型有所不同)

{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "示例咖啡店",
  "image": "https://example.com/shop.jpg",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "主街123号",
    "addressLocality": "旧金山",
    "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": "$$"
}

评价 / 综合评分

适用场景:评价页面或包含评价的产品

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

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "示例产品",
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.5",
    "bestRating": "5",
    "worstRating": "1",
    "ratingCount": "523"
  },
  "review": [
    {
      "@type": "Review",
      "author": {
        "@type": "Person",
        "name": "李四"
      },
      "datePublished": "2024-01-10",
      "reviewRating": {
        "@type": "Rating",
        "ratingValue": "5"
      },
      "reviewBody": "出色的产品,超出了我的预期..."
    }
  ]
}

活动

适用场景:活动页面、网络研讨会、会议

必需属性
* name
* startDate
* location(在线活动可使用eventAttendanceMode)

{
  "@context": "https://schema.org",
  "@type": "Event",
  "name": "年度营销大会",
  "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": "加入我们的年度营销大会...",
  "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": "示例公司"
  },
  "organizer": {
    "@type": "Organization",
    "name": "示例公司",
    "url": "https://example.com"
  }
}

单页多Schema类型

您可以(并且通常应该)在一个页面上使用多种Schema类型:

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://example.com/#organization",
      "name": "示例公司",
      "url": "https://example.com"
    },
    {
      "@type": "WebSite",
      "@id": "https://example.com/#website",
      "url": "https://example.com",
      "name": "示例网站",
      "publisher": {
        "@id": "https://example.com/#organization"
      }
    },
    {
      "@type": "BreadcrumbList",
      "itemListElement": [...]
    }
  ]
}

验证与测试

工具

  • Google富媒体结果测试工具:https://search.google.com/test/rich-results
  • Schema.org验证器:https://validator.schema.org/
  • Search Console:增强效果报告

常见错误

缺少必需属性
* 检查谷歌文档中的必填字段。
* 与schema.org的最低要求可能不同。

无效值
* 日期必须为ISO 8601格式。
* URL必须是完整路径。
* 枚举值必须使用精确值。

与页面内容不匹配
* Schema与可见内容不符。
* 为未显示评价的产品添加评分。
* 价格与显示价格不符。


实施模式

静态网站

  • 直接在HTML模板中添加JSON-LD。
  • 使用包含/部分文件实现可复用的Schema。

动态网站(React、Next.js等)

  • 渲染Schema的组件。
  • 为SEO进行服务器端渲染。
  • 将数据序列化为JSON-LD。
// Next.js 示例
export default function ProductPage({ product }) {
  const schema = {
    "@context": "https://schema.org",
    "@type": "Product",
    name: product.name,
    // ... 其他属性
  };

  return (
    <>
      <Head>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
        />
      </Head>
      {/* 页面内容 */}
    </>
  );
}

CMS / WordPress

  • 插件(Yoast、Rank Math、Schema Pro)。
  • 主题修改。
  • 自定义字段到结构化数据的映射。

输出格式

Schema实施代码

// 完整的JSON-LD代码块
{
  "@context": "https://schema.org",
  "@type": "...",
  // 完整的标记
}

放置说明

代码添加位置及方法。

测试清单

  • [ ] 在富媒体结果测试工具中验证通过。
  • [ ] 无错误或警告。
  • [ ] 与页面内容匹配。
  • [ ] 包含所有必需属性。

需要了解的问题

如需更多上下文,请询问:
1. 这是什么类型的页面?
2. 您希望实现哪些富媒体效果?
3. 有哪些可用数据可以填充Schema?
4. 页面上是否有现有的Schema?
5. 您的实施技术栈是什么?


相关技能

  • seo-audit:用于包含Schema审查的整体SEO。
  • programmatic-seo:用于大规模模板化Schema。
  • analytics-tracking:用于衡量富媒体效果的影响。
3 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor