我想为我的主页构建JSON-LD。在我的页面中,我有:
我尝试像这样构建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>
如果我的结构是真的,
如何将SiteNavigationElement
和侧边栏内容添加到此JSON对象?我是否必须添加其他对象,或者我可以将其插入WebPage
?
我使用的是JSON-LD。我是否也需要使用Microdata?或者JSON-LD足够吗?
我为所有菜单和项目创建了一个完整的sitemap-index.xml。我是否真的需要在JSON-LD中添加SiteNavigationElement
(以及除mainEntity
之外的其他内容?)
答案 0 :(得分:1)
(使用Microdata可以做的一切也可以用JSON-LD完成,反之亦然。所以没有必要混合。但是可能有消费者只支持某种功能的一种语法。)
您可以将SiteNavigationElement
WebPage
属性添加到{
"@context": "http://schema.org",
"@type": "WebPage",
"hasPart":
{
"@type": "SiteNavigationElement"
}
}
:
SiteNavigationElement
但使用{{1}}(以及其他hasPart
类型)是WebPageElement
,因此您可能需要考虑省略它。