4

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

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

代替:

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

否则我的模板将不会被解析。我在这里找到了解决方案

我的标记如下所示:

<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对此进行测试时,我没有得到任何星星或汇总评论计数

我在这里做错了什么?

4

2 回答 2

3

是的!!问题实际上包括两个错误,首先有人将 div 类命名为“ hReview-aggregate ”,这在您实现Microformats而不是 Microdata时是合适的

第二个错误是我误解了 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>

希望这可以帮助!!!!!

于 2011-11-29T10:38:02.267 回答
1

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

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

然后用谷歌搜索这个关键字“lonavala 景点”,你会看到相同的片段,他们使用微数据在片段中生成此评论,他们使用了 typeof="v:Review-aggregate" 和更多标签,看看它,它很好地实现了片段式工作中的评论。

于 2012-03-02T08:09:35.347 回答