Search code examples
htmlcssseogoogle-search-consolegoogle-crawlers

How to index star rating in google?


So here is the HTML markup that I have on my site and it displays star rating with the help of some css.

Now I have read this entire google document but I am still not able to understand how to change my markup. I am not willing to make changes in css and I don't have that much data available with me so that can create markup as per microdata/RDF as mentioned in google docs.

What is the minimum change that I can make so that google understands aggregate rating for the item?

<div class="store__rating">
   <meta content="5" itemprop="rating">
   <div class="rateStars"><span class="filled_green"><i class="icon-star"></i></span>
      <span class="filled_green"><i class="icon-star"></i></span>
      <span class="filled_green"><i class="icon-star"></i></span>
      <span class="filled_green"><i class="icon-star"></i></span>
      <span class="filled_green"><i class="icon-star"></i></span>
      <span class="reviewCount">
      2Reviews
      </span>
   </div>
</div>

enter image description here


Solution

  • I ended up doing like this, here is the testing tool, just paste the HTML and validate

    <div class="store__rating" typeof="v:Review-aggregate" xmlns:v="http://rdf.data-vocabulary.org/#">
       <span rel="v:rating">
           <span typeof="v:Rating">
             <span content="5" property="v:average"></span>
             <span content="5" property="v:best"></span>
           </span>
       </span>
       <span content="2" property="v:count"></span>
       <div class="rateStars"><span class="filled_green"><i class="icon-star"></i></span>
          <span class="filled_green"><i class="icon-star"></i></span>
          <span class="filled_green"><i class="icon-star"></i></span>
          <span class="filled_green"><i class="icon-star"></i></span>
          <span class="filled_green"><i class="icon-star"></i></span>
          <span class="reviewCount">
          2 Reviews
          </span>
       </div>
    </div>