商品款式/规格结构化数据(ProductGroup
、Product
)
服装、鞋类、家具、电子设备和行李等许多类型的商品都有不同的款式/规格(例如各种尺寸、颜色、材质或图案)。为了帮助 Google 更好地了解哪些商品是同一父级商品的不同款式/规格,除了 Product
结构化数据之外,请使用 ProductGroup
类以及相关属性 variesBy
、hasVariant
和 productGroupID
将此类款式/规格组合在一起。
借助 ProductGroup
,您还可以为所有款式/规格指定通用产品属性(例如品牌和评价信息)以及款式/规格确定属性,从而减少信息重复。
如何添加结构化数据
结构化数据是一种提供网页相关信息并对网页内容进行分类的标准化格式。如果您不熟悉结构化数据,可以详细了解结构化数据的运作方式。
下面概述了如何构建、测试和发布结构化数据。如需获得向网页添加结构化数据的分步指南,请查看结构化数据 Codelab。
- 添加必要属性。根据您使用的格式,了解在网页上的什么位置插入结构化数据。
- 遵循指南。
- 使用富媒体搜索结果测试验证您的代码,并修复所有严重错误。此外,您还可以考虑修正该工具中可能会标记的任何非严重问题,因为这些这样有助于提升结构化数据的质量(不过,要使内容能够显示为富媒体搜索结果,并非必须这么做)。
- 部署一些包含您的结构化数据的网页,然后使用网址检查工具测试 Google 看到的网页样貌。请确保您的网页可供 Google 访问,不会因 robots.txt 文件、
noindex
标记或登录要求而被屏蔽。如果网页看起来没有问题,您可以请求 Google 重新抓取您的网址。 - 为了让 Google 随时了解日后发生的更改,我们建议您提交站点地图。Search Console Sitemap API 可以帮助您自动执行此操作。
示例
一般来说,电子商务网站主要使用两种设计方法设计商品款式/规格。本部分介绍了如何根据您网站的设计方法设置商品款式/规格标记:
单页网站
此单页网站示例假设网站满足以下条件:
- 如果未选择款式/规格,以下网址会返回主商品页面:
https://www.example.com/coat
- 系统会通过以下网址返回包含预先选择的特定款式/规格的同一网页:
https://www.example.com/coat?size=small&color=green
https://www.example.com/coat?size=small&color=lightblue
https://www.example.com/coat?size=large&color=lightblue
- 当用户在网页上选择不同的款式/规格(使用颜色和尺寸下拉菜单)时,网页上的图片、价格和库存状况信息会动态变化,而无需重新加载网页。网页上的标记不会随着用户选择不同的款式/规格而动态变化。
单页示例:款式/规格嵌套在 ProductGroup
下
在此示例中,款式/规格使用 hasVariant
属性嵌套在顶级 ProductGroup
实体下:
ProductGroup
和三个Offer
实体(在Product
属性下)都有不同的网址。或者,也可以在Product
下提供这些网址。- 通用标题和说明在
ProductGroup
级别指定。 款式/规格专用的标题和说明在Product
级别指定。 - 其他常见的款式/规格属性(如品牌、图案、材质和受众群体信息)也在
ProductGroup
级别指定。 ProductGroup
使用variesBy
属性指定款式/规格识别属性。ProductGroup
使用productGroupID
指定父 SKU(无需使用inProductGroupWithID
在Product
属性下重复)。
我们推荐这种方法,因为它是商品组及其款式/规格的最紧凑和自然的表示形式。
<html> <head> <title>Wool winter coat</title> <script type="application/ld+json"> [ { "@context": "https://schema.org/", "@type": "ProductGroup", "name": "Wool winter coat", "description": "Wool coat, new for the coming winter season", "url": "https://www.example.com/coat", "brand": { "@type": "Brand", "name": "Good brand" }, "audience": { "@type": "PeopleAudience", "suggestedGender": "unisex", "suggestedAge": { "@type": "QuantitativeValue", "minValue": 13, "unitCode": "ANN" } }, "productGroupID": "44E01", "pattern": "striped", "material": "wool", "variesBy": [ "https://schema.org/size", "https://schema.org/color" ], "hasVariant": [ { "@type": "Product", "sku": "44E01-M11000", "gtin14": "98766051104214", "image": "https://www.example.com/coat_small_green.jpg", "name": "Small green coat", "description": "Small wool green coat for the winter season", "color": "Green", "size": "small", "offers": { "@type": "Offer", "url": "https://www.example.com/coat?size=small&color=green", "priceCurrency": "USD", "price": 39.99, "itemCondition": "https://schema.org/NewCondition", "availability": "https://schema.org/InStock", "shippingDetails": { "@id": "#shipping_policy" }, "hasMerchantReturnPolicy": { "@id": "#return_policy" } } }, { "@type": "Product", "sku": "44E01-K11000", "gtin14": "98766051104207", "image": "https://www.example.com/coat_small_lightblue.jpg", "name": "Small light blue coat", "description": "Small wool light blue coat for the winter season", "color": "light blue", "size": "small", "offers": { "@type": "Offer", "url": "https://www.example.com/coat?size=small&color=lightblue", "priceCurrency": "USD", "price": 39.99, "itemCondition": "https://schema.org/NewCondition", "availability": "https://schema.org/InStock", "shippingDetails": { "@id": "#shipping_policy" }, "hasMerchantReturnPolicy": { "@id": "#return_policy" } } }, { "@type": "Product", "sku": "44E01-X1100000", "gtin14": "98766051104399", "image": "https://www.example.com/coat_large_lightblue.jpg", "name": "Large light blue coat", "description": "Large wool light blue coat for the winter season", "color": "light blue", "size": "large", "offers": { "@type": "Offer", "url": "https://www.example.com/coat?size=large&color=lightblue", "priceCurrency": "USD", "price": 49.99, "itemCondition": "https://schema.org/NewCondition", "availability": "https://schema.org/BackOrder", "shippingDetails": { "@id": "#shipping_policy" }, "hasMerchantReturnPolicy": { "@id": "#return_policy" } } } ] }, { "@context": "https://schema.org/", "@type": "OfferShippingDetails", "@id": "#shipping_policy", "shippingRate": { "@type": "MonetaryAmount", "value": 2.99, "currency": "USD" }, "shippingDestination": { "@type": "DefinedRegion", "addressCountry": "US" }, "deliveryTime": { "@type": "ShippingDeliveryTime", "handlingTime": { "@type": "QuantitativeValue", "minValue": 0, "maxValue": 1, "unitCode": "DAY" }, "transitTime": { "@type": "QuantitativeValue", "minValue": 1, "maxValue": 5, "unitCode": "DAY" } } }, { "@context": "http://schema.org/", "@type": "MerchantReturnPolicy", "@id": "#return_policy", "applicableCountry": "US", "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow", "merchantReturnDays": 60, "returnMethod": "https://schema.org/ReturnByMail", "returnFees": "https://schema.org/FreeReturn" } ] </script> </head> <body> </body> </html>
单页示例:款式/规格与 ProductGroup
分离
此结构与上一个示例类似,不同之处在于,款式/规格是与 ProductGroup
分开定义的(未嵌套)。对某些内容管理系统 (CMS) 而言,此方法可能更容易生成。
<html> <head> <title>Wool winter coat</title> <script type="application/ld+json"> [ { "@context": "https://schema.org", "@type": "ProductGroup", "@id": "#coat_parent", "name": "Wool winter coat", "description": "Wool coat, new for the coming winter season", "url": "https://www.example.com/coat", ... // Other ProductGroup-level properties "brand": { "@type": "Brand", "name": "Good brand" }, "productGroupID": "44E01", "variesBy": [ "https://schema.org/size", "https://schema.org/color" ] }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "name": "Small green coat", "description": "Small wool green coat for the winter season", ... // Other Product-level properties "offers": { "@type": "Offer", "url": "https://www.example.com/coat?size=small&color=green", "price": 39.99 ... // Other offer-level properties } }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "name": "Small dark blue coat", "description": "Small wool light blue coat for the winter season", ... // Other Product-level properties "offers": { "@type": "Offer", "url": "https://www.example.com/coat?size=small&color=lightblue", "price": 39.99 ... // Other offer-level properties } }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "name": "Large dark blue coat", "description": "Large wool light blue coat for the winter season", ... // Other Product-level properties "offers": { "@type": "Offer", "url": "https://www.example.com/coat?size=large&color=lightblue", "price": 49.99 ... // Other offer-level properties } } ] </script> </head> <body> </body> </html>
多页网站
此多页网站标记示例假设网站满足以下条件:
- 浅蓝色款式/规格可在以下网址找到(分别适用于小码和大码):
https://www.example.com/coat/lightblue?size=small
https://www.example.com/coat/lightblue?size=large
- 绿色款式/规格只能在
https://www.example.com/coat/green?size=small
(小码)下找到。 - 这两个页面都允许通过界面中的颜色选择器“跳到”另一个页面(即页面会重新加载)。
- 该网站将单页示例中的等效标记拆分到两个网页中。
请注意,没有只在一个页面上存在的另一个页面会引用的 ProductGroup
定义。这是因为 ProductGroup
需要引用款式/规格的通用属性,如品牌、材质和年龄段。这也意味着,需要在每个款式/规格网页上重复完整的 ProductGroup
定义。
多页示例:款式/规格嵌套在 ProductGroup
下
这相当于第一个单页示例,其中款式/规格 Product
属性使用 hasVariant
属性嵌套在顶级 ProductGroup
下。两个页面上的 ProductGroup
定义是重复的。请注意以下几点:
ProductGroup
没有规范网址,因为不存在代表ProductGroup
的单个网址。- 每个网页上的
ProductGroup
都有相应页面上款式/规格的完整定义,以及一个仅具有url
属性的款式/规格可以关联到另一个网页上的款式/规格,这有助于 Google 找出您的款式/规格。
第 1 页:浅蓝色款式/规格
以下示例在第一页显示了针对浅蓝色款式/规格的结构化数据:
<html> <head> <title>Wool winter coat, light blue color</title> <script type="application/ld+json"> [ { "@context": "https://schema.org/", "@type": "ProductGroup", "name": "Wool winter coat", "description": "Wool coat, new for the coming winter season", ... // Other ProductGroup-level properties "brand": { "@type": "Brand", "name": "Good brand" }, "productGroupID": "44E01", "variesBy": [ "https://schema.org/size", "https://schema.org/color" ], "hasVariant": [ { "@type": "Product", "name": "Small light blue coat", "description": "Small wool light blue coat for the winter season", ... // Other Product-level properties "offers": { "@type": "Offer", "url": "https://www.example.com/coat/lightblue?size=small", "price": 39.99 ... // Other offer-level properties } }, { "@type": "Product", "name": "Large light blue coat", "description": "Large wool light blue coat for the winter season", ... // Other Product-level properties "offers": { "@type": "Offer", "url": "https://www.example.com/coat/lightblue?size=large", "price": 49.99 ... // Other offer-level properties } }, { "url": "https://www.example.com/coat/green?size=small" } ] } ] </script> </head> <body> </body> </html>
第 2 页:绿色款式/规格
以下示例在第二页显示了针对绿色款式/规格的结构化数据:
<html> <head> <title>Wool winter coat, green color</title> <script type="application/ld+json"> [ { "@context": "https://schema.org/", "@type": "ProductGroup", "name": "Wool winter coat", "description": "Wool coat, new for the coming winter season", ... // Other ProductGroup-level properties "brand": { "@type": "Brand", "name": "Good brand" }, "productGroupID": "44E01", "variesBy": [ "https://schema.org/size", "https://schema.org/color" ], "hasVariant": [ { "@type": "Product", "name": "Small green coat", "description": "Small wool green coat for the winter season", ... // Other Product-level properties "offers": { "@type": "Offer", "url": "https://www.example.com/coat/green?size=small", "price": 39.99 ... // Other offer-level properties } }, { "url": "https://www.example.com/coat/lightblue?size=small" }, { "url": "https://www.example.com/coat/lightblue?size=large" } ] } ] </script> </head> <body> </body> </html>
多页示例:款式/规格与 ProductGroup
分离
此结构与前面的多页示例类似,不同之处在于,款式/规格是与 ProductGroup
分开定义的(未嵌套)。对某些 CMS 而言,此方法可能更容易生成。
第 1 页:浅蓝色款式/规格
以下示例在第一页显示了针对浅蓝色款式/规格的结构化数据:
<html> <head> <title>Wool winter coat, lightblue color</title> <script type="application/ld+json"> [ { "@context": "https://schema.org/", "@type": "ProductGroup", "@id": "#coat_parent", "name": "Wool winter coat", "description": "Wool coat, new for the coming winter season", "brand": { "@type": "Brand", "name": "Good brand" }, "audience": { "@type": "PeopleAudience", "suggestedGender": "unisex", "suggestedAge": { "@type": "QuantitativeValue", "minValue": 13, "unitCode": "ANN" } }, "productGroupID": "44E01", "pattern": "striped", "material": "wool", "variesBy": [ "https://schema.org/size", "https://schema.org/color" ] }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "sku": "44E01-K11000", "gtin14": "98766051104207", "image": "https://www.example.com/coat_lightblue.jpg", "name": "Small light blue coat", "description": "Small wool light blue coat for the winter season", "color": "light blue", "size": "small", "offers": { "@type": "Offer", "url": "https://www.example.com/coat/lightblue?size=small", "priceCurrency": "USD", "price": 39.99, "itemCondition": "https://schema.org/NewCondition", "availability": "https://schema.org/InStock", "shippingDetails": { "@id": "#shipping_policy" }, "hasMerchantReturnPolicy": { "@id": "#return_policy" } } }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "sku": "44E01-X1100000", "gtin14": "98766051104399", "image": "https://www.example.com/coat_lightblue.jpg", "name": "Large light blue coat", "description": "Large wool light blue coat for the winter season", "color": "light blue", "size": "large", "offers": { "@type": "Offer", "url": "https://www.example.com/coat/lightblue?size=large", "priceCurrency": "USD", "price": 49.99, "itemCondition": "https://schema.org/NewCondition", "availability": "https://schema.org/BackOrder", "shippingDetails": { "@id": "#shipping_policy" }, "hasMerchantReturnPolicy": { "@id": "#return_policy" } } }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "url": "https://www.example.com/coat/green?size=small" }, { "@context": "https://schema.org/", "@type": "OfferShippingDetails", "@id": "#shipping_policy", "shippingRate": { "@type": "MonetaryAmount", "value": 2.99, "currency": "USD" }, "shippingDestination": { "@type": "DefinedRegion", "addressCountry": "US" }, "deliveryTime": { "@type": "ShippingDeliveryTime", "handlingTime": { "@type": "QuantitativeValue", "minValue": 0, "maxValue": 1, "unitCode": "DAY" }, "transitTime": { "@type": "QuantitativeValue", "minValue": 1, "maxValue": 5, "unitCode": "DAY" } } }, { "@context": "https://schema.org/", "@type": "MerchantReturnPolicy", "@id": "#return_policy", "applicableCountry": "US", "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow", "merchantReturnDays": 60, "returnMethod": "https://schema.org/ReturnByMail", "returnFees": "https://schema.org/FreeReturn" } ] </script> </head> <body> </body> </html>
第 2 页:绿色款式/规格
以下示例在第二页显示了针对绿色款式/规格的结构化数据:
<html> <head> <title>Wool winter coat, green color</title> <script type="application/ld+json"> [ { "@context": "https://schema.org/", "@type": "ProductGroup", "@id": "#coat_parent", "name": "Wool winter coat", "description": "Wool coat, new for the coming winter season", "brand": { "@type": "Brand", "name": "Good brand" }, "audience": { "@type": "PeopleAudience", "suggestedGender": "unisex", "suggestedAge": { "@type": "QuantitativeValue", "minValue": 13, "unitCode": "ANN" } }, "productGroupID": "44E01", "pattern": "striped", "material": "wool", "variesBy": [ "https://schema.org/size", "https://schema.org/color" ] }, { "@context": "https://schema.org", "@type": "Product", "@id": "#small_green", "isVariantOf": { "@id": "#coat_parent" }, "sku": "44E01-M11000", "gtin14": "98766051104214", "image": "https://www.example.com/coat_green.jpg", "name": "Small green coat", "description": "Small wool green coat for the winter season", "color": "green", "size": "small", "offers": { "@type": "Offer", "url": "https://www.example.com/coat/green?size=small", "priceCurrency": "USD", "price": 39.99, "itemCondition": "https://schema.org/NewCondition", "availability": "https://schema.org/InStock", "shippingDetails": { "@id": "#shipping_policy" }, "hasMerchantReturnPolicy": { "@id": "#return_policy" } } }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "url": "https://www.example.com/coat/lightblue?size=small" }, { "@context": "https://schema.org", "@type": "Product", "isVariantOf": { "@id": "#coat_parent" }, "url": "https://www.example.com/coat/lightblue?size=large" }, { "@context": "https://schema.org/", "@type": "OfferShippingDetails", "@id": "#shipping_policy", "shippingRate": { "@type": "MonetaryAmount", "value": "2.99", "currency": "USD" }, "shippingDestination": { "@type": "DefinedRegion", "addressCountry": "US" }, "deliveryTime": { "@type": "ShippingDeliveryTime", "handlingTime": { "@type": "QuantitativeValue", "minValue": 0, "maxValue": 1, "unitCode": "DAY" }, "transitTime": { "@type": "QuantitativeValue", "minValue": 1, "maxValue": 5, "unitCode": "DAY" } } }, { "@context": "https://schema.org/", "@type": "MerchantReturnPolicy", "@id": "#return_policy", "applicableCountry": "US", "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow", "merchantReturnDays": 60, "returnMethod": "https://schema.org/ReturnByMail", "returnFees": "https://schema.org/FreeReturn" } ] </script> </head> <body> </body> </html>
指南
为了让您的商品款式/规格标记能够在 Google 搜索中使用,您必须遵循以下指南:
技术指南
- 每个款式/规格在对应的结构化数据标记中都必须具有唯一 ID(例如,使用
sku
或gtin
属性)。 - 每个商品组在对应的结构化数据标记中都必须具有唯一 ID,ID 可通过款式/规格
Product
属性中的inProductGroupWithID
属性或ProductGroup
属性中的productGroupID
属性指定。 - 除了商品款式/规格属性之外,请务必按照商家信息(或商品摘要)的必需属性列表添加
Product
结构化数据。 - 对于单页网站,所有款式/规格所属的整体
ProductGroup
只能有一个独特的规范网址。通常,此网址是指向未预选款式/规格的网页的基础网址,例如:https://www.example.com/winter_coat
。 - 对于多页网站,每个网页都必须针对该页面中定义的实体提供完整且独立的标记(这意味着,完全理解网页本身上的标记无需参考页面之外的实体)。
- 网站必须能够使用独特的网址(使用网址查询参数)直接预选每个款式/规格,例如
https://www.example.com/winter_coat/size=small&color=green
。这样,Google 就可以抓取并识别每个款式/规格。预先选择每个款式/规格包括显示合适的图片、价格和库存状况,以及允许用户将款式/规格添加到购物车。 - 如果您是针对所有类型的购物搜索结果进行优化的商家,我们建议将
Product
结构化数据放在初始 HTML 中,以便取得最佳效果。 - 对于由 JavaScript 生成的
Product
标记:请注意,动态生成的标记可能会导致购物内容抓取频率降低且不太可靠,这可能会对商品库存状况和价格等快速变化的内容造成影响。如果您使用 JavaScript 生成Product
标记,请确保您的服务器有足够的计算资源来处理来自 Google 的更多流量。
结构化数据类型定义
您必须为结构化数据添加必需的属性,才能在 Google 搜索中使用这些数据。您还可添加建议属性,以便添加与商品款式/规格相关的更多信息,进而提供更优质的用户体验。
ProductGroup
Google 可识别 ProductGroup
的以下属性。如需了解 ProductGroup
的完整定义,请访问 schema.org/ProductGroup。当您使用商品款式/规格信息标记内容时,请使用 ProductGroup
属性的以下属性。
必要属性 | |
---|---|
name |
|
建议属性 | |
---|---|
aggregateRating |
|
brand |
|
brand.name |
|
description |
|
hasVariant |
嵌套的 或者,款式/规格 |
productGroupID |
商品组的标识符(也称为“父级 SKU”)。必须为 |
review |
|
url |
仅适用于单页网站: |
variesBy |
|
Troubleshooting
If you're having trouble implementing or debugging structured data, here are some resources that may help you.
- If you're using a content management system (CMS) or someone else is taking care of your site, ask them to help you. Make sure to forward any Search Console message that details the issue to them.
- Google does not guarantee that features that consume structured data will show up in search results. For a list of common reasons why Google may not show your content in a rich result, see the General Structured Data Guidelines.
- You might have an error in your structured data. Check the list of structured data errors and the Unparsable structured data report.
- If you received a structured data manual action against your page, the structured data on the page will be ignored (although the page can still appear in Google Search results). To fix structured data issues, use the Manual Actions report.
- Review the guidelines again to identify if your content isn't compliant with the guidelines. The problem can be caused by either spammy content or spammy markup usage. However, the issue may not be a syntax issue, and so the Rich Results Test won't be able to identify these issues.
- Troubleshoot missing rich results / drop in total rich results.
- Allow time for re-crawling and re-indexing. Remember that it may take several days after publishing a page for Google to find and crawl it. For general questions about crawling and indexing, check the Google Search crawling and indexing FAQ.
- Post a question in the Google Search Central forum.