如何将 SiteNavigationElement 和页脚添加到 JSON-LD?

How can I add SiteNavigationElement and footer into JSON-LD?

我想为我的主页构建 JSON-LD。在我的页面中,我有:

  1. header
  2. 导航(2系列)
  3. 边栏(包含 2 个项目列表)
  4. 一个主要项目列表
  5. 页脚

我尝试像这样构建 JSON-LD:

<script type="application/ld+json">
[
{
    "@context": "http://schema.org",
    "@type": "WebSite",
    .
    .
    .
},
{
    "@context": "http://schema.org",
    "@type": "WebPage",
    "mainEntity":{
         "@type": "ItemList",
          "itemListElement":[
           {
               "@type": "BlogPosting",
               .
               .// 4- one list of main items
               .
           }
           ...
           ]
    }
    .
    .
    .
}]
</script>

如果我的结构是真的,

  1. 如何向此 JSON object 添加 SiteNavigationElement 和边栏内容?我必须添加另一个 object 还是可以将其插入 WebPage

  2. 我用JSON-LD。我也需要使用微数据吗?或者 JSON-LD 够了吗?

  3. 我为所有菜单和项目创建了一个完整的 sitemap-index.xml。我真的需要在 JSON-LD 中添加 SiteNavigationElement(以及 mainEntity 之外的其他内容)吗?

(您可以用 Microdata 做的所有事情也可以用 JSON-LD 完成,反之亦然。所以没有必要混合使用。可能会有消费者对某些功能只支持一种语法,不过。)

您可以将 SiteNavigationElementhasPart 属性 添加到 WebPage:

{
  "@context": "http://schema.org",
  "@type": "WebPage",
  "hasPart": 
  {
    "@type": "SiteNavigationElement"
  }
}

但使用 SiteNavigationElement(和另一个 WebPageElement types) is ,因此您可能要考虑省略它。