2017-06-22 38 views
1

我已經看到了這個問題的另一個類似的問題,但沒有接受正確的答案或例子。 我應該在這個元素的格式是什麼? 的BreadcrumbList是有據可查的,幷包含列表,而不是SiteNavigationElement。架構SiteNavigationElement爲JSON-LD結構化數據

<script type="application/ld+json"> 
    { 
    "@context": "https://schema.org", 
    "@type": "SiteNavigationElement", 
    "@graph": [ 
     { 
     "@type": "ListItem", 
     "position": 1, 
     "item": { 
      "@id": "http://www.example.com/", 
      "url": "http://www.example.com/", 
      "name": "Home" 
      } 
     }, 
     { 
     "@type": "ListItem", 
     "position": 2, 
     "item": { 
      "@id": "http://www.example.com/contact.html", 
      "url": "http://www.example.com/contact.html", 
      "name": "Contact" 
      } 
     }, 
    ] 
    } 
    </script> 

UPDATE:

被玩弄,並拿出一些作品。但它的結構是否正確?

<script type="application/ld+json"> 
//<![CDATA[ 
{ 
"@context": "https:\/\/schema.org\/", 
"@type": "SiteNavigationElement", 
"headline": "Headline for Site Navigation", 
"name": [ 
    "Home", 
    "Tours", 
    "Transfers", 
    "Taxis", 
    "Contact" 
    ], 
"description": [ 
    "Homes Desc.", 
    "Tours Desc.", 
    "Transfers Desc.", 
    "Taxis Desc.", 
    "Contact Desc." 
    ], 
"url": [ 
    "http://www.example.com/", 
    "http://www.example.com/tours/", 
    "http://www.example.com/transfers/", 
    "http://www.example.com/taxis/", 
    "http://www.example.com/contact.html" 
    ] 
} 
//]]> 
</script> 
+0

這將是鏈接所提到的問題非常有用。當時它[*如何使用JSON-LD創建SiteNavigationElement?*](https://stackoverflow.com/q/37813757/1591669)? – unor

回答

2

我會認爲你SiteNavigationElements應包含在ItemLists,或只包括作爲單獨項目。

例如作爲列表的一部分:

<script type="application/ld+json"> 
{ 
    "@context":"http://schema.org", 
    "@type":"ItemList", 
    "itemListElement":[ 
    { 
     "@type":"SiteNavigationElement", 
     "position":1, 
     "name": "Home", 
     "description": "Homes Desc.", 
     "url":"http://www.example.com/" 
    }, 
    { 
     "@type":"SiteNavigationElement", 
     "position":2, 
     "name": "Tours", 
     "description": "Tours desc.", 
     "url":"http://www.example.com/tours/" 
    }, 

    ...etc 

    ] 
} 
</script> 

然而,僅僅因爲你可以做這並不意味着你應該。檢出this relevant answer

我會認爲你SiteNavigationElement網址應該是內容本身的當前頁面上(而不是它們鏈接到的網頁),這通常是不存在的。