如何只标记产品类别? [英] How to mark only product categories?

查看:40
本文介绍了如何只标记产品类别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须如何标记我的网站产品类别?……只有类别……

也许使用 Offer 中的 category?

类似于:

<a itemprop="category" href="category1.php">我的类别1</a>

解决方案

您不应在 a 元素上指定 category.值将是 URI(category1.php),而不是内容(我的类别 1).

category 需要文本或其他项目的值.>

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

<a href="category1.php"><span itemprop="category">我的类别1</span></a>

是的,只使用一个属性完全没问题.Schema.org 没有定义必需的属性.但是,消费者(例如搜索引擎)当然可能只会在满足他们自己的某些要求时才考虑重复使用您的数据.

<小时>

更新:如果您想为项目提供多个类别,它可能是这样的:

<ul><li itemprop="category"><a href="category1.php">我的类别1</a></li><li itemprop="category"><a href="category2.php">我的类别2</a></li><li itemprop="category"><a href="category3.php">我的类别3</a></li>

不要重命名 category 属性!添加 12 等是错误的.

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

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>

解决方案

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

这篇关于如何只标记产品类别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆