其他
生成 Schema.org JSON-LD 结构化数据…
当用户提到 schema markup、structured data、JSON-LD、rich snippets、rich results、FAQ schema、product schema、article schema、breadcrumb schema、organization schema、how-to schema、review schema 或 SEO 结构化数据时,为任意页面类型生成并校验 JSON-LD。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 48/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 85/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 54/100 ×0.15
适用场景
生成 Schema.org JSON-L通用
解决思路
- 支持的 schema 类型:Article/BlogPosting/NewsArticle、Product、FAQPage、HowTo、Organization、LocalBusiness、BreadcrumbList、Review/AggregateRating;根据页面内容判断适用哪几种。
- 生成流程第 1 步:确定页面类型;询问用户这是哪类页面,或根据上下文推断。
- 生成流程第 2 步:收集信息;向用户询问或收集必填字段;如果用户提供 URL,则抓取该 URL 提取数据。
- 生成流程第 3 步:选择 schema 类型;选择所有适用的 schema,大多数页面需要 2-4 种类型。
- 生成流程第 4 步:生成 JSON-LD;创建完整、有效的标记。
- 生成流程第 5 步:校验;按每种类型的 Google 要求逐项检查。
- 生成流程第 6 步:提供实现说明;明确告诉用户把代码放在哪里。
- 生成 Article/BlogPosting/NewsArticle JSON-LD:包含 @context=https://schema.org、@type=Article(BlogPosting 时改为 BlogPosting,NewsArticle 时改为 NewsArticle)、headline(最多 110 字符)、description(最多 160 字符)、image(提供 16:9、4:3、1:1 三种宽高比,每张宽度 >696px)、datePublished(ISO 8601)、dateModified、author 数组(Person 的 name、url、jobTitle、sameAs)、publisher(Organization 的 name、logo 为 ImageObject 且含 url、width、height)、mainEntityOfPage(WebPage 的 @id)、wordCount、articleSection、keywords、isAccessibleForFree;Google 要求 headline 必填且最多 110 字符、image 必填且提供 3 种宽高比且每张 >696px 宽、datePublished 必填且为 ISO 8601、author.name 必填;NewsArticle 适用时加 dateline。
- 生成 Product JSON-LD:包含 @context、@type=Product、name、description、image、sku、mpn、gtin13、brand(Brand.name)、offers(Offer 的 url、priceCurrency、price、priceValidUntil、availability、itemCondition、seller.Organization.name、shippingDetails、hasMerchantReturnPolicy)、aggregateRating(AggregateRating 的 ratingValue、bestRating、ratingCount)、review(Review 的 author.Person.name、datePublished、reviewBody、reviewRating.Rating.ratingValue/bestRating);offers.shippingDetails 为 OfferShippingDetails,含 shippingRate(MonetaryAmount 的 value、currency)、deliveryTime(ShippingDeliveryTime 的 handlingTime 和 transitTime 各为 QuantitativeValue 的 minValue、maxValue、unitCode=DAY)、shippingDestination(DefinedRegion 的 addressCountry);offers.hasMerchantReturnPolicy 为 MerchantReturnPolicy,含 applicableCountry、returnPolicyCategory、merchantReturnDays、returnMethod、returnFees;Google 要求 name 必填,offers、review、aggregateRating 至少一个,存在 offers 时 offers.price 和 offers.priceCurrency 必填,offers.availability 必须用 Schema.org 枚举值;2024 年起 merchant listings 推荐 shippingDetails 和 hasMerchantReturnPolicy。
- 生成 FAQPage JSON-LD:包含 @context、@type=FAQPage、mainEntity 数组,每项为 Question 的 name 和 acceptedAnswer(Answer.text);Google 要求每个 Question 必须恰好有一个 acceptedAnswer,Answer.text 可包含 HTML 标签 h2 到 h6、br、ol、ul、li、a、p、b、strong、i、em,内容必须在页面上可见(不能藏在 tabs/accordions 后而未正确实现),Google 每页最多显示 3 条 FAQ rich results,不得用于广告目的。
- 生成 HowTo JSON-LD:包含 @context、@type=HowTo、name、description、image(ImageObject 的 url、height、width)、totalTime、estimatedCost(MonetaryAmount 的 currency、value)、supply(HowToSupply 的 name)、tool(HowToTool 的 name)、step 数组,每个 HowToStep 含 name、text、url、image;Google 要求 name 必填,step 数组必填且至少一步,每步需要 text 或 itemListElement 加 HowToDirection/HowToTip,totalTime 用 ISO 8601 duration(如 PT1H30M),不要用 HowTo 写食谱(改用 Recipe schema)。
- 生成 Organization JSON-LD:包含 @context、@type=Organization、name、alternateName、url、logo(ImageObject 的 url、width、height)、description、foundingDate、founder(Person.name)、address(PostalAddress 的 streetAddress、addressLocality、addressRegion、postalCode、addressCountry)、contactPoint 数组(telephone、contactType、areaServed、availableLanguage)、sameAs 数组、numberOfEmployees(QuantitativeValue 的 minValue、maxValue)。
- 生成 LocalBusiness JSON-LD:包含 @context、@type=LocalBusiness、@id、name、description、url、telephone、email、image、logo、priceRange、address(PostalAddress 的 streetAddress、addressLocality、addressRegion、postalCode、addressCountry)、geo(GeoCoordinates 的 latitude、longitude)、openingHoursSpecification 数组(dayOfWeek、opens、closes)、aggregateRating(AggregateRating 的 ratingValue、bestRating、ratingCount)、areaServed(City.name)、hasMap;Google 要求 name、address 必填,尽量使用具体子类型如 Restaurant、Dentist、LegalService、RealEstateAgent,geo 坐标必须准确,openingHoursSpecification 必须反映实际营业时间。
- 生成 BreadcrumbList JSON-LD:包含 @context、@type=BreadcrumbList、itemListElement 数组,每项 ListItem 含 position、name、item;Google 要求 position 从 1 开始连续,最后一项不应有 item(当前页),且必须与页面可见面包屑一致。
- 生成 Review/AggregateRating JSON-LD:包含 @context、@type=Review、name、reviewBody、datePublished、author(Person.name)、itemReviewed(如 Product 的 name、image)、reviewRating(Rating 的 ratingValue、bestRating、worstRating)、publisher(Organization.name);Google 要求 author 必填且为有效 Person 或 Organization,itemReviewed 必填,reviewRating 推荐填写,自我评价(评价自己的产品)违反指南。
- 多 schema 页面:大多数页面需要多个 schema 类型,使用 @graph 组合;在 @graph 中为 Organization 设 @id,为 WebSite 设 @id 并用 publisher 指向 Organization 的 @id,为 WebPage 设 @id 并用 isPartOf 指向 WebSite 的 @id,Article 用 mainEntityOfPage 指向 WebPage 的 @id,并加入 BreadcrumbList 的 itemListElement。
- Next.js App Router 实现:在 page component 或 layout 中定义 const jsonLd = {/* generated schema */},返回 <> 内放置 <script type=application/ld+json dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} /> 和页面内容。
- Next.js Pages Router 实现:import Head from 'next/head'; 在组件中定义 const jsonLd = {/* generated schema */},在 <> 内放置 <Head><script type=application/ld+json dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} /></Head> 和页面内容。
- 纯 HTML 实现:在 <head> 内放置 <script type=application/ld+json>{/* generated schema */}</script>。
- 校验标记:使用 Google Rich Results Test(https://search.google.com/test/rich-results)和 Schema.org Validator(https://validator.schema.org/)。
- 常见错误-可见内容:不要为页面不可见内容添加 schema。
- 常见错误-自评:不要用 Review schema 做自己业务的自评。
- 常见错误-付费墙:不要将付费墙内容标记 isAccessibleForFree: true。
- 常见错误-假数据:不要在生产 schema 中使用假数据或占位符。
- 常见错误-AggregateRating:不要在没有实际用户评论时添加 AggregateRating。
- 常见错误-URL:始终使用绝对 URL,不要相对 URL。
- 常见错误-日期:始终使用 ISO 8601 日期格式。
- 常见错误-priceValidUntil:priceValidUntil 必须是未来日期。
- 常见错误-availability:availability 必须使用完整 Schema.org URL(如 https://schema.org/InStock)。
- 常见错误-图片:图片 URL 必须可抓取且可索引。
适用边界 · 注意事项
- 页面内容不可见、不可索引,或只是隐藏标签页/折叠面板且未正确实现时,不适合添加对应 schema。
- 做自我评价(Review 自己业务/自己的产品)时不要使用 Review schema。
- 内容位于付费墙后时,不要标记 isAccessibleForFree: true。