Archive for April, 2010

Adding a Facebook Like button to your web page

Sunday, April 25th, 2010

I finished my Facebook Like widget. All the good names were taken and I had to use the name Facebook Open Graph Widget. At last look there were more than a dozen plugins that do just about the same thing. Mine, of course, is the best of the lot.

You can also roll your own.

Step 1 is to open the web page so you can change the headers. If you are using WordPress, then this is the header.php file in you theme. Just before the </head> tag add the following:

<meta property="og:title" content="Blogs Eye" />
<meta property="og:type" content="blog" />
<meta property="og:url" content="https://www.blogseye.com/"/>
<meta property="og:site_name" content="Blogs Eye" />
<meta property="fb:admins" content="kpgraham" />
<meta property="og:description" content="First you dream, then you die" />
<meta property="og:image" content="https://www.cthreepo.com/images/ship1.gif" />

These are my tags. You would change the url, title, description , image and the fb:admins meta has your facebook id. You are not kpgraham!

Save the file and then go to this page to get your facebook button code.  https://developers.facebook.com/docs/reference/plugins/like

Copy the code that the facebook form creates and paste that in your webpage somewhere. In WordPress that will be sidebar.php or at the bottom of a page or the footer.php file. If you are using wordpress you can use a text widget to paste the code into your sidebar.

Easy stuff – that’s why there are so many plugins and widgets that appeared this weekend in the WordPress repository.