我目前正在尝试使用WebSite
通过JSON-LD来应用Organization
和@graph
Schema.org,并且遇到了语法问题,我没有了解。我不是Java开发人员,而是HTML&CSS专家,所以我真的不知道发生了什么。
在Google的结构化数据测试工具中,第11行出现错误:
在数组声明中缺少“,”或“]”。
但是我已经经历了很多次,我无法理解问题。我试过重新排列所有括号,然后在各处移动内容,似乎每次消除错误时,都会出现另一个错误。这是到目前为止我获得的最好的代码版本。
在其他@type
内使用@type
时似乎出现了问题。
{
"@context" : "http://schema.org",
"@graph" :
[
{
"@type" : "WebSite",
"url" : "https://www.bcsauto.com",
"name" : "BCS Auto",
"author" :
[
"@type" : "Person",
"name" : "Justin Hilliard"
],
"description" : "Your NEW source for Late Model Camaro Parts & Accessories!",
"publisher" : "Justin Hilliard ",
"potentialAction" :
[
"@type" : "SearchAction",
"target" : "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input" : "required name=search_term"
]
},
{
"@type" : "Organization",
"name" : "BCS Auto",
"url" : "http://www.bcsauto.com",
"logo" : "https://shop.bcsauto.com/files/images/logo.png",
"foundingDate" : "2016",
"founders":
[
{
"@type": "Person",
"name": "Justin Hilliard"
},
],
},
{
"@type" : "ContactPoint",
"contactType" : "Sales",
"telephone" : "[+1-602-730-6415]",
"email" : "sales@bcsauto.com",
"areaServed" : "US"
},
{
"@type" : "ContactPoint",
"contactType" : "Customer Support",
"telephone" : "[+1-602-730-6415]",
"email" : "support@bcsauto.com",
"areaServed" : "US",
"sameAs" :
[
"https://www.facebook.com/OfficialBCSAuto",
"https://instagram.com/officialbcsauto",
"https://www.linkedin.com/company/bcsauto"
]
}
]
}
答案 0 :(得分:0)
"author" :
[
"@type" : "Person",
"name" : "Justin Hilliard"
],
"potentialAction" :
[
"@type" : "SearchAction",
"target" : "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input" : "required name=search_term"
]
[
]
用于数组,{
}
用于对象。在上面的代码段中,您有对象,因此必须使用大括号而不是方括号。
"founders":
[
{
"@type": "Person",
"name": "Justin Hilliard"
},
],
在上面的代码段中,您有一个仅包含一个对象的数组。无论是否保留数组(仅保留一个值,都不需要),都必须删除最后两个,
,因为对象是数组中的最后一个值,而数组是其中的最后一个值父对象。
答案 1 :(得分:0)
由于@unor,我得以解决此问题!因为我不了解数组和对象,所以我混用了括号和花括号。
{
"@context": "http://schema.org",
"@graph": [
{
"@type": "WebSite",
"url": "https://www.bcsauto.com",
"name": "BCS Auto",
"author": {
"@type": "Person",
"name": "Justin Hilliard"
},
"description": "Your NEW source for Late Model Camaro Parts & Accessories!",
"publisher": {
"@type": "Person",
"name": "Justin Hilliard"
},
"potentialAction": {
"@type": "SearchAction",
"target": "https://shop.bcsauto.com/search.html?q={search_term}&go=Search",
"query-input": "required name=search_term"
}
},
{
"@type": "Organization",
"name": "BCS Auto",
"url": "http://www.bcsauto.com",
"logo": "https://shop.bcsauto.com/files/images/logo.png",
"foundingDate": "2016",
"founders": {
"@type": "Person",
"name": "Justin Hilliard"
},
"ContactPoint": [
{
"@type": "ContactPoint",
"contactType": "Sales",
"telephone": "[+1-602-730-6415]",
"email": "sales@bcsauto.com",
"areaServed": "US"
},
{
"@type": "ContactPoint",
"contactType": "Customer Support",
"telephone": "[+1-602-730-6415]",
"email": "support@bcsauto.com",
"areaServed": "US",
"sameAs": [
"https://www.facebook.com/OfficialBCSAuto",
"https://instagram.com/officialbcsauto",
"https://www.linkedin.com/company/bcsauto"
]
}
]
}
]
}