Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook open graph meta tags & valid html [duplicate]

Possible Duplicate:
Html validation error for property attribute

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/"/> <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/> <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?

like image 562
3urdoch Avatar asked Oct 18 '10 14:10

3urdoch


People also ask

How do you add meta tags to Open Graph?

Just go to Page Settings > Social Image > Upload. If you need to add other OG tags and customize the default settings, go to Page Settings > Advanced > Page Header Code Injection. Read the following section on adding the tags manually and copy-paste the code there.

How do you add a tag to an Open Graph on Facebook?

Click on 'Social'. Click on the 'Facebook' tab. Toggle the 'Add Open Graph meta data' switch. To enable the feature, toggle the switch to 'On'.

Does Facebook use Open Graph?

Open Graph MarkupMost content is shared to Facebook as a URL, so it's important that you mark up your website with Open Graph tags to take control over how your content appears on Facebook. For your website to be shared correctly by our crawler, your server must also use the gzip and deflate encodings.

What are Facebook meta tags?

You can optionally set metadata tags in your product feed files. This enables Facebook to attribute catalogs using this feed to your app. Once a catalog is attributed to your app, the meta tag is not required in subsequent feed uploads to that catalog.


1 Answers

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.

like image 75
NG. Avatar answered Sep 27 '22 22:09

NG.