Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://opengraphprotocol.org/schema/"
      xmlns:fb="http://www.facebook.com/2008/fbml"

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

Thanks,

Danny

share|improve this question
add comment

4 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
1  
I tried the w3c validation on an html 5 page and w3c validation did care - it is not valid! –  Perhentian Mar 2 '11 at 11:24
add comment

Joel,

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

share|improve this answer
    
surely then xmlns:og would not be valid... –  UpTheCreek Mar 18 '11 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 Mar 18 '11 at 17:05
add comment

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

<html
      prefix="og: http://opengraphprotocol.org/schema/"
      prefix="fb: http://www.facebook.com/2008/fbml">
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.