问题原文
原帖链接 · Rounin · CC BY-SA 3.0
Have I misunderstood what mainEntityOfPage represents in schema.org?
I thought it told user-agents what the parent page of a given entity is, if the entity being described by structured data is the main entity of a given page.
But every time I mark up in JSON-LD an entity which is not the main entity, Google Structured Data Testing Tool warns me:
The
mainEntityOfPagefield is recommended. Please provide a value if available.
So I get multiple repeated warnings recommending that each non-main entity should have a mainEntityOfPage entry.
Which... makes no sense at all.
Unless I have misunderstood what mainEntityOfPage represents in schema.org.
Am I allowed to include something like:
"mainEntityOfPage": "false"
Example:
<body>
<h1>I am a Webpage</h1>
<p>I am an introduction to the webpage.</p>
<article>
<h2>Article One</h2>
<p>As an article I am very important. In fact, I am the Main Entity of this Webpage</p>
</article>
<article>
<h2>Article Two</h2>
<p>I am another article on this Webpage, but I am not as important as Article One</p>
</article>
</body>
When I add structured data in JSON-LD about Article Two, I see the error:
The
mainEntityOfPagefield is recommended. Please provide a value if available.
which (I think?) is saying - you need to tell me: Article Two is the Main Entity of... what page?
But... Article Two isn't the Main Entity of anything. It is a less important entity of the webpage for which Article One is the Main Entity.
已采纳解答
原帖链接 · unor · CC BY-SA 3.0
Like it’s the case with most of the warnings/errors from the SDTT, this warning is only relevant if you want to get a specific rich result.
In this case, it seems to be for Google’s Articles rich result, which recommends to use mainEntityOfPage on AMP pages. If you don’t use AMP, or if you can’t provide all of the required properties, or if you don’t care about the rich result, you can ignore the warning.
Your understanding of mainEntityOfPage seems to be correct, and your use seems to be correct, too: only provide it for articles that are the primary entity on some page.
I think your case is unusual, though. Typically each article has a dedicated page. This page might provide data about additional articles (show teasers etc.), but these additional articles all would have their own page somewhere.
If you really have a page with two articles, and neither of these articles has another dedicated page, and both articles are self-contained, and the page is primarily only about one of these articles, then your structured data should be fine.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
