谷歌结构化数据测试工具错误

时间:2016-01-07 21:58:33

标签: javascript seo schema markup schema.org

<script type="application/ld+json">
{"@context" : "http://schema.org",
  "@type" : "LocalBusiness",
  "name" : "website.com",
  "description": "About. asdadsad ",
  "image" : "http://website.com/image.png",
  "telephone" : "123456789",
  "email" : "mail@com",
  "address" : {
      "@type" : "PostalAddress",
      "streetAddress" : "N1 Big street",
      "addressLocality" : "city",
      "addressCountry" : "Country"
},
  "url" : "http://somesite.com/",
   "sameAs" : ["http://www.facebook.com/",
   "http://twitter.com",
   "http://plus.google.com/"],
   "aggregateRating" : {
       "@type" : "AggregateRating",
       "ratingValue" : "4",
       "bestRating" : "5",
       "worstRating" : "0"
},
</script>

这是我为web架构创建的代码,但是当我尝试在ASM上进行测试时,它会返回错误:

  

JSON-LD:解析你的JSON-LD时出错。

我该如何解决这个问题?我在这段代码中有哪些错误?

1 个答案:

答案 0 :(得分:1)

您的JSON最后缺少结束括号}

你的上一个}正在关闭aggregateRating礼仪,你无法关闭你的对象。

只需添加}即可。

PS:您的AggregateRating对象缺少ratingCountreviewCount

以下是您的代码的固定版本:

<script type="application/ld+json">
{
  "@context" : "http://schema.org",
  "@type" : "LocalBusiness",
  "name" : "website.com",
  "description": "About. asdadsad ",
  "image" : "http://website.com/image.png",
  "telephone" : "123456789",
  "email" : "mail@com",
  "address" : {
    "@type" : "PostalAddress",
    "streetAddress" : "N1 Big street",
    "addressLocality" : "city",
    "addressCountry" : "Country"
  },
  "url" : "http://somesite.com/",
  "sameAs" : [
    "http://www.facebook.com/",
    "http://twitter.com",
    "http://plus.google.com/"
  ],
  "aggregateRating" : {
    "@type" : "AggregateRating",
    "ratingValue" : 4,
    "bestRating" : 5,
    "worstRating" : 0,
    "ratingCount" : 12
  }
}
</script>