How to mark only product categories?

How can I mark product categories on your site? ... only categories ...

Perhaps with a category from Offer ?

Sort of:

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

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

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

So, if you want to provide text, you can 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’s quite normal to use only one property. Schema.org does not define the required properties . But consumers (for example, search engines) can, of course, only consider the reuse of your data if it meets certain requirements.


UPDATE: if you want to provide several categories for an element, it could be something like this:

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

Do not rename the category property! Addendum 1 , 2 , etc. It would be wrong.

(And this is a hierarchy of categories, you can use a single value and / or > ., For example Sports > Tennis .)

+3
source

Source: https://habr.com/ru/post/954688/


All Articles