6

I'm new to microdata and I have the following scenario for which I would like some help:

I wish to put microdata on product pages where, on the page, there can be multiple variations of the same product. Each variation has the same name, description and image but they have each their own SKU, colour, size, weight and price.

On the page I have something like

<section id="commonparts">  
    <h1>Product name</h1>  
    <div><img src="productimage"></div>  
    <div>Product description</div>  
</section>  
<section id="variations">  
    <div id="variation1">  
        <div>SKU 1</div>
        <div>Colour 1</div>
        <div>Size 1</div>
        <div>Price 1</div>
    </div>  
    <div id="variation2">  
        <div>SKU 2</div>
        <div>Colour 2</div>
        <div>Size 2</div>
        <div>Price 2</div>
    </div>  
</section>

Is it possible to microdata this?

Thanks in advance

1 Answers1

0

You could make use of Microdata’s itemref attribute, so that you don’t have to duplicate the identical data.

Use the itemprop attributes on the data that is identical for all products, give each property an id, but don’t place these properties inside an itemscope:

<!-- no 'itemscope' parent -->
<section>
  <h1  itemprop="name"        id="product-name">Product name</h1>  
  <img itemprop="image"       id="product-img" src="productimage" alt="" /> 
  <p   itemprop="description" id="product-desc">Product description</p>  
</section>

On every product (each represented by a Product item), you list all the id values in its itemref attribute:

<section>  

  <div id="variation1" itemscope itemtype="http://schema.org/Product" itemref="product-name product-img product-desc">
    <!-- properties specific to this 'Product' variation --> 
  </div>  

  <div id="variation2" itemscope itemtype="http://schema.org/Product" itemref="product-name product-img product-desc">
    <!-- properties specific to this 'Product' variation --> 
  </div>  

</section>
unor
  • 92,415
  • 26
  • 211
  • 360