大网数据广告活动
网站运营与故障问答

Google Structured Data Testing Tool is repeatedly warning me about failing to include mainEntityOfPage in JSON-LD

· 52CE 我爱测

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 . B…

问题原文

原帖链接 · 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 mainEntityOfPage field 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 mainEntityOfPage field 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-11-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。