Page 1 of 1

Cannot get OpenGraph (Facebook) tags to validate

Posted: Wed Aug 03, 2011 9:25 am
by Louis
When I use this header:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xml:lang="nl-NL">

Then I can delcare Facebook meta tags for my page like:
<meta property="og:type" content="book" />

This validates well in W3C's (http://validator.w3.org) online validator and checkrdfa (http://check.rdfa.info/), but CSE requires the Meta tag to be prefixed:

<og:meta property="og:type" content="book" />

However this fails on W3C's validator (element "og:meta" undefined)!

All online examples I've come across do not prefix the Meta tag.

Otherwise, Facebook testpage (http://developers.facebook.com/tools/lint) does not recognize any meta tags, prefixed nor un-prefixed, maybe something else is wrong?

It gives a warning about missing meta tags which are listed in the debug view...

See my testpage:
http://www.vrijezending.nl/FaceBookTest.html

Re: Cannot get OpenGraph (Facebook) tags to validate

Posted: Wed Aug 03, 2011 8:06 pm
by Albert Wiersch
Hi Louis,

I'm sorry for the confusion.

CSE HTML Validator does not fully support that DOCTYPE or namespaces. It will simply ignore elements that have ":" in the name, which is why it is not generating any errors for "og:meta", because it is just ignoring it.

I am investigating integrating an XML parser in the next major release to better handle XML documents like this, as well as possibly some other support improvements.

Re: Cannot get OpenGraph (Facebook) tags to validate

Posted: Thu Aug 04, 2011 5:21 am
by Louis
Ok, for now I switched off the warnings about the unknown "property" and missing "name" / "http-equiv" attributes.

The .Net framework has a good xml parser that I've often used. I guess you have native code, but you could tap into the .net framework via COM or OCX. One caveat, it will probably throw an exception and stop parsing on the first error, so reporting a whole bunch of errors like you currently do would not be possible using the xml parser alone. I don't know your code, but if it's a simple parser that stacks nested tags and validates each tag-type separately, I guess just adding support for the extensions would be faster/cheaper. A hydride solution is possibly the best compromise. Good luck!

By the way (this might be helpful for others), the facebook lint errors were due to og:url pointing to a different page that did not have the OpenGraph tags. Apparently it does a callback when the referring URL does not match (quite confusing since the debug output shows the original page's meta tags).

Cheers,
Louis