ratingValue为空时的Schema.org AggregateRating标记 [英] Schema.org AggregateRating markup when ratingValue is Empty

查看:200
本文介绍了ratingValue为空时的Schema.org AggregateRating标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 AggregateRating标记在应用程序中实现结构化数据.问题是当存在0个等级时,等级值为空.使用Google结构化数据测试工具时出现以下错误.

I am implementing structured data into an app with the AggregateRating markup. The problem is that when 0 ratings are present the rating value is empty. I get the following error when using Google Structured Data Testing Tool.

字段ratingValue不能为空.

Field ratingValue may not be empty.

<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<meta itemprop="reviewCount" content="0">
<meta itemprop="ratingValue" content="">
...
</div>

该应用使用默认的1到5评分等级.

The app uses the default 1 to 5 rating scale.

是否有一个符合Schema.org的默认值,当ratingValue为空时可以将其传递给它?我不想为了避免错误而按比例传递任意数字...

Is there a default value that complies with Schema.org that can be passed to when the ratingValue is empty? I don't want to pass it an arbitrary number on the scale just to avoid the error...

推荐答案

您引用的Google结构化数据测试工具错误具有误导性.使用Schema.org或微数据不是 错误.

The Google Structured Data Testing Tool error you quote is misleading. It’s not an error with your use of Schema.org or Microdata.

相反,这仅意味着Google可能不会考虑显示其聚合为您在Google搜索中的文档提供丰富的摘要代码(自然,因为为此需要一个评估值).

Instead it just means that Google probably won’t consider displaying their Aggregate Ratings Rich Snippet for your document in Google Search (naturally, because a rating value would be required for this).

但是,在此处为ratingValue属性提供空字符串作为值实际上没有任何意义.那么,为什么不简单地忽略财产呢?理想的情况是,如果您还没有任何评论,则应完全省略aggregateRating属性和AggregateRating.

However, providing the empty string as value for the ratingValue property doesn’t really make sense here. So why not simply omit the property? And ideally you would omit the aggregateRating property with the AggregateRating altogether if you don’t have any reviews yet.

这篇关于ratingValue为空时的Schema.org AggregateRating标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆