产品尺寸:宽度,高度和深度 [英] Product size: width, height and depth

查看:376
本文介绍了产品尺寸:宽度,高度和深度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用schema.org定义来表示产品。
我对产品尺寸有疑问:我应该在现场指定计量单位吗?

I'm using schema.org definition to represent a product. I have a doubt about product size: should I specify the unit of measure in the field?

这是我的代码(我需要一个单独的 span 代表cm来设置不同的样式):

Here's my code (I need a separate span for "cm" to style it differently):

<div itemscope itemtype="http://schema.org/Product">
    <h1 itemprop="name">Product name</h1>

    Size: 
    <span itemprop="width">60 <span>cm</span></span>
    <span itemprop="height">50 <span>cm</span></span>
    <span itemprop="depth">40 <span>cm</span></span>
</div>

这是定义大小的正确方法吗?

Is this the correct way to define the size?

推荐答案

width / 深度 / height 属性期望 距离 QuantitativeValue 作为价值。

The width/depth/height properties expect Distance or QuantitativeValue as value.

因为距离类型似乎没有定义要提供的合适属性实际值及其描述表示值已

As the Distance type does not seem to define a suitable property to provide the actual value, and its description says that values have


[...]形式'< Number> <长度测量单位>'。例如,'7英尺'。

[…] the form '<Number> <Length unit of measure>'. E.g., '7 ft'.

我认为不应该明确提供类型,例如:

I assume that the type should not be provided explicitly, e.g.:

<span itemprop="width">
  60 <span>cm</span>
</span>

如果要提供类型,我想使用 name 是唯一的选择:

If the type should be provided, I guess using name is the only option:

<span itemprop="width" itemscope itemtype="http://schema.org/Distance">
  <span itemprop="name">60 <span>cm</span></span>
</span>



如果你想使用 QuantitativeValue



If you want to use QuantitativeValue:

<span itemprop="width" itemscope itemtype="http://schema.org/QuantitativeValue">
  <span itemprop="value">60</span>
  <span>cm</span>
  <meta itemprop="unitCode" content="CMT" />
</span>

而不是为cm指定UN / CEFACT代码(= CMT meta 元素(允许在正文 中,如果您将其用于Microdata),您还可以使用数据元素:

Instead of specifying the UN/CEFACT code for "cm" (= CMT) in a meta element (which is allowed in the body, if you use it for Microdata), you could also use the data element:

<span itemprop="width" itemscope itemtype="http://schema.org/QuantitativeValue">
  <span itemprop="value">60</span>
  <data itemprop="unitCode" value="CMT">cm</data>
</span>

这篇关于产品尺寸:宽度,高度和深度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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