0

我在里面添加了 schema.org 丰富的片段代码<head>,文本显示在我的主页上,我做错了什么?

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

2 回答 2

1

div不允许进入head

Parser 认为是body从遇到开始的div,所以显示了这个内容。

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

于 2013-04-21T13:43:56.973 回答
-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 找到了一个使用“元”标签的代码示例——尽管根据我读过的文章,从 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>
于 2013-04-22T10:09:10.233 回答