How to add an image to an event with Microdata meta tag?
Asked Answered
S

2

2

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.

Splint answered 8/7, 2014 at 17:49 Comment(0)
D
7

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.

Decrement answered 9/7, 2014 at 16:58 Comment(0)
S
2

I just found the answer myself. For the record, meta tags must specify their value with the content attribute:

<meta itemprop="image" content="image.jpg"  />
Splint answered 8/7, 2014 at 17:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.