如何仅标记产品类别?

时间:2014-04-10 14:16:30

标签: microdata schema.org

如何标记我的网站产品类别? ......只有类别...

也许来自category的{​​{1}}?

类似的东西:

Offer

1 个答案:

答案 0 :(得分:3)

您不应在category元素上指定avalue would be the URIcategory1.php),而不是内容(My category 1)。

category需要一个文本或其他项目的值。

因此,如果您想提供文字,可以使用以下内容:

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

是的,只使用一个属性是完全没问题的。 Schema.org doesn’t define required properties。但是,消费者(例如搜索引擎)当然可能只考虑重新使用您的数据,如果它满足自己的某些要求。


更新:如果您想为该项目提供多个类别,则可能类似于:

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

不要重命名category属性!将12等添加到其中将是错误的。

(它是类别的层次结构,您可以使用一个值/>。,例如Sports > Tennis。)