# JSON-LD 教程

URL: https://caijiao.org/json-ld/
Source: docs/json-ld/index.md
Description: 系统学习 JSON-LD 的语法、上下文、Schema.org 结构化数据、SEO 应用、验证排错与生产实践，帮助你把普通 JSON 转化为可互联的语义数据。

JSON-LD 是一种基于 JSON 的链接数据格式。它让数据保持 JSON 的可读性，同时通过 `@context`、`@id`、`@type` 等约定说明字段含义、实体身份和实体关系。

本教程面向前端开发、内容站点、SEO、知识图谱和 API 设计场景。你将从一个能直接放进 HTML 的示例开始，逐步理解上下文、IRI、Schema.org、验证流程和生产维护方式。

## 你会学到什么

| 模块 | 重点 |
| --- | --- |
| 基础入门 | JSON-LD 与普通 JSON、RDF、结构化数据之间的关系 |
| 语法模型 | `@context`、`@type`、`@id`、`@value`、`@graph` 等核心关键字 |
| Web 应用 | 在 HTML 中嵌入 `application/ld+json`，为搜索引擎和消费方提供结构化信息 |
| 生产实践 | 数据与页面一致性、稳定 ID、远程上下文、验证和排错 |
| 参考资料 | 常用关键字、Schema.org 类型、Google Search 富媒体结果注意事项 |

## 第一个示例

```html
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "JSON-LD 入门指南",
  "datePublished": "2026-09-22",
  "author": {
    "@type": "Person",
    "name": "Ada Chen"
  }
}
</script>
```

这段数据不会改变页面视觉内容，但机器可以据此知道：页面描述的是一篇文章，文章有标题、发布时间和作者。

## 学习路线

1. 先阅读 [JSON-LD 简介](/json-ld/guide/introduction)，理解它解决的问题。
2. 跟着 [快速开始](/json-ld/guide/getting-started) 把结构化数据放到页面中。
3. 通过 [语法基础](/json-ld/guide/syntax) 和 [上下文与词汇表](/json-ld/guide/context) 掌握核心模型。
4. 如果目标是搜索展示，重点阅读 [Schema.org 与 SEO](/json-ld/guide/schema-org-seo)。
5. 上线前使用 [最佳实践](/json-ld/guide/best-practices) 和 [常见问题排查](/json-ld/guide/troubleshooting) 做检查。

## 参考资料

- [W3C JSON-LD 1.1 Recommendation](https://www.w3.org/TR/json-ld11/)
- [JSON-LD.org](https://json-ld.org/)
- [JSON-LD Playground](https://json-ld.org/playground/)
- [Schema.org](https://schema.org/)
- [Google Search Central: 结构化数据简介](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data)
