2013-04-21 37 views
0

我在<head>裏添加了schema.org豐富的代碼片段代碼,文本顯示在我的主頁上,我做錯了什麼?Microdata Rich Snippets在主頁上顯示?

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

那麼,你的'head'元素在哪裏? – unor 2013-04-21 13:32:06

+0

@unor我還沒有發佈整個部分......只是與問題有關的重要部分 – ubique 2013-04-21 13:39:00

回答

1

divhead不允許的。

解析者認爲body從遇到div開始,因此顯示此內容。

有關head element的允許內容,請參閱「內容模型」。

+0

代碼來自Schema.org,它在文檔的頭部使用了Divs - 任何解決方案以使其正常工作? – ubique 2013-04-21 18:42:36

+0

@ubique:你能鏈接到這樣一個例子嗎? – unor 2013-04-21 20:28:34

+0

這些是顯示的例子,頁面底部http://schema.org/Product – ubique 2013-04-22 08:50:00

-1

正確的DTD來使用XHTML和微觀數據是:

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