html - Schema.org 中的新闻项目

标签 html schema.org microdata

我目前正在为一个网站开发新闻页面。因为我在 http://schema.org/ 上找不到任何新闻示例,我想知道对此最好的 Schema.org 类型是什么?

<li>
  <time>2015-12-31<time>
  <div>
    <h2>News title</h2>
    <div class="content">Lorem Ipsum</div>
  </div>
</li>

我还需要添加微数据吗?

我目前拥有的:

<li itemscope itemtype="http://schema.org/Article">
  <time itemprop="datePublished">2015-12-31<time>
  <div>
    <h2 itemprop="headline">News title</h2>
    <div class="content" itemprop="description">Lorem Ipsum</div>
  </div>
</li>

文章是否合适?
我应该使用 headline 还是 name
我应该使用 description 还是 articleBody

最佳答案

Schema.org type Article是合适的,正如它的描述所说(大胆强调我的):

An article, such as a news article or piece of investigative report. […]

但您甚至可以使用 NewsArticle type 来更加具体(请注意,通过使用此类型,您的新闻帖子是 also 一个 Article 并且也是一个 CreativeWork 并且也是 Thing,这样你就不会“错过”任何东西)。

关于 descriptionarticleBody :就像他们的描述所说,您可以使用 description 作为“简短描述”,使用 articleBody 作为新闻文章的“实际正文”。

关于 nameheadline : 它们通常具有相同的内容,所以如果您不知道/不需要这种差异,您可以使用 both (itemprop="headline name") 或简单地使用 name(因为这是每个项目/Thing 都可以拥有的,而 headlineCreativeWork 的补充)。

它与微数据无关,但您可能希望为该列表中的每篇新闻文章使用 article 元素。如果它是一个列表,例如,最近的新闻帖子,父级 should probably not be article but section :

<section>
  <h1>Recent news posts</h1>
  <ul>
    <li><article><!-- news post 1 --></article></li>
    <li><article><!-- news post 2 --></article></li>
  </ul>
</section>

文章可能看起来像:

<li>
  <article itemscope itemtype="http://schema.org/NewsArticle">
    <header>
      <time itemprop="datePublished">2015-12-31<time>
      <h2 itemprop="name">News title</h2>
    </header>

    <div itemprop="description"><!-- news teaser --></div>
    <!-- or "articleBody" instead of "description" if it’s the full content -->

  </article>
</li>

关于html - Schema.org 中的新闻项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27930232/

相关文章:

javascript - 如何动态获取浏览器的高度和宽度?

schema.org - 如何正确实现免费产品?

html - 如何将 Schema.org 标签添加到酒店房间?

seo - 微数据还是 JSON-LD?我很困惑

html - Schema.org 的 WebSite 与 WebPage 类型有什么区别?

javascript - 如何将两个 json 对象连接在一起?

javascript - 正确使用 JQuery 的 prepend(...) 函数

html - CSS 链接无法正常工作

schema.org - 无法使用 PostalAddress 验证事件丰富代码段,但没有地点

html - Schema.org 网页 - isPartOf?