2015-08-20 67 views
0

我需要組合兩組JSON-LD,以便它們位於同一頁面上。無論是個人還是當地企業。目標並不一定與2相關,但它們一起出現。如何合併2個JSON-LD模式類型?

下面是組#1:

<script type="application/ld+json"> 
{ 
    "@context": "http://schema.org", 
    "@type": "Person", 
    "name": "John Doe", 
    "jobTitle": "Graduate research assistant", 
    "affiliation": "University of Dreams", 
    "additionalName": "Johnny", 
    "url": "http://www.example.com", 
    "address": { 
    "@type": "PostalAddress", 
    "streetAddress": "1234 Peach Drive", 
    "addressLocality": "Wonderland", 
    "addressRegion": "Georgia" 
    } 
} 
</script> 

下面是組#2:

<script type="application/ld+json"> 
{ 
    "@context": "http://schema.org", 
    "@type": "Restaurant", 
    "address": { 
    "@type": "PostalAddress", 
    "addressLocality": "Sunnyvale", 
    "addressRegion": "CA", 
    "postalCode": "94086", 
    "streetAddress": "1901 Lemur Ave" 
    }, 
    "aggregateRating": { 
    "@type": "AggregateRating", 
    "ratingValue": "4", 
    "reviewCount": "250" 
    }, 
    "name": "GreatFood", 
    "openingHours": [ 
    "Mo-Sa 11:00-14:30", 
    "Mo-Th 17:00-21:30", 
    "Fr-Sa 17:00-22:00" 
    ], 
    "priceRange": "$$", 
    "servesCuisine": [ 
    "Middle Eastern", 
    "Mediterranean" 
    ], 
    "telephone": "(408) 714-1489", 
    "url": "http://www.dishdash.com" 
} 
</script> 

眼下組#1和使用Google's Structured Data Testing Tool組#2驗證單獨

Group 1

Group 2

試圖將這些組合在一起,只有頂部組驗證。另一個不顯示。

Combined

幫助!這兩個組怎麼可以組合在正確的方式?

回答

2

是在acBoth可以嵌套一個http://schema.org/WebPage內,mainEntity可以設置爲的人,mentions可以設置爲餐廳。

這個人和餐廳之間可能會有一些更合適的關係,例如,人可能是關於餐廳的WebPage的作者,或者是WebPage的accountablePerson,在餐廳吃過行動),是一名員工,創始人,或對其進行審覈。

1
<script type="application/ld+json"> 
{ 
    "@context": "http://schema.org", 
    "@type": ["ItemList", "CreativeWork"], 
    "name": "Top 5 covers of Bob Dylan Songs", 
    "author": "John Doe", 
    "about": { 
    "@type": "MusicRecording", 
    "byArtist": { 
     "@type": "MusicGroup", 
     "name": "Bob Dylan" 
    } 
    },