views:

81

answers:

1

According to facebook to use their like button and the open graph meta tags you need to place something like this into your html page.

<meta property="og:title" content="The Rock"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/&gt;
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/&gt;
<meta property="og:site_name" content="IMDb"/>

What the hell are they playing at? This is invalid html, the attribute 'property' is not and never has been an attribute of the meta tag so why on earth have facebook used this instead of <meta name="og:title" content="The Rock" />?

I am reluctant to try on my site live with valid 'name' instead of 'property' because if I do try and it doesn't work on my site then anyone who clicks like while i am testing it out will have their like fail. So ... Does anyone know if I use the use 'name' instead of 'property' will this still work?

+1  A: 

Don't forget that they also want you to declare some schemas to the html tag - specifically the open graph one via xmlns:og="http://opengraphprotocol.org/schema/. OG is based on RDFa which adds the additional attributes to the meta tags.

Once you're done with that, be sure to add your fb:like - <fb:like href="http://developers.facebook.com/" width="450" height="80"/> - the example is pretty straightforward. Don't forget to add xmlns:fb="http://www.facebook.com/2008/fbml" otherwise you will be sad

Found this answer on SO regarding validation of the meta tag. Doing what that answer describes should give let you pass it through any w3c validator.

SB
Yep, got all of that and it all works! But adding the schemas doesn't doesn't change the fact that 'property' is not an attribute of <meta>
murdoch
it's not a standard attribute, so the additional schemas that are pulled in tell the browser what the attributes mean and that it is valid due to the use of the schema.
SB
The schemas are attached to the namespaces 'fb' and 'og' so they affect changes to tags in those namespaces not those in the global namespace. So the only way that could be true is if the tags were <fb:meta property ... or <og:meta property
murdoch