New required mainEntityOfPage for article structured data
Solution 1
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.
Solution 2
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.
Related videos on Youtube
Brendan Vogt
Wedding photographer and videographer from Paarl, South Africa. Join me on my new adventure in wedding photography and videography at Brendan Vogt Photo & Video.
Updated on September 18, 2022Comments
-
Brendan Vogt over 1 year
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?
-
dasickle over 8 yearsJust saw the same thing happen to my site this morning and landed on this thread.
-
unor about 7 years@StarWars: Yes, that’s the way to make this
meta
element valid. Note that thecontent
value would be ignored, so you could provide an empty value. -
Oleksandra Varavina about 7 yearsokay, I've now added content="" to meta tag.
-
Oleksandra Varavina about 7 yearsWhy google uses
meta
instead oflink
in its examples? both of these validate in the structured data testing tool. Although, the preview is different. Whenlink
is used, it hasmainEntityOfPage http://example.com/article-1
while in the case ofmeta
it shows@id
and@type
attributes.