Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm trying to indicate multiple related products on a product page using schema.org microdata. But the child products are orphaned because they are not contained in the parent div. I tried using itemref but I must be using it incorrectly or it must be the wrong solution.

ALSO, I cannot easily create a wrapper div or use the body element to create the parent. My ideal solution would be one that leaves the page structure as-is, and somehow links the "child product" divs to the parent. I thought itemref would do that, but it doesn't appear to be working.

Here is example HTML.

<div id="main-product" itemscope itemtype="http://schema.org/Product">

  <div class="product-name">
      <h1 itemprop="name">Main Product</h1>
  </div>
</div>
<!-- END main-product div -->
<!-- START related-products div -->
<div class="related-products">
<ol class="products-list" id="related-products-list">
  <li class="item">
    <div class="product" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product" itemref="main-product">
      <p class="product-name"><a itemprop="url" href="/some_product1.php"><span itemprop="name">Some Product 1</span></a></p>                
    </div>
  </li>
  <li class="item">
    <div class="product" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product" itemref="main-product">
      <p class="product-name"><a itemprop="url" href="/some_product2.php"><span itemprop="name">Some Product 2</span></a></p>                
    </div>
   </li>
</ol>
</div>

The above HTML is simplified, but similar in structure to what's on my site and gives similar errors when submitted to validators.

E.g. http://webmaster.yandex.com/microtest.xml

Gives:

microdata
ERROR: unable to determine affiliation of these fields. There are two possible reasons: this fields are incorrectly placed or an orphan itemprop attribute is indicated
itemType = orphans
isrelatedto
product
itemType = http://schema.org/Product
url
href = /some_product1.php
text = Some Product 1
name = Some Product 1
isrelatedto
product
itemType = http://schema.org/Product
url
href = /some_product2.php
text = Some Product 2
name = Some Product 2

product
itemType = http://schema.org/Product
name = Main Product

The Google validator does not seem to show any errors, but the child products are not related to the parent product.

share|improve this question

1 Answer 1

It may pass Google but there is still problems with the code. To resolve the issue with Yandex, W3C and to be sure that it works well on all engines, all platforms and browsers then you should resolve this problem. The problem is that you are closing the product div early which results in The itemprop attribute was specified, but the element is not a property of any item.

Simply add a wrapper, or attach it too the body or html for example:

<div class="product-wrapper" itemscope itemtype="http://schema.org/Product">
<div id="main-product">

OR

<body itemscope itemtype="http://schema.org/Product">
<div id="main-product">

So your going to need to change your HTML code to make it validate, simples.

share|improve this answer
    
Thanks for your help but I cannot create a wrapper or use body. The body is created before the system knows whether this is a product page or a catalog page. The main product part of the page is created by a different module than the related products. I will dig deeper and see if there's any way I can create a wrapper. But I was under the impression that itemref can be used to link up schema that are in separate divs. Is that not the case? –  Buttle Butkus Dec 5 '13 at 19:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.