schema.org - 在“组织”类型的网页上使用“mainEntityOfPage”和“CreativeWork”
问题描述
我有一个关于mainEntityOfPage
在这种情况下正确使用 , 的问题:
- 该网站的主页是
Organization
带有名称、公司描述、电话、地址等的类型。 - 在这个页面的底部,我有这家公司发表的 3 篇不同文章的 3 个片段。
- 所以,我试图声明
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
输入?
解决方案
您的结构化数据没有传达您打算传达的内容。就是说是三个sOrganization
上的主要实体。CreativeWork
所以,我试图声明
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 相比)仅提供了一种非标准化的方式来在另一个方向使用这些属性:请参阅此答案
推荐阅读
- tsql - 使用子查询填充 IN 列表
- ios - 在 iOS 12 上的 scrollView.contentInset 之后,scrollView.setContentOffset 不起作用
- vba - VLookup 结果未显示
- java - signing.properties 错误(系统找不到指定的文件)
- javascript - apisauce (axios wrapper) - 我可以处理响应错误写入一次并自动调用而不是手动添加 if else
- delphi - 防止“刷出” TListBox 项
- swift - URLRequest 相等性不包括 httpBody
- php - Laravel Eloquent 查找日期超过 2 天的行
- flutter - Flutter应用中Websocket、STOMP的使用
- node.js - 使用 redis 在 https 上的 Socketio