对结构化数据中的 @id 如何工作感到困惑
Confused about how @id in structured data works
基本上,我尝试将 BlogPosting
、TechArticle
和 WebPage
结构化数据类型添加到我的帖子中,但我在 Google 中遇到错误s 结构化数据测试工具。它们似乎以我 link 回到我在主页上定义的 Organization
结构化数据类型为中心,以避免我不得不在多个页面上重复相同的代码。
这是结构化数据测试工具实例。谁能解释我如何在 author
、creator
和 publisher
属性中正确地 link 到 Organization
数据类型(位于我的主页上)?
感觉好像是我没有完全理解@id
属性,如何正确的使用它来把link结构化的数据结合起来减少重复数据.
这里是涉及的代码:
BlogPosting
- linked
Organisation
- 我收到的错误
BlogPosting
的例子
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"about": "Great news! Mike Brewer Motors - a project I've been heavily involved in over the past few years - has won the 'Best Online Experience' at the Autotrader 2018 Retailer Awards.",
"articleSection": "Blog Posts",
"author": {
"id": "https://www.lukeharrison.dev#organization"
},
"copyrightHolder": {
"id": "https://www.lukeharrison.dev#person"
},
"copyrightYear": "2019",
"creator": {
"id": "https://www.lukeharrison.dev#organization"
},
"dateCreated": "2018-07-20",
"dateModified": "2018-07-20",
"datePublished": "2018-07-20",
"description": "Great news! Mike Brewer Motors - a project I've been heavily involved in over the past few years - has won the 'Best Online Experience' at the Autotrader 2018 Retailer Awards.",
"genre": "Web Design & Front-End Development",
"headline": "Mike Brewer Motors wins 'Best Online Experience' at Autotrader's 2018 Retailer Awards - Luke Harrison",
"image": {
"@type": "ImageObject",
"height": 512,
"url": "https://s.gravatar.com/avatar/c34b34964896ad0552a5b342ae08c1e2?s=512",
"width": 512
},
"inLanguage": "en-GB",
"isFamilyFriendly": "true",
"keywords": [
"news"
],
"mainEntityOfPage": "https://www.lukeharrison.dev/articles/mike-brewer-motors-wins-best-online-experience-at-autotraders-2018-retailer-awards",
"publisher": {
"id": "https://www.lukeharrison.dev#organization"
}
}
示例 linked Organization
,位于另一页
{
"@context": "http://schema.org",
"@id": "https://www.lukeharrison.dev#organization",
"@type": "Organization",
"additionalType": [
"http://www.productontology.org/id/Web_design",
"http://www.productontology.org/doc/Search_engine_optimization",
"http://www.productontology.org/doc/Web_development"
],
"foundingDate": "2013",
"legalName": "Luke Harrison - UX / Web Developer",
"logo": "https://www.lukeharrison.dev/img/share-26bfb69f23.png",
"name": "Luke Harrison - UX / Web Developer",
"sameAs": [
"https://twitter.com/webdevluke?lang=en-gb",
"https://www.linkedin.com/in/lukedidit/",
"https://github.com/WebDevLuke",
"https://codepen.io/lukedidit/"
],
"url": "https://www.lukeharrison.dev"
}
我在 BlogPosting
结构中收到的错误
author
、creator
和 publisher
:
The attribute publisher.itemtype has an invalid value.
A value for the name field is required.
错误是关于Google的Article rich result(如果你不想得到这个丰富的结果,你可以忽略这些错误)。
对于 AMP 页面,author
和 publisher
是必需的属性。它们需要实际项目作为价值,不支持 @id
引用。您仍然可以提供 @id
,但您还需要指定 @type
和所需的属性。
基本上,我尝试将 BlogPosting
、TechArticle
和 WebPage
结构化数据类型添加到我的帖子中,但我在 Google 中遇到错误s 结构化数据测试工具。它们似乎以我 link 回到我在主页上定义的 Organization
结构化数据类型为中心,以避免我不得不在多个页面上重复相同的代码。
这是结构化数据测试工具实例。谁能解释我如何在 author
、creator
和 publisher
属性中正确地 link 到 Organization
数据类型(位于我的主页上)?
感觉好像是我没有完全理解@id
属性,如何正确的使用它来把link结构化的数据结合起来减少重复数据.
这里是涉及的代码:
BlogPosting
- linked
Organisation
- 我收到的错误
BlogPosting
的例子
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"about": "Great news! Mike Brewer Motors - a project I've been heavily involved in over the past few years - has won the 'Best Online Experience' at the Autotrader 2018 Retailer Awards.",
"articleSection": "Blog Posts",
"author": {
"id": "https://www.lukeharrison.dev#organization"
},
"copyrightHolder": {
"id": "https://www.lukeharrison.dev#person"
},
"copyrightYear": "2019",
"creator": {
"id": "https://www.lukeharrison.dev#organization"
},
"dateCreated": "2018-07-20",
"dateModified": "2018-07-20",
"datePublished": "2018-07-20",
"description": "Great news! Mike Brewer Motors - a project I've been heavily involved in over the past few years - has won the 'Best Online Experience' at the Autotrader 2018 Retailer Awards.",
"genre": "Web Design & Front-End Development",
"headline": "Mike Brewer Motors wins 'Best Online Experience' at Autotrader's 2018 Retailer Awards - Luke Harrison",
"image": {
"@type": "ImageObject",
"height": 512,
"url": "https://s.gravatar.com/avatar/c34b34964896ad0552a5b342ae08c1e2?s=512",
"width": 512
},
"inLanguage": "en-GB",
"isFamilyFriendly": "true",
"keywords": [
"news"
],
"mainEntityOfPage": "https://www.lukeharrison.dev/articles/mike-brewer-motors-wins-best-online-experience-at-autotraders-2018-retailer-awards",
"publisher": {
"id": "https://www.lukeharrison.dev#organization"
}
}
示例 linked Organization
,位于另一页
{
"@context": "http://schema.org",
"@id": "https://www.lukeharrison.dev#organization",
"@type": "Organization",
"additionalType": [
"http://www.productontology.org/id/Web_design",
"http://www.productontology.org/doc/Search_engine_optimization",
"http://www.productontology.org/doc/Web_development"
],
"foundingDate": "2013",
"legalName": "Luke Harrison - UX / Web Developer",
"logo": "https://www.lukeharrison.dev/img/share-26bfb69f23.png",
"name": "Luke Harrison - UX / Web Developer",
"sameAs": [
"https://twitter.com/webdevluke?lang=en-gb",
"https://www.linkedin.com/in/lukedidit/",
"https://github.com/WebDevLuke",
"https://codepen.io/lukedidit/"
],
"url": "https://www.lukeharrison.dev"
}
我在 BlogPosting
结构中收到的错误
author
、creator
和 publisher
:
The attribute publisher.itemtype has an invalid value.
A value for the name field is required.
错误是关于Google的Article rich result(如果你不想得到这个丰富的结果,你可以忽略这些错误)。
对于 AMP 页面,author
和 publisher
是必需的属性。它们需要实际项目作为价值,不支持 @id
引用。您仍然可以提供 @id
,但您还需要指定 @type
和所需的属性。