0

I've never used Rich Snippets before, so this is a little bit of a learning curve for me. I believe my issue is a nesting problem but I can't find any documentation anywhere that explicitly states how to nest these properties correctly.

I'm wanting to index a single-product review with multiple reviews into Rich Snippets with classic ASP pulling in different data feilds, here is my code:

<div>
    <div itemscope itemtype="http://data-vocabulary.org/Review">
        <span itemprop="itemreviewed">Forma Stanzol</span><br />
        By <span itemprop="reviewer"><%=formaStanzolReviewArray(0,i)%></span><br />
        <time itemprop="dtreviewed" datetime="<%=FormatDateTime(formaStanzolReviewArray(1,i),2)%>"><%=FormatDateTime(formaStanzolReviewArray(1,i),2)%></time> <br />        
        <span itemprop="description"><%=formaStanzolComment%></span>
    </div>      
</div>

This returns the Error: No rich snippet will be generated for this data, because it appears to include multiple reviews of an item, but no aggregate review information.

So, I added a dummy Aggregate code with static values, here's what it looks like all together:

<div>
    <div itemscope itemtype="http://data-vocabulary.org/Review">
        <span itemprop="itemreviewed">Forma Stanzol</span><br />
        By <span itemprop="reviewer"><%=formaStanzolReviewArray(0,i)%></span><br />
        <time itemprop="dtreviewed" datetime="<%=FormatDateTime(formaStanzolReviewArray(1,i),2)%>"><%=FormatDateTime(formaStanzolReviewArray(1,i),2)%></time> <br />        
        <span itemprop="description"><%=formaStanzolComment%></span>
    </div>
    <div itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
        <span itemprop="itemreviewed">Forma Stanzol</span>
        <span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
            <span itemprop="average">9</span>
            out of <span itemprop="best">10</span>
        </span>
        based on<span itemprop="count">5</span> user reviews.
    </div>           
</div>

This causes my "Reviews" to not error but then all of my "Aggregate Reviews" push out this Error: No rich snippet will be generated for this data, because it appears to include multiple aggregate reviews of many items, instead of a single aggregate review of one item.

Seems like it's working against itself no matter what I do, so that's why I believe this to be a nesting issue.

How can I fix this?

EDIT: Ideally, I don't event want the Aggregate view of this item. The reviewer, item name, review date, and review description is all I need.

EDIT EDIT: This code is also running in a For loop where its getting information from the database with each pass.

unor
  • 92,415
  • 26
  • 211
  • 360
wUmpage
  • 165
  • 2
  • 17

1 Answers1

0

Ok so the issue here was that a website, with a single product, but multiple reviews needs only one "Review-Aggregate" and one "Rating" itemtype. However, multiple "Review" itemtypes must be used.

So, my For Loop creates a "Review" for each row in the database, using the related data feilds and then after the conditional statement, the "Review-Aggregate" and Rating" codes are placed.

Code:

For i = 0 to uBound(formaStanzolReviewArray,2)
    reviewCount = reviewCount + 1

    formaStanzolComment = trim(formaStanzolReviewArray(2,i))

    'Do not show reviews with empty comments
    If Not (formaStanzolComment = "") OR isNull(formaStanzolComment) Then
    %>
        <div>
            <div itemscope itemtype="http://data-vocabulary.org/Review">
                <span style="position: absolute; left: 9999px;" itemprop="itemreviewed">Forma Stanzol</span>
                Rating: <span itemprop="rating"><%=formaStanzolReviewArray(3,i)%></span> - 
                By <span itemprop="reviewer"><%=formaStanzolReviewArray(0,i)%></span> - 
                <time itemprop="dtreviewed" datetime="<%=FormatDateTime(formaStanzolReviewArray(1,i),2)%>"><%=FormatDateTime(formaStanzolReviewArray(1,i),2)%></time> <br />        
                <span itemprop="description"><%=formaStanzolComment%></span>
            </div>        
        </div>
    <%
    sumRating = sumRating + formaStanzolReviewArray(3,i)
    End If
Next
ratingAvg = sumRating / reviewCount
%>
<div style="position: absolute; left: 9999px;">
    <div itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
        <span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
            <span itemprop="worst">1</span>
            <span itemprop="average"><%=ratingAvg%></span>
            out of <span itemprop="best">5</span>
        </span>
        based on <span itemprop="votes"><%=reviewCount%></span> ratings.
        <span itemprop="count"><%=reviewCount%></span> user reviews.
    </div>
</div>
<%

Think of it as multiple User reviews in the For Loop, but we collect all of those reviews once in the aggregate, and then give that aggregate a rating scale.

Hope this helps anyone having nesting issues.

Please Note: I am using classic ASP for this particular code.

wUmpage
  • 165
  • 2
  • 17