itemtype必须使用完整HTTPS Schema.org URL,如itemtype="https://schema.org/Product";itemscope与itemtype须同元素出现;多实体需分层嵌套独立scope;itemprop值需匹配类型规范,日期用<time>、数值去单位、URL用绝对路径。

itemtype 必须是有效的 Schema.org URL
直接写 itemtype="Product" 会失效——浏览器不认缩写,必须用完整 HTTPS URL。常见错误是复制了 Google Structured Data Testing Tool 里简写的提示,但 HTML 解析器只按规范校验 URI 格式。
正确写法只有这一种:itemtype="https://schema.org/Product"(注意是 https,不是 http;末尾不加斜杠)。
其他常见类型同理:
itemtype="https://schema.org/Person"itemtype="https://schema.org/Article"itemtype="https://schema.org/LocalBusiness"
itemscope 和 itemtype 必须在同一元素上同时出现
不能把 itemscope 放父容器、itemtype 放子元素,也不能拆开写在两个标签上。microdata 解析器只认「同一 DOM 节点同时携带这两个属性」才启动类型识别。
立即学习“前端免费学习笔记(深入)”;
错误示例:
<div itemscope> <div itemtype="https://schema.org/Person">...</div> </div>——这会被忽略,因为
itemtype 所在节点没有 itemscope。
正确写法:
<div itemscope itemtype="https://schema.org/Person"> <span itemprop="name">张三</span> </div>
嵌套结构要靠多层 itemscope + itemtype 拆解
一个页面常含多个实体(比如文章页有 Article,作者是 Person,发布机构是 Organization),不能指望单个 itemtype 描述全部关系。
必须显式为每个实体创建独立 scope:
- 外层
<article itemscope itemtype="https://schema.org/Article"> - 内部作者区域:
<div itemscope itemtype="https://schema.org/Person"> - 内部机构区域:
<div itemscope itemtype="https://schema.org/Organization">
此时 itemprop="author" 才能正确关联到内层 Person scope,而不是模糊指向整个页面。
itemprop 值类型不匹配时,搜索引擎可能静默丢弃字段
比如 itemtype="https://schema.org/Event" 下写了 itemprop="startDate" content="2024-05-20",看似没问题,但如果漏掉 content 属性、又没用 <time> 标签包裹,而只是 <span itemprop="startDate">2024年5月20日</span>,Google 可能无法解析出有效日期,直接跳过该字段。
关键原则:
- 日期/时间优先用
<time datetime="..."> - 数值类(如
ratingValue)避免带单位文字,写content="4.5" - URL 类属性(如
image、url)必须指向可访问的绝对路径
验证是否生效,最简单是贴 HTML 到 Google Rich Results Test,别依赖肉眼检查属性名拼写——大小写敏感,且 jobTitle 和 jobtitle 是两个不同属性。



















