gpt4 book ai didi

html - 当值为图像时使用 AggregateRating 和 ratingValue

转载 作者:太空狗 更新时间:2023-10-29 16:09:00 25 4
gpt4 key购买 nike

我正在尝试向我的网站添加一些丰富网页摘要,但在 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>

这似乎被正确地拾取了。

最佳答案

您的做法是正确的。只需在适当的位置添加一个标签并将值设置为“ratingValue”。它不会在页面呈现给用户时显示。

所以你会使用这个标签: <meta itemprop="ratingValue" content="4.5">

http://schema.org/Review范围内在您的文档中,就像您在更新中显示的那样。

关于html - 当值为图像时使用 AggregateRating 和 ratingValue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6889256/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com