itemtype必须是完整https绝对url且与itemscope成对使用,因其仅指向schema.org等词汇表的语义定义,缺协议、错协议、无itemscope或大小写错误均导致解析失败。

itemtype 本身不声明类型,它只是指向一个已定义的词汇表 URL —— 真正的“类型”由该 URL 所在的 Schema.org(或其他微数据词汇表)文档约定,浏览器和搜索引擎只认这个地址。
为什么 itemtype 必须是完整 URL
HTML 规范强制要求 itemtype 的值必须是绝对 URL(如 https://schema.org/Person),不能是缩写、别名或相对路径。这是因为微数据解析器靠这个 URL 去唯一标识语义含义,类似“身份证号”,拼错、省略协议或用 schema.org/Person(缺 https://)都会导致解析失败。
- ✅ 正确:
itemtype="https://schema.org/Person" - ❌ 错误:
itemtype="schema.org/Person"(缺协议,不是绝对 URL) - ❌ 错误:
itemtype="Person"(纯字符串,无语义锚点) - ❌ 错误:
itemtype="http://schema.org/Person"(HTTP 已被主流搜索引擎拒绝识别)
itemtype 和 itemscope 必须成对出现
单独写 itemtype 没有效果 —— 它必须和 itemscope 同时加在同一个元素上,否则解析器不会启动微数据提取流程。
<div itemscope itemtype="https://schema.org/Restaurant"> <h1>老张面馆</h1> <span itemprop="address">北京市朝阳区建国路1号</span> </div>
如果漏掉 itemscope,即使写了 itemtype,所有 itemprop 都会被忽略。
常见类型 URL 要用最新 Schema.org 地址
Schema.org 在 2023 年后全面弃用 http://,且不再支持旧版短域名(如 data-vocabulary.org 已停用)。目前唯一可靠的是:
使用 PptxGenJS 和 Python 解析,将结构化的 HTML/CSS 幻灯片内容转换为原生、可编辑的 PowerPoint(.pptx)演示文稿。
https://schema.org/Personhttps://schema.org/Articlehttps://schema.org/LocalBusinesshttps://schema.org/Event
注意大小写敏感:https://schema.org/article(小写)无效;https://schema.org/Recipe 有效,但 https://schema.org/recipe 不行。
嵌套结构中每个 itemtype 都要独立声明
微数据不支持“继承”或“默认类型”。子元素若要表达不同语义,必须显式加自己的 itemscope + itemtype。
<div itemscope itemtype="https://schema.org/Restaurant">
<span itemprop="name">老张面馆</span>
<div itemscope itemtype="https://schema.org/PostalAddress">
<span itemprop="streetAddress">建国路1号</span>
</div>
</div>
这里内层 div 的 itemtype 不是可选的 —— 即使它在 Restaurant 内部,也必须明确声明为 https://schema.org/PostalAddress,否则 streetAddress 属性无法被正确归类。
最容易被忽略的一点:验证工具(如 Google Rich Results Test)报“未检测到结构化数据”,往往不是因为属性写错了,而是最外层漏了 itemscope,或者 itemtype 的 URL 少了 https://。这两个地方一错,整个微数据块就静默失效。
前端入门到VUE实战笔记:立即使用
在学习笔记中,你将探索 前端 的入门与实战技巧!










