itemtype必须与itemscope成对出现在同一元素上才生效,单独使用无效;值必须为https://schema.org/下完整HTTPS URL(如https://schema.org/Book),简写或HTTP协议均错误。

itemtype 属性必须配合 itemscope 使用才生效
单独写 itemtype 没有任何结构化数据效果,浏览器和搜索引擎根本不会识别。它必须和 itemscope 成对出现,且 itemscope 要放在同一元素或其父元素上。
常见错误是只加 itemtype 却漏掉 itemscope,结果验证工具(如 Google Rich Results Test)直接报“Missing field ‘@context’”或“no structured data detected”。
-
<div itemtype="https://schema.org/Book">...</div>→ 无效 -
<div itemscope itemtype="https://schema.org/Book">...</div>→ 有效 - 也可以用嵌套:
<section itemscope><div itemtype="https://schema.org/Movie">...</div></section>→ 合法,但不推荐,语义易混乱
itemtype 的值只能是 Schema.org 等权威词汇表的完整 URL
不能简写成 itemtype="Book" 或 itemtype="schema:Book",必须用带协议的绝对 URL,例如 https://schema.org/Book。这是 RDFa 规范强制要求的,否则解析器无法唯一标识类型。
注意:虽然 http://schema.org/Book 在旧页面中仍被部分工具兼容,但所有新项目必须用 https。Google 明确表示未来会逐步弃用 HTTP 版本。
立即学习“前端免费学习笔记(深入)”;
htmlq 是一个命令行工具,使用 CSS 选择器从 HTML 中提取内容,相当于 jq 的 HTML 版本。该工具使用 Rust 编写,允许你通过 CSS 选择器将 HTML 管道化,直接从终端提取文本、属性和结构化内容。
- ✅ 正确:
itemtype="https://schema.org/Person" - ❌ 错误:
itemtype="Person"、itemtype="schema.org/Person"、itemtype="http://schema.org/Person" - 多个类型?不支持空格或逗号分隔;如需多类型,改用
@typeJSON-LD 更稳妥
集合类场景优先用 schema.org/ItemList 或 schema.org/CollectionPage
想标记“一组文章”“商品列表”“播放列表”这类聚合内容,别硬套 itemtype="https://schema.org/WebPage" —— 它描述单页,不是集合。要用专门设计的集合类型。
ItemList 适合有序列表(如搜索结果、分页文章),CollectionPage 更适合展示型合集(如“2024 年推荐书单”专题页)。两者都要求用 itemprop="itemListElement" 标记每个子项,并指定顺序(itemprop="position")。
- 用
ItemList时,每个子项需有itemscope+ 对应类型,例如:<li itemscope itemtype="https://schema.org/Article"> <meta itemprop="position" content="1">...</li> -
itemprop="itemListElement"必须出现在父容器上,不能只加在子项里 - 验证时若看到 “The itemListElement field is missing”,大概率是父容器漏了
itemprop="itemListElement"
itemtype 不解决嵌套深度与重复属性问题
很多人以为加了 itemtype="https://schema.org/Recipe" 就自动能提取所有字段——其实不行。每个具体属性(如 name、cookTime)仍需显式用 itemprop 标注,且必须符合该类型的属性定义。
更隐蔽的坑是嵌套:比如 Recipe 里的 nutrition 是 NutritionInformation 类型,你得再开一层 itemscope itemtype="https://schema.org/NutritionInformation",并在里面标 itemprop="calories" 等。漏掉这层,calories 就会被当成 Recipe 的直接属性,而 Schema.org 规定它不属于 Recipe 直接属性,校验会失败。
- Recipe 下的
recipeIngredient是文本数组,不用嵌套 scope;但nutrition、video、author这些对象型属性必须新开itemscope - 同一个
itemprop名称在不同itemtype下含义不同(如url在Person和WebPage中指向不同资源),别复用错上下文 - 浏览器不解析也不渲染
itemtype,它纯为机器读取;调试靠 Structured Data Testing Tool 或 Google Rich Results Test
itemprop 的归属关系没理清——尤其是 itemListElement 该挂在哪、position 为什么必须是 <meta> 而不是 <span></span>。这些细节不满足,整个集合就退化成一堆孤立的 item,失去“集合”语义。


















