5

I am tagging the product pages of a webshop using Schema.org. So far, I have used a hierarchical structure where the body tag is marked as ItemPage. Then I can use the property breadcrumb on ItemPage for my breadcrumbs, and another property mainEntity which is a Product. This does not give any warnings in the Structured Data testing Tool - the hierarchy is displayed here the way I intended.

But I wonder if Google would pick up my Product/Offer markup easier if it wasn't bundled within an ItemPage. That is, should I skip ItemPage and just have the Product as a loose elements, along with breadcrumbs, and other ItemLists?

Which is better?

Example of my hierarchical layout:

<body itemscope itemtype="http://schema.org/ItemPage">
    <div>Some other stuff...</div>
    <ol itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
        <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
            <a href="/a" itemprop="item"><span itemprop="name">A</span></a>
        </li>
        <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
            <a href="/b" itemprop="item"><span itemprop="name">B</span></a>
        </li>
    </ol>
    <div itemprop="mainEntity" itemscope itemtype="http://schema.org/Product">
        <img src="/image.jpg" itemprop="image">
        <h1 itemprop="name">My Product</h1>
        <div itemprop="description">Example text</div>
        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
            <meta itemprop="price" content="129">
            <meta itemprop="priceCurrency" content="SEK">
            <link itemprop="availability" href="http://schema.org/InStock">
            <meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition">
        </div>
    </div>
</body>

Example of loose tagging: (The BreadcrumbList and the Product are not "itemprop" of anything)

<body>
    <div>Some other stuff...</div>
    <ol itemscope itemtype="http://schema.org/BreadcrumbList">
        <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
            <a href="/a" itemprop="item"><span itemprop="name">A</span></a>
        </li>
        <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
            <a href="/b" itemprop="item"><span itemprop="name">B</span></a>
        </li>
    </ol>
    <div itemscope itemtype="http://schema.org/Product">
        <img src="/image.jpg" itemprop="image">
        <h1 itemprop="name">My Product</h1>
        <div itemprop="description">Example text</div>
        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
            <meta itemprop="price" content="129">
            <meta itemprop="priceCurrency" content="SEK">
            <link itemprop="availability" href="http://schema.org/InStock">
            <meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition">
        </div>
    </div>
</body>
2

Your example of the hierarchical layout is very close to the suggested usage of the mainEntity property suggested by the official protocol documentation:

As mainEntity definition "indicates the primary entity described in some page", this is a perfect fit for your case, so my suggestion is that you choose this well structured code, Google should understand it perfectly.

This is the relevant code for this example used in schema.org main property:

<body itemscope itemtype="http://schema.org/WebPage">
...
<div itemprop="breadcrumb">
  <a href="category/books.html">Books</a> >
  <a href="category/books-literature.html">Literature & Fiction</a> >
  <a href="category/books-classics">Classics</a>
</div>
<div itemprop="mainEntity" itemscope itemtype="http://schema.org/Book">
<img itemprop="image" src="catcher-in-the-rye-book-cover.jpg"
     alt="cover art: red horse, city in background"/>
<span itemprop="name">The Catcher in the Rye</span> -
 <link itemprop="bookFormat" href="http://schema.org/Paperback">Mass Market Paperback
by <a itemprop="author" href="/author/jd_salinger.html">J.D. Salinger</a>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
  <span itemprop="ratingValue">4</span> stars -
  <span itemprop="reviewCount">3077</span> reviews
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
  Price: $<span itemprop="price">6.99</span>
  <meta itemprop="priceCurrency" content="USD" />
  <link itemprop="availability" href="http://schema.org/InStock">In Stock
</div>
Product details
<span itemprop="numberOfPages">224</span> pages
Publisher: <span itemprop="publisher">Little, Brown, and Company</span> -
 <meta itemprop="datePublished" content="1991-05-01">May 1, 1991
Language: <span itemprop="inLanguage">English</span>
ISBN-10: <span itemprop="isbn">0316769487</span>
</div>
...
</body>

The above example and yours, both are being fully processed by https://search.google.com/structured-data/testing-tool with very similar results.

  • Thanks! I would agree, but Google has not indexed the markup (for example, no aggretated rating is shown) on a website I tested this on, even though the code has been there about 3 months now. Oh well! – Truls Aug 8 '16 at 12:39
  • Did you send the webpage URL to Google to be sure it crawls it again? – marcanuy Aug 8 '16 at 13:50
  • Yes, I've submitted the sitemap and Google is crawling pages every day, but for some reason the structured data is not picked up the way I had hoped. I can see that Google has found many ItemPage objects in Search Console, but no Product/Offer objects. – Truls Aug 9 '16 at 11:14
  • By experimenting I got much better results when using only 1 top-level object - in my case, the ItemPage. Previously I had an ItemPage with a Product as mainEntity, but also a couple of "loose" ItemLists. This caused Google to see 3 top-level objects and I guess they got confused. When reducing the markup and using only ItemPage -> Product -> Offer etc the products got indexed right away. – Truls Aug 16 '16 at 13:59
  • 1
    No, I kept mainEntity, so that the mainEntity of ItemPage is a Product. I removed a few ItemLists since they couldn't be connected to the ItemPage in a similar hieararchical way. The result was that the ItemPage became the lone top-level object and this seemed to work much better. – Truls Aug 16 '16 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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