我正在尝试向我的网站添加一些丰富的代码段,并且我在AggregateRating部分中苦苦挣扎,因为我的ratingValue的值仅显示为图像。
我的标记看起来像这样:
<tr itemprop="reviews" itemscope itemtype="http://schema.org/Review">
<th>Rating:</th>
<td itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<img itemprop="ratingValue" class="rating" src="/content/images/ratings/4.5.png" alt="4.5" title="Rating: 4.5 / 5" />
</td>
</tr>
据我所知,这是有效的HTML,因为文本值可用作ALT文本,因此符合辅助功能指南。但是,我不确定如何将此ALT标记为ratingValue的值。
有谁知道我应该在这做什么?
感谢。
好的,经过几个小时的Google Rich Snippets Tester测试后,我想出的是:
<tr itemprop="reviews" itemscope itemtype="http://schema.org/Review">
<th>Rating:</th>
<td itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue" content="4.5">
<img class="rating" src="/content/images/ratings/4.5.png" alt="4.5" title="Rating: 4.5 / 5" />
</td>
</tr>
这似乎得到了适当的回应。
答案 0 :(得分:3)
你的方法是正确的。只需在适当的位置添加标记,并将值设置为“ratingValue”。当页面呈现给用户时,它不会显示。
所以你要使用这个标签:
<meta itemprop="ratingValue" content="4.5">
在您的文档中http://schema.org/Review
的范围内,就像您在更新中所显示的那样。