大网数据广告活动
网站运营与故障问答

New required mainEntityOfPage for article structured data

· 52CE 我爱测

I had a look at the article structured data as proposed by Google and saw that there are a new required and recommended fields, they weren't there last week. Here is the link: https://developers.google.com/structured-data/rich-sn…

问题原文

原帖链接 · Brendan Vogt · CC BY-SA 3.0

I had a look at the article structured data as proposed by Google and saw that there are a new required and recommended fields, they weren't there last week. Here is the link:

https://developers.google.com/structured-data/rich-snippets/articles

The first property on the list is :

  • mainEntityOfPage.@id (recommended)

I don't understand what the value of the property must be? What is this property? Is it a link to:

..or a link to the current blog post like:

They have this in their sample code:

<meta itemscope itemprop="mainEntityOfPage"  itemType="https://schema.org/WebPage" itemid="https://google.com/article" />

This what I currently have, it does not yet conform to the test tool's rules - I am still busy adding all the required properties and at the same time trying to add the recommended properties there as well:

<div itemscope itemtype="http://schema.org/BlogPosting">
   <h1 itemprop="headline">
      <a href="http:///www.example.com/blog/1001/my-blog-article" itemprop="url">My Blog Article</a>
   </h1>
   <p>Written by
      <span itemprop="author" itemscope itemtype="http://schema.org/Person">
         <span itemprop="name">Mase Kind</span>
      </span> on
      <time itemprop="datePublished" datetime="2015-11-16T15:30:00+02:00">November 16, 2015</time>
      <meta itemprop="dateModified" content="2015-12-10T12:29:00+02:00" />
      <div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
         <div itemprop="logo" itemscope itemtype="http://schema.org/ImageObject"></div>
         <meta itemprop="name" content="My Company Name" />
      </div>
   </p>
   <div itemprop="articleBody">
      <p>first article body</p>
   </div>
</div>

I also have this in my document:

<body itemscope itemtype="http://schema.org/WebPage">
...
</body>

Will this in any way conflict with the code sample supplied by Google?

已采纳解答

原帖链接 · unor · CC BY-SA 3.0

The mainEntityOfPage property is used to give the URL of a page on which the thing is the main entity. It might become clearer if you look at the inverse property mainEntity: this gives the main entity for a page (see an example).

For example, for a web page that contains a single blog post, you could provide one of these:

  • BlogPosting → mainEntityOfPage → WebPage
  • WebPage → mainEntity → BlogPosting

These properties are useful to convey what the main content on a page is (because pages might contain multiple items, e.g., an ItemList with related WebPage items, a Person describing the author, a WebSite giving some metadata, etc.).

(See my answer on Stack Overflow for a more detailed explanation.)


There are two ways how to use mainEntityOfPage:

  • provide the URL of the page
  • embed/reference the page item (typically a WebPage)

The second one often doesn’t make much sense (you would rather use the inverse property mainEntity), and probably for that reason Google recommends/expects the first one.

For providing the URL, you could simply use a link element:

<article itemscope itemtype="http://schema.org/BlogPosting">
  <link itemprop="mainEntityOfPage" href="http://example.com/article-1" />
</article>

Google’s Structured Data Testing Tool accepts this.

In the Articles Rich Snippet example, Google is using a meta element with itemid instead:

<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="https://google.com/article"/>

This is invalid HTML5+Microdata: If the meta element has an itemprop attribute, it must also have a content attribute.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2015-12-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。