Controlling the image and title displayed on Facebook for a ‘like’

Controlling the image and title displayed on Facebook for a ‘like’

If you have a ‘like’ button on your website, you can control most of what gets displayed on the wall of the user who ‘liked’ the site. The two most common things that one would want to control are the title and the image. You can control these with a set of meta-tags that you place in the <head></head> of your site.

An example of these is as follows:

  1. <meta property="og:title" content="Phil&#039;s Blog | Thoughts of a derptastic developer"/>
  2. <meta property="og:type" content="article"/>
  3. <meta property="og:url" content="http://phil.lavin.me.uk/2012/01/controlling-the-image-and-title-displayed-on-facebook-for-a-like/"/>
  4. <meta property="og:image" content="http://phil.lavin.me.uk/wp-content/uploads/2012/01/facebook-logo.png"/>
  5. <meta property="og:locale" content="en_GB" />
  6. <meta property="fb:admins" content="p.lavin"/>

It should all be self explanatory, except for ob:type. You can find a type that suits your content on Facebook’s type list.

Once you have put these tags on your site, you can check the tags validate by running a link to your site through the Facebook Debugger. Running a page through this tool also has the advantage that it clears the page from Facebook’s cache. This is useful if you tried to like the page before you added these tags and the previous title and image have been cached by Facebook.

You can see it in action if you ‘like’ this article using the button below. You will see the article’s thumbnail is pulled across to Facebook.

2 comments

  1. That will come in handy at work. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *