4

In my Googse Search Console I have warning that some of the keys-values of Schema.org (using JSON-LD) on my website are missing. However, they're missing on purpose -- there's no data to be added to them.

For instance, https://schema.org/AggregateRating - For some products on my website there's no rating yet, no one has rated such products yet. Hence, I don't add AggregateRating key on the product page.

In such cases, what should I do? Should I continue having them omitted? Or should I add them with null or empty values?

1

2 Answers 2

3

If your ratings are empty you should not render them at all. I suggest using conditional rendering of your JSON-ld markup, so that you only render the metadata you actually have values for.

This conditional rendering should be handled by your back-end so that onload you only render metadata with valid values.

The technique in itself depends on the programming language / technology you use for mark up rendering (.NET / PHP / JSP / something else) and is of more technical nature. What you should take away from that is to conditionally render your metadata for maximum control, instead of always rendering them.

6
  • If your ratings are empty you should not render them at all. - based on what you say that?
    – karridu
    Commented Jul 27, 2019 at 22:26
  • @karridu If you render the aggregateRating property without values on ratingValue and/or reviewCount properties, google's structured data validator will mark the lines as erroneous, because you have to specify valid numbers. On the other hand, you do not want to specify values that are not actual customer reviews, so the only option is to omit the aggregateRating property for products with no ratings. The property itself is recommended but not mandatory, as per google itself developers.google.com/search/docs/data-types/product.
    – Prinny
    Commented Jul 28, 2019 at 15:29
  • "If you render the aggregateRating property without values on ratingValue and/or reviewCount properties, google's structured data validator will mark the lines as erroneous, because you have to specify valid numbers. " -- based on what you say that?
    – karridu
    Commented Jul 29, 2019 at 11:54
  • @karridu based on testing. Go here pastebin.com/NEZJcJ0m and take this sample json-ld metadata mark up. Then go to google's structured data tool here search.google.com/structured-data/testing-tool/u/0, select code snippet and paste the medata. You will see only warnings about missing recommended properties. Now do the following: remove the ratingValue and reviewCount values, leaving them empty and validate again. You will now see two errors have appeared, because "A value for the ratingValue field is required." If you remove the aggregateRating completely, no errors are found.
    – Prinny
    Commented Jul 29, 2019 at 12:32
  • I have the same thing for my website. Even though some keys are absent on my website, a) there're still warnings b) no errors, but no "valid products" either. Why "no valid products"?
    – karridu
    Commented Aug 2, 2019 at 6:45
2

Should I continue having them omitted? Or should I add them with null or empty values?

If you skip/ignore this property, then the lack of a property that Google recommends may cause a conflict with the rich results of Google.

An empty value in the data does not make sense and this may also conflict with the rich results of Google.

However, null has quite a clear value in computer science and in data. Therefore, I recommend that you use a value such as zero. In this case, you explicitly indicate that you have not forgotten about this property and the website above currently has no reviews and the average rating, accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.