我目前正在为一个网站开发新闻页面。因为我在 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
,这样你就不会“错过”任何东西)。
关于 description
与 articleBody
:就像他们的描述所说,您可以使用 description
作为“简短描述”,使用 articleBody
作为新闻文章的“实际正文”。
关于 name
与 headline
: 它们通常具有相同的内容,所以如果您不知道/不需要这种差异,您可以使用 both (itemprop="headline name"
) 或简单地使用 name
(因为这是每个项目/Thing
都可以拥有的,而 headline
是 CreativeWork
的补充)。
它与微数据无关,但您可能希望为该列表中的每篇新闻文章使用 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/