json-ld 的 breadcrumblist 必须置于 type="application/ld+json" 的 script 标签内,position 须从1开始连续整数递增,item 必为绝对 url 且与 canonical 一致,多语言需按 hreflang 分别部署独立 json-ld 块。

JSON-LD 的 BreadcrumbList 必须写在 <script type="application/ld+json"></script> 里
直接把 JSON-LD 写在 HTML body 任意位置是无效的,搜索引擎只认 <script></script> 标签且 type 必须严格为 "application/ld+json"。常见错误是写成 text/json、application/json 或漏掉 type 属性,导致结构化数据完全不被识别。
正确写法示例:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "首页",
"item": "https://example.com/"
},
{
"@type": "ListItem",
"position": 2,
"name": "分类页",
"item": "https://example.com/category/"
},
{
"@type": "ListItem",
"position": 3,
"name": "文章标题",
"item": "https://example.com/category/article-123.html"
}
]
}
</script>
position 必须从 1 开始连续递增,不能跳号或重复
Google 和 Bing 都要求 itemListElement 中每个 ListItem 的 position 是严格递增的正整数序列。写成 0, 1, 2 或 1, 3, 4 或两个 position: 1 都会导致解析失败或部分项被忽略。
-
position值必须是整数(不是字符串) - 顺序必须和用户实际浏览路径一致:最左是顶层,最右是当前页
- 动态生成时注意模板变量不要意外输出空格或换行破坏 JSON 格式
当前页的 item 可以省略,但推荐保留完整 URL
Schema.org 规范允许当前页的 item 字段为空(即只写 name),但 Google 搜索文档明确建议提供可访问的 URL。省略后可能影响富媒体搜索结果中的链接跳转行为。
关键点:
- 所有
item值必须是绝对 URL(含协议和域名),相对路径如/category/不被支持 - 当前页 URL 应与
<link rel="canonical">一致,避免规范性冲突 - 如果页面使用 hash 路由(如
#about),item仍应指向服务端真实 URL,而非带 hash 的前端路由地址
多语言站点要按 hreflang 分别注入,不能混在一个 JSON-LD 块里
一个 <script type="application/ld+json"></script> 块只能描述一种语言版本的面包屑路径。如果你的页面通过 hreflang 提供 en-US、zh-CN 等多个语言变体,每种语言都需独立的 JSON-LD 块,并确保其中 name 和 item URL 与对应语言页面匹配。
容易被忽略的是:item URL 必须指向该语言版本的实际页面(例如 https://example.com/en/product/),而不是自动跳转的默认语言页。否则结构化数据会和页面语言声明矛盾,降低可信度。
前端入门到VUE实战笔记:立即使用
在学习笔记中,你将探索 前端 的入门与实战技巧!











