itemtype必须是完整HTTPS URL且严格匹配schema.org官方URI。它需以https://开头、大小写精确、无多余字符,同一元素仅允许一个itemtype,嵌套须用子容器,且itemprop必须符合对应itemtype的属性契约。

itemtype 必须是完整 HTTPS URL,不能省略协议或写错拼写
浏览器和结构化数据验证工具(比如 Google Rich Results Test)会直接拒绝非 HTTPS 的 itemtype 值,哪怕只是少一个 s。它不是“能凑合用就行”的配置项,而是解析器校验的第一关。
- ✅ 正确:
itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937Person" - ❌ 错误:
itemtype="http://schema.org/Person"(HTTP 协议已被主流解析器弃用) - ❌ 错误:
itemtype="schema.org/Person"(缺协议,不是有效 URL) - ❌ 错误:
itemtype="./Person"或itemtype="Person"(不是绝对 URL,无法被外部验证)
验证时如果报 “Invalid itemtype” 或 “URL not reachable”,先用浏览器直接访问该 itemtype 地址——必须返回 HTTP 200 状态码,哪怕页面是 HTML 文档也行;返回 404 或重定向到非 200 页面,就会被判定为无效。
同一个 itemscope 元素只能有一个 itemtype,嵌套要用子容器
itemtype 定义的是当前 itemscope 所描述的实体类型,不是标签集合。你不能在一个元素上叠加多个 itemtype,浏览器只会取第一个,其余全忽略。
- ❌ 错误写法:
<div itemscope itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937Person" itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937LocalBusiness"> - ✅ 正确做法:如果需要表达“某人是某企业的员工”,应在外层声明
Person,再在内部用另一个itemscope声明LocalBusiness,并通过itemprop关联:<div itemprop="worksFor" itemscope itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937LocalBusiness">
这种嵌套不是可选优化,而是 schema.org 类型约束的硬性要求。比如 author 属性值必须是 Person 或 Organization 实体,不能是纯文本字符串——否则 Google 会报 “Missing field ‘author’”。
立即学习“前端免费学习笔记(深入)”;
itemtype 和 itemprop 必须严格匹配 schema.org 类型契约
每个 itemprop 都只在特定 itemtype 下合法。把 itemprop="price" 放在 itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937Person" 里,验证工具会明确提示 “Property price is not a valid property of Person”。
- 价格类(
price、priceCurrency)只在Offer或Product下有效 - 日期类(
datePublished、startDate)只对Article、Event、Course等类型开放 -
itemprop="image"要求值是图片 URL 字符串,不能是<img>标签本身;得用<link itemprop="image" href="...">或<meta itemprop="image" content="...">
这类错误不会影响页面渲染,但会让结构化数据完全失效——搜索引擎看不到你的产品价格、文章发布时间或商家地址。调试时别只看页面是否“显示正常”,一定要跑一遍 Google Rich Results Test。
itemtype URL 大小写敏感,且不能有多余斜杠或空格
itemtype 是精确匹配的 URI,末尾多一个 /、路径里大小写不一致、甚至 URL 中混入不可见 Unicode 字符(如 U+200E),都会导致验证失败。
- ❌ 错误:
itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937person"(小写person不是标准类型) - ❌ 错误:
itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937Product/"(末尾斜杠破坏 URI 等价性) - ❌ 错误:
itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937Product "(中文全角空格藏在末尾,肉眼难见) - ✅ 正确:
itemtype="https://www.php.cn/link/b8eadb229854b2add23d0371cc31b937Product"(严格按 schema.org 官方文档大小写和路径)
最容易被忽略的是复制粘贴带来的隐形字符。建议所有 itemtype 值都从 schema.org 官网 页面手动点击进入具体类型页,再复制地址栏 URL——不要从第三方教程或代码片段里直接拷贝。



















