In order to use the "og:" meta tag of Facebook Graph, I need to add the following to the tag:


Since I am using HTML5 and not XHTML, do I still need to use the xmlns="http://www.w3.org/1999/xhtml" part?



4 Answers 4


You need xmlns="http://www.w3.org since xmlns:og and xmlns:fb are references to the xmlns - namespace. You need these because the og and fb tags are custom tags that are not part of the regular html. That is why the Validator doesn't like it if you omit it.


Not sure how the validator feels about this but as of RDFa 1.1 you should use prefix mappings and no xmlns.

      prefix="og: http://opengraphprotocol.org/schema/"
      prefix="fb: http://www.facebook.com/2008/fbml">

I haven't used Facebook Graph, but I believe those are required. They're technically only valid in xhtml, not html, but most browsers and even the w3.org validation don't care.

  • 1
    I tried the w3c validation on an html 5 page and w3c validation did care - it is not valid!
    – Perhentian
    Commented Mar 2, 2011 at 11:24


Once you declare <!doctype html> it's considered HTML5 thus you can omit the XHTML xmlns. I'd try to explain it but it looks like Dive Into Mark website does it spectacularly. Scroll down 'The Root Element' section. http://diveintohtml5.org/semantics.html

  • surely then xmlns:og would not be valid...
    – UpTheCreek
    Commented Mar 18, 2011 at 7:44
  • Well from my understanding, you can use either syntax (HTML4.01 or XHTML) under the new doctype. You will need to validate it under an HTML"5" enabled validator like validator.nu
    – Mike
    Commented Mar 18, 2011 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.