【发布时间】:2018-03-13 05:25:47
【问题描述】:
我是 JSON-LD 的新手,即使经过几个小时的搜索,我仍然无法找到一些问题的明确答案。
我的网站类似于 Wikipedia:它提供有关特定主题的大量信息,包括许多较小的部分、较长的页面等。 页面结构的简单示例:
<article id="animals">
<header>
<h1> 1. Animals </h1>
</header>
<section id="cats">
<h2> 1.1 Cats </h2>
<p> Some information about cats </p>
</section>
<section id="dogs">
<h2> 1.2 Dogs </h2>
<p> Some information about dogs </p>
</section>
</article>
我想使用 JSON-LD 标记每个部分。 以下是我的做法(把不必要的属性放在一边):
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@graph": [
{
"@type": "CreativeWork",
"@id": "http://www.example.com/example/#animals",
"name": "Animals",
"headline": "Animals",
"genre": "http://vocab.getty.edu/aat/300048715",
"url": "http://www.example.com/example/#animals"
},
{
"@type": "CreativeWork",
"@id": "http://www.example.com/example/#cats",
"name": "Cats",
"headline": "Cats",
"genre": "http://vocab.getty.edu/aat/300048715",
"url": "http://www.example.com/example/#cats",
"isPartOf": {
"@type": "CreativeWork",
"@id": "http://www.example.com/example/#animals"
}
}
]
}
</script>
1) 经过数小时的搜索,我还没有真正找到这些部分应该是什么类型。 CreativeWork 适合使用吗? genre 属性使用是否正确?
2) 如何指定节的位置?是否使用url 属性完成?是否可以像本例那样通过指明该部分的id 来完成?
3) 我还注意到,如果像这样标记一个长页面,脚本会变得非常大。应该是这样的吗?
【问题讨论】:
标签: schema.org json-ld