W3C home > Mailing lists > Public > public-vocabs@w3.org > May 2012

Aggregate rating on one page, linked reviews on another - schema.org microdata markup

From: Aaron Bradley <aaranged@yahoo.com>
Date: Fri, 18 May 2012 11:23:43 -0700 (PDT)
Message-ID: <1337365423.19109.YahooMailNeo@web161002.mail.bf1.yahoo.com>
To: Public Vocabs <public-vocabs@w3.org>
I'm trying to figure out how to best markup both a page that contains a aggregate review rating and a page housing the reviews from which that aggregate rating is derived.

This is a very common situation.  It is, for example, exactly how Amazon.com organizes their reviews...

The Great Gatsby - Product page:
http://www.amazon.com/The-Great-Gatsby-Scott-Fitzgerald/dp/0684801523
The Great Gatsby - Reviews page:
http://www.amazon.com/The-Great-Gatsby-Scott-Fitzgerald/product-reviews/0684801523/

... but I can't find any examples (schema.org examples all show reviews on the same page as the item reviewed).

Here's the code.

The Aggregate Rating
Found on page:
http://example.com/greatitem/

<body>
<div 4 stars - based on 250reviews</div>
<div><a href="http://example.com/greatitem/reviews/">Read reviews</a></div>
</body>

Marking this seems relatively straightforward.

<body itemscope itemtype="http://schema.org/WebPage">
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
    <span itemprop="ratingValue">4</span> stars -
    based on <span itemprop="reviewCount">250</span> reviews
 </div>
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
    <a href="http://example.com/greatitem/reviews/" itemprop="url">Read reviews</a>
</div>
</body>

Reviews on Another Page Linked to By the Aggregate Rating
Found on page:
http://example.com/greatitem/reviews/

Here's where I get a little muddled.  My purpose is to associate these reviews with the upper-level page (URL) to which they refer.  But it doesn't seem logical to use the itemReviewed property for each and every review, as all reviews on the page refer to this item.  In short, how do I correctly and unambiguously reference the parent?

Here's the sample code of the dedicated reviews page without microdata:

<body>
<p>Reviews of <a href="http://example.com/greatitem/">Great Item</a></p>
<p>4 stars - The best damn example page I've ever seen.</p>
<p>1 star - Terrible example page.</p>
</body>

Here's my first crack at marking this up.  Am I close (at least it seems to validate okay)?

<body itemscope itemtype="http://schema.org/WebPage">
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<p>Reviews of <span itemprop="itemReviewed" itemscope itemtype="http://schema.org/Thing"><a href="http://example.com/greatitem/" itemprop="url">Great Item</a></span></p>
<p itemprop="review" itemscope itemtype="http://schema.org/Review"><span itemprop="reviewRating">4</span> stars - <span itemprop="reviewBody">The best damn example page I've ever seen.</span></p>
<p itemprop="review" itemscope itemtype="http://schema.org/Review"><span itemprop="reviewRating">1</span> star - <span itemprop="reviewBody">Terrible example page.</span></p>
</div>
</body>
Received on Friday, 18 May 2012 18:24:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 06:49:04 GMT