Microdata Rich Snippets在主页上显示?

时间:2013-04-21 10:50:50

标签: microdata rich-snippets

我在<head>中添加了schema.org丰富网页摘要代码,文字显示在我的主页上,我做错了什么?

DTD

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

...

代码段

<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>

2 个答案:

答案 0 :(得分:1)

div中不允许

head

Parser认为body因遇到div而开始,因此会显示此内容。

有关head element的允许内容,请参阅“内容模型”。

答案 1 :(得分:-1)

用于XHTML和MicroData的正确DTD是:

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

在schema.org中找到了一个使用'meta'标记的代码示例 - 虽然根据我读过的文章,不建议从SEO的角度推荐它:

<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>