基本上,我正在尝试将BlogPosting
,TechArticle
和WebPage
结构化数据类型添加到我的帖子中,但是我在Google的结构化数据测试工具中遇到了错误。当我链接回到我在首页上定义的Organization
结构化数据类型时,它们似乎处于中心位置,以免我不得不在多个页面中重复相同的代码。
这是结构化数据测试工具实例。谁能解释我如何正确地链接到Organization
,author
和creator
属性中的publisher
数据类型(位于我的主页上)?
我觉得可能是完全不了解@id
属性以及如何正确使用它来将结构化数据链接在一起以减少重复数据的原因。
这里是涉及的代码:
BlogPosting
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"
}
}
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
:
publisher.itemtype属性的值无效。
必须输入名称字段的值。
答案 0 :(得分:1)
错误与Google的Article rich result有关(如果您不想获得如此丰富的结果,则可以忽略这些错误)。
对于AMP页面,author
和publisher
是必填属性。它们需要实际的项目作为值,不支持@id
引用。您仍然可以提供@id
,但是您还需要指定@type
和必需的属性。