如何使用微数据标记“相关新闻”?

时间:2013-07-11 08:35:00

标签: html5 semantic-web semantic-markup microdata schema.org

新闻帖就像

<article itemscope itemtype="http://schema.org/NewsArticle">       

  <h1 itemprop="headline">Awesome News</h1>    

  <div itemprop="articleBody">
     bla bla bla...
  </div>

</article>

如果我想包含相关新闻并加以标记,该怎么办?

<ul>
  <li><a href="related_news_1.html">Related News 1</a></li>
  <li><a href="related_news_2.html">Related News 2</a></li>
  <li><a href="related_news_3.html">Related News 3</a></li>
</ul>

1 个答案:

答案 0 :(得分:5)

尝试使用来自WebPage itemtype的元素(来自:http://schema.org/WebPage,我知道你在这种情况下使用的是NewsArticle,但我在本例中使用了Article):

<div itemscope itemtype="http://schema.org/Article">
    <span itemprop="name">How to Tie a Reef Knot</span>
    by <span itemprop="author">John Doe</span>
    This article has been tweeted 1203 times and contains 78 user comments.
    <meta itemprop="interactionCount" content="UserTweets:1203" />
    <meta itemprop="interactionCount" content="UserComments:78" />
</div>


<ul itemscope itemtype="http://schema.org/WebPage">
    <li itemprop="relatedLink"><a href="related_news_1.html">Related News 1</a></li>
    <li itemprop="relatedLink"><a href="related_news_2.html">Related News 2</a></li>
    <li itemprop="relatedLink"><a href="related_news_3.html">Related News 3</a></li>
</ul>

Google网站管理员工具可以这样看:

enter image description here

或者你可以这样做:

<ul itemscope itemtype="http://schema.org/WebPage">
    <li><a href="related_news_1.html" itemprop="relatedLink">Related News 1</a></li>
    <li><a href="related_news_2.html" itemprop="relatedLink">Related News 2</a></li>
    <li><a href="related_news_3.html" itemprop="relatedLink">Related News 3</a></li>
</ul>

谷歌就是这样看的:

enter image description here