Garret Wilson
Garret Wilson

Reputation: 21386

Is RDFa `<meta>` without a `name` attribute compatible with HTML5?

RDFa introduced a property attribute for the <meta> element, and the W3C even recommends this as an extension to HTML5. Facebook's Open Graph protocol, for example, uses the RDFa property attribute like this (example from the Open Graph site):

<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
…

However the HTML5 specification seems to prohibit this usage. I'm not talking about whether it allows the property attribute; I'm referring to its explicit prohibition of the content attribute without a name attribute for the <meta> element:

If either name or http-equiv is specified, then the content attribute must also be specified. Otherwise, it must be omitted.

Isn't this in direct conflict with current RDFa usage such as in Open Graph? The HTML5 specification seems to require the presence of a name attribute as well here.

Upvotes: 4

Views: 101

Answers (1)

unor
unor

Reputation: 96607

The W3C Recommendation "HTML+RDFa 1.1" extends the HTML spec (you can find all extensions in a W3C Note).

This extension changes HTML’s conformance requirements for the meta element:

If the RDFa @property attribute is present on the meta element, neither the @name, @http-equiv, nor @charset attributes are required and the @content attribute MUST be specified.


So, these two HTML+RDFa elements are valid:

<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />

(The other two meta elements are invalid, because they have URL values, for which the link element must be used instead.)

Upvotes: 4

Related Questions