user3654045
user3654045

Reputation: 77

What is the correct use of mainEntityOfPage schema

I am writing structured data for a magazine. I got this under the Article type:

"mainEntityOfPage": {
    "@type": "WebPage",
    "@id": " https://www.example.com/category" //category of the article
  },

I thought I would mark the category of the article using this. Is this the correct way of using mainEntityOfPage?

Upvotes: 2

Views: 3167

Answers (1)

unor
unor

Reputation: 96717

No, the value should be the WebPage dedicated to the Article. Both items would typically have the same url, but possibly different @id values (see URL of page vs. post).

{
  "@context": "http://schema.org",
  "@type": "Article",
  "@id": "/articles/42#this",
  "url": "/articles/42",

  "mainEntityOfPage": {
    "@type": "ItemPage",
    "@id": "/articles/42",
    "url": "/articles/42"
  }

}

It might become clearer when looking at the inverse property mainEntity. You would have a WebPage for the current page and provide the mainEntity property to convey what the primary entity on this page is:

{
    "@context": "http://schema.org",
    "@type": "ItemPage",

    "mainEntity": {
      "@type": "Article"
    }

}

When using mainEntityOfPage instead of mainEntity, you simply switch subject and object.

Upvotes: 3

Related Questions