我试图在我的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测试时,我没有得到任何星级或汇总评论计数
我在这里做错了什么?
是的!这个问题实际上包含两个错误,首先有人将div类命名为"hReview-aggregate"当你实现微格式 not时,这是合适的微数据
第二个错误是我误解了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>
希望这有助于!!!!!
嘿,看看holidayhq的家伙是如何为这个url做的:www.holidayiq.com/destinations/Lonavala-Overview.html
您可以在此工具上查看该片段:http://www.google.com/webmasters/tools/richsnippets
和谷歌这个关键字"lonavala景点",你会看到相同的片段,他们使用微数据在片段中生成这个评论,他们使用typeof="v:Review-aggregate"和更多的标签,看看它,它很好地实现了片段评论的工作。