使用schema.org标记和在xhtml页面中查看时,不会显示星标和聚合评级

时间:2011-11-23 14:52:17

标签: xhtml microdata schema.org rich-snippets

我正在尝试在我的xhtml模板中实现schema.org的microData格式。 由于我使用的是xhtml模板,我需要添加

<div itemprop="reviews" itemscope="itemscope" itemtype="http://schema.org/Review">

而不是:

<div itemprop="reviews" itemscope itemtype="http://schema.org/Review">

否则我的模板将无法解析。我找到了解决方案here

我的标记看起来像这样:

<div itemscope="itemscope" itemtype="http://schema.org/Place">

                        <div itemprop="aggregateRating" itemscope="itemscope"
                             itemtype="http://schema.org/AggregateRating">
                            <span itemprop="ratingValue">#{company.meanRating}</span> stars -
                            based on <span itemprop="reviewCount">#{company.confirmedReviewCount}</span> reviews
                        </div>

                        <ui:repeat var="review" value="#{company.reverseConfirmedReviews}">

                            <div itemprop="reviews" itemscope="itemscope" itemtype="http://schema.org/Review">
                                <span itemprop="name">Not a happy camper</span> -
                                by <span itemprop="author">#{review.reviewer.firstName}</span>,
                                <div itemprop="reviewRating" itemscope="itemscope" itemtype="http://schema.org/Rating">
                                    <span itemprop="ratingValue">1</span>/
                                    <span itemprop="bestRating">5</span>stars
                                </div>
                                <span itemprop="description">#{review.text} </span>
                            </div>

                        </ui:repeat>
                    </div>

http://www.google.com/webmasters/tools/richsnippets中对此进行测试时,我没有收到任何星标或汇总评论次数

我在这里做错了什么?

2 个答案:

答案 0 :(得分:3)

是!! 问题实际上包含两个错误,首先有人将div类命名为 “ hReview-aggregate ”适用于实施微格式微数据

第二个错误是我误解了schema.org的规范。 这就是我最终的表现:

           <div class="box bigBox" itemscope="itemscope" itemtype="http://schema.org/LocalBusiness">
               <span itemprop="name">#{viewCompany.name}</span>
                <div class="subLeftColumn" style="margin-top:10px;" itemprop="aggregateRating" itemscope="itemscope" itemtype="http://schema.org/AggregateRating">        
                    <div class="num">
                        <span class="rating" id="companyRating" itemprop="ratingValue">#{rating}</span>
                    </div>
                    <div>Grade</div>
                    <div class="num">
                         <span class="count" id="companyCount" itemprop="reviewCount">
                              #{confirmedReviewCount}
                         </span>
                    </div>
                </div>
            </div>

希望这有助于!!!!!

答案 1 :(得分:1)

嘿结帐holidayhq家伙是如何为这个网址做的:www.holidayiq.com/destinations/Lonavala-Overview.html

您可以在此工具上查看代码段:http://www.google.com/webmasters/tools/richsnippets

并谷歌出这个关键字“lonavala attractions”,你会看到相同的片段,他们使用微数据在片段中生成这些评论,他们使用了typeof =“v:Review-aggregate”和更多标签,有一个看看它,它在片段类型的工作中很好地实现了评论。