itemtype必须是完整HTTPS URL且大小写敏感,仅https://schema.org/Person等官方格式有效;须与itemscope成对使用于块级元素;类型需匹配属性,URL须可HTTP访问并返回200。

itemtype必须是完整 HTTPS URL,不能缩写或本地路径
浏览器和 Google Structured Data Testing Tool 会直接拒绝非 HTTPS 协议的 itemtype 值。哪怕只是少一个 s(比如写成 http://schema.org/Person),整个 itemscope 块都会被忽略。
常见错误包括:
-
itemtype="Person"—— 缺少协议和域名,纯字符串无效 -
itemtype="./schema/person"或itemtype="/vocab/Person"—— 相对路径不被接受 -
itemtype="https://schema.org/person"—— 小写person不匹配官方大小写,解析失败
✅ 正确写法只有一种:itemtype="https://schema.org/Person"(注意大小写、完整协议、无尾部斜杠)
itemtype必须配合 itemscope 使用,且只能出现在外层容器上
itemtype 本身没有独立语义,它只是为 itemscope 所声明的作用域指定类型。单独写 itemtype 不会触发任何行为,也不会影响渲染或 JS。
立即学习“前端免费学习笔记(深入)”;
使用时需注意:
- 必须与
itemscope成对出现在同一标签内:<div itemscope itemtype="https://schema.org/Product"> <li>不能加在 <code><p></p><div class="aritcle_card flexRow"> <div class="artcardd flexRow"> <a class="aritcle_card_img" href="/xiazai/skill13305" title="AgentGen — HTML to PDF & Image"><img src="https://img.php.cn/upload/skill/001/246/273/6adaf20cf0281539.jpg" alt="AgentGen — HTML to PDF & Image" ></a> <div class="aritcle_card_info flexColumn"> <a href="/xiazai/skill13305" title="AgentGen — HTML to PDF & Image">AgentGen — HTML to PDF & Image</a> <p>将 HTML 转换为 PDF 和图片。无需注册,免费版开箱即用(每分钟 1 次请求,含水印)。如需更高频次及去水印……</p> </div> <a href="/xiazai/skill13305" title="AgentGen — HTML to PDF & Image" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span> </a> </div> </div>、<span></span>等内联元素上作“作用域起点”,否则多数解析器不识别 - 推荐复用语义化块级标签,如
<article itemscope itemtype="https://schema.org/BlogPosting"></article>,而非无意义的<div> <li>同一页面多个同类实体(如三篇博客),每个都得有独立的 <code>itemscope itemtype容器,不可共用 - 单篇文章或博客 →
https://schema.org/BlogPosting或https://schema.org/NewsArticle - 电商商品页 →
https://schema.org/Product(不是Offer,后者专指价格动作) - 商家主页 →
https://schema.org/LocalBusiness(注意:必须包含address、telephone等必要嵌套字段才可能触发地图展示) - 活动/讲座 →
https://schema.org/Event(startDate和location是强依赖字段) - 不能用已失效或跳转到 404 的 schema.org 镜像链接
- 不能用内部部署的词汇表地址(如
https://your-site.com/vocab),除非你真部署了可访问的定义页 - 即使页面内容是 HTML(非 JSON-LD),只要返回 200,就满足基础校验
不同业务场景下该选哪个 itemtype URL
选错 itemtype 会导致属性绑定失败。比如用 https://schema.org/Person 却写了 itemprop="price",Google 工具会明确报错:“Property price is not a valid property of Person”。
关键判断依据是你要描述的**主体对象类型**:
查证方式:打开 https://schema.org/ → 搜索目标类型 → 点进详情页看 “Properties” 表格,确认你要用的 itemprop 是否在其中且 Expected Type 匹配。
itemtype URL 必须可 HTTP 访问,返回 200
WHATWG 规范要求 itemtype 值指向的 URL 在 HTTP 层能返回 200 状态码。这不是形式检查——解析器真会发起 HEAD 请求验证。
这意味着:
验证建议:在浏览器地址栏直接打开你写的 itemtype URL,确认能加载成功。再用 Google Rich Results Test 实时检测,它比本地调试更接近真实爬虫行为。


















