Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Product size: width, height and depth

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?

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?

like image 265
ninjabachelor Avatar asked Dec 25 '22 10:12

ninjabachelor


1 Answers

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

If you want to use Distance:

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

[…] 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>

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>

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>

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>
like image 62
unor Avatar answered Jan 07 '23 02:01

unor