Categories for Product in schema.org?

∥☆過路亽.° 提交于 2020-01-03 09:25:41

问题


Using as a reference: https://support.google.com/webmasters/answer/146750?hl=en

You will notice under 'Product' that there is a category Property, and furthermore there's an example on down the page:

<span itemprop="category" content="Hardware > Tools > Anvils">Anvils</span>

which I've mimic'd exactly:

<span itemprop="category" content="kitchen sinks > stainless steel sinks > undermount">undermount</span>

Yet when I test it with Google's structured data tool, I get the error:

Error: Page contains property "category" which is not part of the schema.

I realized in the example also, it's using data-vocabulary.org→Product, where I'm using schema.org→Product.

Now on http://schema.org/Product, it does not have category anywhere mentioned. Does schema.org not offer categories? Or am I missing something?


回答1:


category is an itemprop of schema/Offer, not schema/Product

To fix your problem, place an offer within the product, and attach the category to the offer.




回答2:


Note: You are using a content attribute on span, which is not valid in HTML5 or Microdata (but in RDFa).

Schema.org has a category property, but it can not be used on Product. Depending on your content, you may want to use Offer instead of Product (see also my answer with an example use of category).




回答3:


I've been working on JSON-ld & microdata a lot recently, and I believe in your case 'category' needs to be placed in a meta tag, not span/div tag, preferably before your item. Logically, your need to identify 'undermount' is redundant as it would already be included within your content. Oddly, the schema type service has 'serviceType' as a property, but product does not have an equivalent, otherwise that could have been another workaround. For your content 'undermount' use itemprop="name" within your span, no content within that tag necessary.




回答4:


<meta itemprop="category" content="Hardware > Tools > Anvils > Anvils" />

Here is the correct format accepted by schema.org...



来源:https://stackoverflow.com/questions/19031818/categories-for-product-in-schema-org

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!