我想在我的网站上添加AggregateRating
信息,以便在Google的搜索结果中显示星标。
在Google的开发网站it says上,这只适用于五种不同的评论类型:
就我而言,这些类型都没有描述我网站上的评分。但是,我发现一个网站没有在其标记中定义任何类型,但AggregateRating
仍显示在Google的搜索结果中。
网站https://www.1averbraucherportal.de/ernaehrung包含以下标记:
<div style="display: none;" itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating">
<meta itemprop="bestRating" content="5">
<meta itemprop="worstRating" content="1">
<meta itemprop="ratingValue" content="3.46">
<meta itemprop="ratingCount" content="158">
</div>
它不包含任何类型,但Google会考虑评级:https://www.google.de/search?q=site%3A1averbraucherportal.de+ernaehrung
我的问题:
答案 0 :(得分:1)
有问题的网站确实为评分为Article
的商品提供了类型。
在您的示例中,aggregateRating
是值为AggregateRating
的属性。此属性属于另一个项目,即具有itemscope
属性的最近父元素。因此,他们页面中的完整相关标记是:
<span itemscope itemtype="http://schema.org/Article">
<!-- … -->
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<!-- … -->
</div>
</span>
(请注意,HTML无效。)
如果您不提供带有itemscope
的父元素,则HTML +微数据将无效。但是,仅提供itemscope
属性是可能且有效的,不具有itemtype
属性。
因此aggregateRating
属性可能属于未指定此项代表内容的项目:
<div itemscope>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<!-- … -->
</div>
</div>
但你也可以使用Schema.org的Thing
类型(所有是Thing
):
<div itemscope itemtype="http://schema.org/Thing">
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<!-- … -->
</div>
</div>
尽管如此,所有这些并不意味着Google搜索会显示其丰富的搜索结果。他们有自己的规则,即使他们有时会显示不符合这些规则的内容,这可能取决于各种未知因素,而且可能会在任何一天发生变化。