In short. Use mainEntityOfPage on an entity or mainEntity on a WebPage to express the same relationship in opposite directions.
Definition: Schema.org's
mainEntityOfPageproperty indicates a page or other creative work for which an entity is the main entity being described. The inverse relationship,mainEntity, is placed on the page and identifies the primary entity described there.
Key facts
- Schema.org defines
mainEntityOfPageas a relationship from a thing to the page or creative work for which it is the main entity. - Schema.org lists
CreativeWorkandURLas the expected value types formainEntityOfPage. - Schema.org's
mainEntityproperty identifies the primary entity described in a page or other creative work and namesmainEntityOfPageas its inverse. - A
WebPageis a web page, and Schema.org recommends declaring that type explicitly when its properties are specified. - The W3C's JSON-LD 1.1 specification uses
@idto identify a node and@typeto specify its type.
What does the relationship mean?
Schema.org starts from the entity side: mainEntityOfPage indicates a page or other CreativeWork for which the entity is the main entity being described. Its inverse is mainEntity. On the page side, mainEntity indicates the primary entity described in that page or creative work.
The two properties describe one relationship in opposite directions. A page can point to its subject with mainEntity; the subject can point back to the describing page with mainEntityOfPage. Schema.org's expected value types make the page-side value an entity and the entity-side value either a CreativeWork or a URL.
This relationship concerns the page's principal subject. It is separate from mainContentOfPage, which Schema.org lists on WebPage with expected type WebPageElement and describes as indicating whether a web page element is the main subject of the page.
How can you express it in JSON-LD?
JSON-LD is a lightweight syntax for serializing linked data in JSON. The W3C specification says that @id identifies a node and @type specifies the node type. An HTML document can embed JSON-LD in a script element whose type is application/ld+json.
Schema.org publishes a WebPage example with a nested Restaurant under mainEntity:
{
"@context": "https://schema.org",
"@type": "WebPage",
"@id": "http://cathscafe.example.com/",
"mainEntity": {
"@type": "Restaurant",
"name": "Cath's Cafe"
}
}
The same relationship can be written from the restaurant's side. Schema.org's mainEntityOfPage example uses the cafe page URL as the value:
{
"@context": "https://schema.org",
"@type": "Restaurant",
"mainEntityOfPage": "http://cathscafe.example.com/",
"name": "Cath's Cafe"
}
The examples use a URL as the page reference. A site can instead use a CreativeWork value when the describing work is represented as a structured node.
What should a website check?
Use an explicit WebPage node when page properties are specified. Schema.org says every web page is implicitly assumed to be a WebPage, while recommending explicit declaration in that situation. Give the page an @id, set its mainEntity to the structured entity that the page primarily describes, and use mainEntityOfPage on that entity when the reverse link is useful in the same graph.
The relationship describes meaning in Schema.org's vocabulary. The downloaded sources document the vocabulary and JSON-LD serialization, but they do not document a ranking or answer-engine selection effect from adding either property.
Related terms
FAQ
Is mainEntityOfPage the same as mainEntity?
They are inverse properties. Use mainEntity on a page to identify its primary entity, or use mainEntityOfPage on that entity to identify the page for which it is the main subject.
Can the value be a URL?
Yes. Schema.org lists URL and CreativeWork as expected value types for mainEntityOfPage. Its example uses the cafe page URL as the value.
Does this property identify the main part of the HTML?
No. mainContentOfPage is the WebPage property for a WebPageElement that is the main subject of the page. mainEntityOfPage links an entity to the page or creative work describing it.
Sources
- Schema.org, "mainEntityOfPage", undated
- Schema.org, "mainEntity", undated
- Schema.org, "WebPage", undated
- W3C, "JSON-LD 1.1", 16 July 2020
Check how a page reads to answer engines. Open the GEO score analyzer