itemtype必须是完整HTTPS URL且与itemscope成对使用,如https://schema.org/Article;缩写、斜杠、协议错误或大小写错误均导致微数据失效,嵌套实体也需独立声明itemscope和itemtype。

itemtype 必须是完整 HTTPS URL,不能缩写或拼错
itemtype 不是随便写的字符串,它本质是一个契约地址——告诉解析器“这个容器里描述的是 schema.org 上哪一类实体”。写成 Product、https://schema.org/Product/(末尾斜杠)、http://schema.org/Product(HTTP 协议)或大小写错误如 https://schema.org/product,都会导致整个微数据块被忽略。
常见有效值示例:https://schema.org/Article、https://schema.org/LocalBusiness、https://schema.org/Recipe。必须逐字复制官网文档中的 URL,不能靠记忆手敲。
itemtype 必须与 itemscope 成对出现,且只能在容器元素上声明
itemscope 和 itemtype 是绑定关系:没有 itemscope,itemtype 就是无效属性;反过来,只写 itemscope 不配 itemtype,搜索引擎也认不出这是什么类型的数据。
- ✅ 正确:
<article itemscope itemtype="https://schema.org/Article">...</article> - ❌ 错误:
<div itemtype="https://schema.org/Article">...</div>(缺itemscope) - ❌ 错误:
<span itemscope>...</span>(缺itemtype) - ❌ 错误:
<p itemscope itemtype="https://schema.org/Article">...</p>(<p></p>通常不含子结构,语义承载力弱,易被工具警告)
itemtype 决定哪些 itemprop 值合法
同一个 itemprop 名称,在不同 itemtype 下可能完全不被接受。比如:
生成可在 deepbi 沙箱 iframe 内运行或作为独立文件运行的交互式 HTML 页面,使用 `window.deepbi` JS SDK 实现数据查询、空间管理、文件浏览及用户操作。当用户提出以下需求时启用该能力: - 创建 KPI 仪表盘、数据表格、文件浏览器、成员列表、管理页面; - 明确要求“转成 dhtml”、“转译成 HTML”、“把 XX 页面转成……”、“控制台页面”、“管理后台”、“DeepBI 页面迁移”; - 提及位于 `apps/console/src/featur
立即学习“前端免费学习笔记(深入)”;
-
itemprop="price"只在itemtype="https://schema.org/Offer"或https://schema.org/Product下有效 -
itemprop="startDate"只在https://schema.org/Event或https://schema.org/Course下有效 -
itemprop="logo"在https://schema.org/Organization下合法,但在https://schema.org/Person下会报错
Google 的 Rich Results Test 工具会明确提示 “Property X is not a valid property of Y”——这就是 itemtype 类型约束在起作用。
嵌套时每个子对象都要有自己的 itemscope + itemtype
当一个属性本身是另一个实体(比如作者、地址、评论),不能只靠父级 itemprop 指向文字,必须显式声明子作用域:
- ✅ 正确:
<div itemprop="author" itemscope itemtype="https://schema.org/Person"><span itemprop="name">张三</span></div> - ❌ 错误:
<div itemprop="author"><div itemscope itemtype="https://schema.org/Person">张三</div></div>(itemprop="author"没绑定到任何itemscope)
这种嵌套不是可选优化,而是协议强制要求:每个实体都需独立的类型声明,否则解析器无法建立对象图谱。
最容易被忽略的一点是:itemtype 的 URL 必须能被机器访问(哪怕只是存在),且不能被 CDN 或防火墙拦截——有些内网部署环境会屏蔽外部 HTTPS 请求,导致 Google 工具校验失败,但错误提示却只显示“未检测到结构化数据”,实际卡在 URL 解析环节。


















