Categories for Product in schema.org?

2019-06-18 15:45发布

问题:

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...