html - 如何使用微数据元标记将图像添加到事件中?

标签 html microdata

使用微数据,有没有办法通过使用元标记将图像添加到事件中?

在官方 Microdata 站点中,我看到了向事件添加图像的选项:

<img itemprop="image" src="image.jpg" alt="An image"/>

效果很好。但是,我想知道是否可以使用类似的方式添加该图像:

<meta itemprop="image" src="image.jpg"  />

根据我的测试,这是行不通的。

最佳答案

您必须使用 link 元素而不是使用 meta 元素(因为该值是一个 URI):

<link itemprop="image" href="image.jpg" />

这是 required by HTML5 (大胆强调我的):

The meta element represents various kinds of metadata that cannot be expressed using the […] link […] elements.

而且它也是明确的 required by Microdata .

关于html - 如何使用微数据元标记将图像添加到事件中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24638451/

相关文章:

html - 如何在 Markdown 表中编写列表?

html - 无法在 SCSS 中设置链接样式

seo - 验证错误 : "The itemprop attribute was specified, but the element is not a property of any item"

schema.org - 是否有微数据标签来指定值是数字、字符串还是 bool 值?

schema.org - 对于 LocalBusiness、Place 或 Organization,我应该基于哪些 Schema.org 标签?

javascript - 需要右对齐 Bootstrap Navbar 但左对齐它的子菜单

html - 在调整大小时,我缺少什么来阻止我的图像崩溃?

html - HTML 标签属性内的 Svelte+TS 类型声明

vue.js - 向 Vuetify 标签添加自定义属性

schema.org - 谷歌 SDTT : "The property ' availability' is not recognized by Google for an object of type Product"