3

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

1

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.

1

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">
0

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 Mar 2 '11 at 11:24
0

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

  • 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

Your Answer

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