Schema.org 是一项社区协作活动,其使命是“创建、维护和促进 Internet、网页、电子邮件消息等互联网应用的结构化数据的词汇表”,旨在帮助实现“语义网”的长期愿景。网站管理员使用此共享词汇表来构建其网站上的元数据,并帮助搜索引擎理解已发布的内容,这种技术称为搜索引擎优化。
Schema.org 词汇表由 Google, Microsoft, Yahoo 和 Yandex 共同创建,因此包括 Google, Bing, Yahoo! 和 Yandex 在内的搜索引擎都会依据这些标记来优化搜索结果,让人们更容易找到正确的网页。
Schema.org 基于 RDF,有许多针对 RDF 的语法格式。后来开发者实现了在 HTML 中表示 RDF,因此为了提供灵活性,Schema.org 支持 3 种不同的表示选项:Microdata、RDFa Lite 和 JSON-LD。
示例
RDFa
<main vocab="http://schema.org/" typeof="Organization">
<h1 property="name">Geo Book Club</h1>
<div property="member" typeof="Person" resource="ang">
Founding member <span property="name">Alice Ng</span> welcomes you!
</div>
<div property="event" typeof="Event" resource="GBC_mtg_2">
Please join us for our next meeting where we shall discuss the novel
<span property="about" typeof="Book">
<u property="name">Things Fall Apart</u> by
<a property="author" typeof="Person" href="http://enwp.org/Chinua_Achebe">
<span property="name">Chinua Achebe</span>
</a> (ISBN: <span property="isbn">9780393932195</span>)
</span>
<img property="image" src="TFA_cover.jpg">
</div>
We hope you've been able to attend our past meetings
<ul>
<li property="event" typeof="Event" resource="GBC_mtg_1">
…
</li>
</ul>
</main>
Microdata
<main itemscope itemtype="http://schema.org/Organization">
<h1 itemprop="name">Geo Book Club</h1>
<div itemscope itemprop="member" itemtype="http://schema.org/Person" id="ang">
Founding member <span itemprop="name">Alice Ng</span> welcomes you!
</div>
<div itemprop="event" itemscope itemtype="http://schema.org/Event" id="GBC_mtg_2">
Please join us for our next meeting where we shall discuss the novel
<span itemprop="about" itemscope itemtype="http://schema.org/Book">
<u itemprop="name">Things Fall Apart</u> by
<a itemprop="author" itemscope itemtype="http://schema.org/Person" href="http://enwp.org/Chinua_Achebe">
<span itemprop="name">Chinua Achebe</span>
</a> (ISBN: <span itemprop="isbn">9780393932195</span>)
</span>
<img itemprop="image" src="TFA_cover.jpg">
</div>
We hope you've been able to attend our past meetings
<ul>
<li itemprop="event" itemscope itemtype="http://schema.org/Event" id="GBC_mtg_1">
…
</li>
</ul>
</main>
JSON-LD
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Organization",
"name" : "Geo Book Club",
"member" : [{
"@type" : "Person",
"@id" : "ang",
"name" : "Alice Ng"
}],
"event" : [{
"@type" :"Event",
"@id" : "GBC_mtg_2",
"about" : {
"@type" :"Book",
"name" : "Things Fall Apart",
"isbn" : "9780393932195",
"author" : {
"@id" : "http://enwp.org/Chinua_Achebe",
"@type" : "Person",
"name" : "Chinua Achebe"
},
"image" : {
"@id" : "TFA_cover.jpg"
}
}
},{
"@type" : "Event",
"@id" : "GBC_mtg_1"
}]
}
</script>
评论