如何使用Microdata元标记将事件添加到事件中? [英] How to add an image to an event with Microdata meta tag?

查看:119
本文介绍了如何使用Microdata元标记将事件添加到事件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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

 < img itemprop =imagesrc =image.jpgalt =图片/> 

这很好。然而,我想知道是否有可能通过使用类似的东西来添加图片:

 < meta itemprop =imagesrc =image.jpg/> 

根据我的测试结果无效。

解决方案

而不是使用 meta 元素,您必须使用链接元素(因为这个值是一个URI):

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

这是 HTML5要求(大胆强调我的):


meta 元素表示不能使用链接表示的各种元数据

它也明确地表示 Microdata要求


Using microdata, is there a way to add an image into an Event by using a meta tag?

In the official Microdata site I see the option of adding images to events:

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

which works fine. However, I wonder if it is possible to add that image by using something like:

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

which according to my tests does not work.

解决方案

Instead of using the meta element, you must use the link element (because the value is a URI):

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

This is required by HTML5 (bold emphasis mine):

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

And it’s also explicitly required by Microdata.

这篇关于如何使用Microdata元标记将事件添加到事件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆