New required mainEntityOfPage for article structured data
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.
What is this property?
It's supplementary to the url
and sameAs
properties, as described in the mainEntity
background.
It has an idiosyncratic name as it may be applied to all items of type Thing
. If it applied only to Articles
it could have been called mainTopic
/mainTopicOfArticle
and been more clear.
I don't understand what the value of the property must be?
The value of the property is expected to be a item of type CreativeWork
or a URL
referencing that work according to Schema.org. That means it could also be an Article
or BlogPosting
as you mentioned. However, if you're building out AMP pages, the value should be a URL.
Will this in any way conflict with the code sample supplied by Google?
Despite what Google's Structured Data Testing Tool says their documentation no longer recommends using the mainEntityOfPage
for non-AMP pages so you're free to omit it.