web网页结构化数据

Google Search 文档里提到:为网页添加一些附加信息,使得搜索引擎更加了解你的页面,从而在搜索结果里有更丰富的展示

Learn how content appears in Google Search | Search | Google Developers


结构化数据

上面所谓的附加信息就是指结构化数据

Understand how structured data works | Search | Google Developers

Google 会用网页上的结构化数据来理解网页内容,并搜集网页信息及关联网页的信息。

下面的例子是一个 JSON-LD 格式的结构化数据,出现在 Unlimited Ball Bearings 这家公司的页面里,描述了这家公司的联系方式:

1
2
3
4
5
6
7
8
9
10
11
12
13
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "http://www.example.com",
"name": "Unlimited Ball Bearings Corp.",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-401-555-1212",
"contactType": "Customer service"
}
}
</script>

结构化数据的「格式」

JSON-LD

Microdata

RDFa

Google 推荐使用 JSON-LD 格式的结构化数据


JSON-LD

Json ld 簡介

JSON 格式的 Linked Data

Linked Data:关联数据(关联资料),把电脑看得懂的、有意义的资源连接起来

1
2
3
4
5
6
7
{
“@context”: “https://json-ld.org/contexts/person.jsonld“,
“@id”: “http://dbpedia.org/resource/John_Lennon“,
“name”: “John Lennon”,
“born”: “1940-10-09”,
“spouse”: “http://dbpedia.org/resource/Cynthia_Lennon“
}

代码里已经是成熟的方式了

  1. 原始的格式 可以写成「一个具体的类型对应一个值」:”http://schema.org/name”: “John Lennon”
  2. 定义一个上下文 @context,这样就不用一直带着类型的 url 了:

    1
    2
    3
    @context: {
    Person:"http://xmlns.com/foaf/0.1/Person",
    name:"http://xmlns.com/foaf/0.1/name",
  3. 甚至可以在 @context 里使用一个现成的上下文

这个现成的上下文,就是 Home - schema.org 词汇表


Schema.org

由 Google,Microsoft,Yahoo 和 Yandex 创建

Full Hierarchy - schema.org

TouristAttraction , 用来描述一个景点:

1
2
3
4
5
6
7
8
9
10
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "TouristAttraction",
"name": "Hyde Park",
"description": "It's one of nine royal parks of London.",
"url": "http://www.royalparks.org.uk/parks/hyde-park",
"isAccessibleForFree": true
}
</script>

通过 schema.org 词汇表,我们可以构造与业务相关的结构化数据,告诉搜索引擎我们在干嘛,从而提高 SEO ,获取更精准的流量

如果业务与 Google 提供的几个特定的词汇相关的话,还可以实现搜索结果增强的效果 (Article | Search | Google Developers


Google 提供的结构化数据测试工具

原文作者: dgb8901,yinxing

原文链接: https://www.itwork.club/2019/03/28/web-structured-data/

版权声明: 转载请注明出处

为您推荐

体验小程序「简易记账」

关注公众号「特想学英语」

sass 引用上级元素