Question

How do I have to mark my website product categories? … only categories …

Maybe with category from Offer?

Something like:

<div itemscope itemtype="http://schema.org/Offer">
   <a itemprop="category" href="category1.php">My category 1</a>
</div>
Was it helpful?

Solution

You should not specify category on an a element. The value would be the URI (category1.php), not the content (My category 1).

category expects a value that is either text or another item.

So if you want to provide text, you could use something like:

<div itemscope itemtype="http://schema.org/Offer">
   <a href="category1.php"><span itemprop="category">My category 1</span></a>
</div>

And yes, it is totally fine to use only one property. Schema.org doesn’t define required properties. But consumers (e.g., search engines) might, of course, only consider re-using your data if it fulfils certain of their own requirements.


UPDATE: If you want to provide several categories for the item, it could be something like:

<div itemscope itemtype="http://schema.org/Offer">
  <ul>
   <li itemprop="category"><a href="category1.php">My category 1</a></li>
   <li itemprop="category"><a href="category2.php">My category 2</a></li>
   <li itemprop="category"><a href="category3.php">My category 3</a></li>
  </ul>
</div>

Don’t rename the category property! Adding 1, 2 etc. to it would be wrong.

(And it it’s a hierarchy of categories, you could use one value and / or >., e.g. Sports > Tennis.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top