一个页面中有多个JSON-LD标记组

wky*_*yip 12 html5 schema.org json-ld

我可以在同一页面中使用多个JSON-LD组(使用Schema.org)吗?

如果我不能,如何将它们组合在一起?我对语法不太熟悉.

第1组:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "LocalBusiness",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "3102 Highway 98",
    "addressRegion": "FL",
    "addressLocality": "Mexico Beach",
    "postalCode": "45252",
    "addressCountry": "US",
  },
  "geo": {
    "@type": "GeoCoordinates",
    "latitude": "40.75",
    "longitude": "73.98"
  },
  "name": "Beachwalk Beachwear & Giftware",
  "telephone": "850-648-4200",
  "email": "admin@example.com",
  "faxNumber": "860-562-4250",

}
</script>
Run Code Online (Sandbox Code Playgroud)

第2组:

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "Organization",
    "url": "http://example.com",
    "name": "My Domain Title",
    "logo": "http://example.com/wp-content/uploads/2015/08/abc.jpg",
    "contactPoint": [
        {
            "@type": "ContactPoint",
            "telephone": "0192-39192130",
            "contactType": "customer service"
        },
        {
            "@type": "ContactPoint",
            "telephone": "0182-239120398",
            "contactType": "customer service"
        }
    ],
    "sameAs": [
        "http://facebook.com/myfbaccount",
        "http://twitter.com/mytwitteraccount"
    ]
}
</script>
Run Code Online (Sandbox Code Playgroud)

Mar*_*ler 11

您可以在页面上拥有多个脚本块,也可以将它组合在一个块中.将它们组合成单个块的最简单方法是使用@graph关键字,如下所示:

<script type="application/ld+json">
{
  "@graph": [
    { ... your first JSON-LD block ... },
    { ... your second JSON-LD block ... }
  ]
}
</script>
Run Code Online (Sandbox Code Playgroud)