1

meta and link elements sometimes create a sort of redundancy in the markup. For example, there is already a title element but in order to declare an og:title property one would have to add a separate meta element such as <meta property="og:title" content="Some Title" />. Explicit content of the former and attribute content of the latter are usually the same.

Now, validators will allow you to just do <title property="og:title">Some Title</title> (while it's illegal to also add the content attribute). The question is if this will help Facevook & others do their job. Or maybe even something like <title property="og:title schema:name">Some Title</title>?

A similar thing with og:image - the <meta property="og:image" content="http://example.com/thumbnail.jpg" /> is redundant with the link of the main picture. Is it all right (validators won't object but how about Facebook?) to do <img property="og:image" src="http://example.com/thumbnail.jpg" alt="Some Alt" />?

1

There are two perspectives:

  • What is valid RDFa?
  • What do consumers (like Facebook) support?

The first one can easily be answered by checking the specifications.
The second one depends on each consumer: Is their documentation up-to-date/accurate/complete? How good are their parsers?

For consumers, it would make absolutely no sense to support only a fraction of RDFa. It’s a specification/standard for a reason. They should just use one of the many conforming RDFa parsers and work with the extracted data/triples. When they have this parsed data, then they can decide which vocabularies (like OGP or Schema.org) they support and make use of.

Ideally, they should just state which types/properties (like og:name etc.) and which syntaxes (like RDFa) they support, not just provide "definitions" by showing some markup snippets, where it’s not clear if these are just examples or if they have to be used exactly like that.

So unless their documentation is clear and/or they provide an up-to-date testing tool, you’d have to test it for or ask each consumer you are interested in.

From the HTML5+RDFa perspective …

Using RDFa’s property attribute on the title element is fine:

<title property="og:title">My favorite books - blog.example.com</title>

It’s also allowed to use the content attribute in addition, but it only makes sense if the title you want to use for RDFa is not identical to the user-visible title:

<title property="og:title" content="My favorite books">My favorite books - blog.example.com</title>

Using two or more properties is fine, too:

<title property="og:title schema:name">My favorite books - blog.example.com</title>

And from the RDFa perspective, it doesn’t matter on which element you specify the og:image property, as long as it’s an element that creates a URI as value.

So using

<meta property="og:image" content="http://example.com/thumbnail.jpg" />

is not valid HTML5+RDFa (having Facebook document it like that doesn’t change this fact).

Instead, it could be, for example:

<link property="og:image" href="http://example.com/thumbnail.jpg" />
<img property="og:image" src="http://example.com/thumbnail.jpg" alt="Foo" />
  • Thanks, so I get it that it's up to Facebook etc. to make good use of valid code. One objection, though, this is what the html5 validator has to say about title content: Error: Attribute content not allowed on element title at this point. From line 4, column 1; to line 4, column 55 l>↩<head>↩<title property="og:title" content="My favorite books">My fav Attributes for element title: Global attributes – Lucian Davidescu Jun 24 '15 at 12:51
  • And there's something else, in case Facebook documents that meta wrong but only parses that bad documentation then there's a sort of deadlock: be invalid to cater to Facebook's mistake or be valid and achieve nothing. – Lucian Davidescu Jun 28 '15 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.