0

I added the schema.org rich snippets code inside the <head> and the text is showing up on my home page, what am I doing wrong?

DTD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0 Transitional//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

...

Snippet Code

<div itemscope itemtype="http://schema.org/EntertainmentBusiness">
       <span itemprop="name">MySite.com</span>
       <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
            <span itemprop="ratingValue">4.5</span> stars -
            based on <span itemprop="reviewCount">233</span> Reviews
        </div>
    </div>
ubique
  • 1,212
  • 3
  • 17
  • 28

2 Answers2

1

div is not allowed in head.

Parser’s think that the body started since they encounter div, so this content is displayed.

See "Content model" for the allowed content of the head element.

unor
  • 92,415
  • 26
  • 211
  • 360
-1

The correct DTD to use for XHTML and MicroData is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional with HTML5 microdata//EN" "xhtml1-transitional-with-html5-microdata.dtd">

Found a code example from schema.org that uses the 'meta' tag - although it's not recommended from an SEO point of view according to the articles I have read:

<div itemscope itemtype="http://schema.org/Offer">
  <span itemprop="name">Blend-O-Matic</span>
  <span itemprop="price">$19.95</span>
  <div itemprop="reviews" itemscope itemtype="http://schema.org/AggregateRating">
    <img src="four-stars.jpg" />
    <meta itemprop="ratingValue" content="4" />
    <meta itemprop="bestRating" content="5" />
    Based on <span itemprop="ratingCount">25</span> user ratings
  </div>
</div>
ubique
  • 1,212
  • 3
  • 17
  • 28