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

ama*_*ino 7 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>
Run Code Online (Sandbox Code Playgroud)

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

<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>
Run Code Online (Sandbox Code Playgroud)

Arc*_*ios 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>
Run Code Online (Sandbox Code Playgroud)

Google网站站长工具会像这样看到:

在此输入图像描述

或者你可以这样做:

<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>
Run Code Online (Sandbox Code Playgroud)

谷歌就是这样看的:

在此输入图像描述

  • 你的第一个例子(`itemprop ="relatedLink"`on`li`而不是`a`)不会错误,因为[`relatedLink`有预期的类型`URL`](http://schema.org/WebPage) ? (2认同)