在这种情况下,我有一个关于正确使用mainEntityOfPage
的问题:
Organization
类型,名称,公司描述,电话,地址等。Organization
类型的主页,是网页的主要话题。此外,我想声明使用Schema.org,该公司已经编写了3篇不同的文章,这些文章位于他们自己的网页上。这些片段包括文章标题,介绍段落,图片和“阅读更多”按钮。我使用以下代码:
<body itemscope itemtype="http://schema.org/Organization" >
<a href="https://testsite.com/index.html" itemprop="url">
<img src="https://testsite.com/img/logo.jpg" itemprop="logo" alt="Company logo" />
</a>
<p itemprop="name">Company name</p>
<p itemprop="description">Company description</p>
<div itemprop="mainEntityOfPage" itemscope itemtype="https://schema.org/CreativeWork">
<meta itemprop="thumbnailUrl" content="https://testsite.com/img/article-1-picture.jpg" />
<p itemprop="headline">Article 1 headline</p>
<p itemprop="description">Article 1 first paragraph.</p>
<a itemprop="url" href="https://testsite.com/url-article-1.html">Read more</a>
</div>
<div itemprop="mainEntityOfPage" itemscope itemtype="https://schema.org/CreativeWork">
<meta itemprop="thumbnailUrl" content="https://testsite.com/img/article-2-picture.jpg" />
<p itemprop="headline">Article 2 headline</p>
<p itemprop="description">Article 2 first paragraph.</p>
<a itemprop="url" href="https://testsite.com/url-article-2.html">Read more</a>
</div>
<div itemprop="mainEntityOfPage" itemscope itemtype="https://schema.org/CreativeWork">
<meta itemprop="thumbnailUrl" content="https://testsite.com/img/article-3-picture.jpg" />
<p itemprop="headline">Article 3 headline</p>
<p itemprop="description">Article 3 first paragraph.</p>
<a itemprop="url" href="https://testsite.com/url-article-3.html">Read more</a>
</div>
</body>
上面的代码生成以下模式:
该代码对结构化数据测试工具有效。
我担心在这里使用mainEntityOfPage
3次,引入文章片段会导致搜索引擎错误地考虑我的CreativeWork
类型页面而不是Organization
类型的情况,这是这个网页上真正的主要话题。
那么,这段代码告诉搜索引擎该页面是Organization
,在单独的页面上有3篇文章,或者只有CreativeWork
类型?
您的结构化数据不会传达您打算传达的内容。据说Organization
是三个CreativeWork
s的主要实体。
所以,我试图宣布
Organization
类型的主页,是网页的主要话题。
为此,您需要一个代表主页的WebPage
项目。
<body itemscope itemtype="http://schema.org/Organization">
<div itemprop="mainEntityOfPage" itemscope itemtype="http://schema.org/WebPage">
<link itemprop="url" href="https://example.com/" /> <!-- the canonical URL of your homepage -->
</div>
</body>
我想声明使用Schema.org,该公司已经写了3篇不同的文章,这些文章位于他们自己的网页上。
为此,您需要说明公司和文章¹如何相关的属性,例如:
请注意,例如,publisher
仅定义为一个方向(文章有出版商),而不是另一个(组织已发表文章)。²所以你必须在Article
中提供这个属性,而不是在Organization
。
<article itemscope itemtype="http://schema.org/Article">
<div itemprop="mainEntityOfPage" itemscope itemtype="http://schema.org/ItemPage">
<link itemprop="url" href="https://example.com/url-article-1.html" /> <!-- the canonical URL of the article page -->
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<link itemprop="url" href="https://example.com/" /> <!-- the canonical URL of the organization’s homepage -->
</div>
</article>
¹如果它们实际上是文章,你应该使用Article
类型而不是父类型CreativeWork
²微数据(与RDFa和JSON-LD相比)只提供了一种非标准化的方法,可以在另一个方向上使用这些属性:see this answer