Samstag, 22. März 2014

Solution for "Rich snippets not showing"

Rich snippets not showing
During my microdata coding i quite accidentally realized, that "rich snippets are not showing" doesn't always mean "rich snippets not working"! My research was about nesting and inheritance of Schema.org's classes, and, playing with the Google's structured data testing tool, i detected a case where my microdata markup was correctly validated and worked properly, but rich snippets of this code weren't showing. After some tests i got to know about two causes of not shown rich snippets:

Nesting deeper then first (upper) level

in case microdata markup code is nested, and rich-snippet generating code (like rating) is located not at the highest level, such code will be correctly validated, but visual rich snippets will be not shown.

Look into this code, go to test and to validate it, and then try to comment out the first rating occurence. You will see, that the second rating occurence is validated correctly but rating stars aren't shown.

<div itemscope itemtype="http://schema.org/BlogPosting">

<div  itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue" content="90%">
<div itemprop="ratingCount">20</div>
</div>

<div itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<span itemprop="name">Wowa</span>

<div itemprop="worksFor" itemscope="" itemtype="http://schema.org/Organization">
<div  itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue" content="90%">
<div itemprop="ratingCount">20</div>
</div>
</div>

</div>

Using of "two types approach" applied to classes

Another cause of not shown rich snippets is using of so called "two types approach" i mentioned in this article about several kinds of autorship markup. Compare the following two pieces of code:
<!-- "Two types approached" code -->
<div itemscope itemtype="http://schema.org/BlogPosting%20http://schema.org/AggregateRating">
<div itemprop="aggregateRating">
<meta itemprop="ratingValue" content="90%">
<div itemprop="ratingCount">20</div>
</div>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">It's me again</span>
</div>
</div>
<!-- Nested code -->
<div itemscope itemtype="http://schema.org/BlogPosting">
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue" content="90%">
<div itemprop="ratingCount">20</div>
</div>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">It's me again</span>
</div>
</div>
</a>
Both of markup kinds are correctly validated by Google structured data testing tool: two types approached code vs nested code. But the two types approached code generates no visible rich snippets, as is shown.
Yandex.Metrica