我正在为客户开发网站。他们用微数据标记了他们在网站上显示的个人评论,但没有包括相应的 aggregateRating
属性。
我已经通知他们,他们需要包含 aggregateRating
属性,以便让 Google 在他们的有机列表中显示星星。客户回应说这没问题,但我必须向交互的用户隐藏与 aggregateRating
- (ratingValue
, ratingCount
) 关联的任何值与他们的网站。
我知道 Google 不赞成这种做法,但我想知道是否有人成功地使用 CSS 隐藏了评论 Schema.org?我所说的成功是指谷歌仍然在有机列表中显示星星。
最佳答案
无需使用 CSS 隐藏您的架构。并非所有模式数据都必须显示在网页上。考虑 JSON-LD 模式,它都在 head
中,所以这些值都不会显示。
HTML 架构允许您标记网页上不可见的内容。
Sometimes, a web page has information that would be valuable to mark up, but the information can't be marked up because of the way it appears on the page […]
[…]
<meta itemprop="ratingValue" content="4" />
完整代码片段:
<div itemscope itemtype="http://schema.org/Offer"> <span itemprop="name">Blend-O-Matic</span> <span itemprop="price">$19.95</span> <div itemprop="reviews" itemscope itemtype="http://schema.org/AggregateRating"> <img src="four-stars.jpg" /> <meta itemprop="ratingValue" content="4" /> <meta itemprop="bestRating" content="5" /> Based on <span itemprop="ratingCount">25</span> user ratings </div> </div>
关于css - 使用 CSS 隐藏 'aggregateRating',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40538478/