Friday, April 23, 2010

Add the Facebook "I like" button to your blog

Facebook has enabled your blog readers to "Like" your blog posts directly on your blog. This is great news as it makes it much easier for Facebook users to share what they like. For blog owners it also means that your writings has the potential to reach a larger audience.
To add the button to your site go to http://developers.facebook.com/docs/reference/plugins/like and grab the html and insert it into your blog template. The html snippet looks like this

<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://www.facebook.com/plugins/like.php?href=[InsertYourUrlHere]&amp;layout=standard&amp;show_faces=true&amp; width=450&amp;action=like&amp;colorscheme=light" style="border: none; height: px; overflow: hidden; width: 450px;"></iframe>

What you should do is insert your sites url where is says [InsertYourUrlHere]. If you know how to get your posts url dynamically by inserting a tag instead this is prefered. This will mean that the "like" link that shows up in peoples Facebook stream will link directly to your blog post and not just to your blog's frontpage.
This is how it looks in Blogger which is the blogging platform I use

<iframe src="http://www.facebook.com/plugins/like.php?href=<$BlogItemPermalinkURL$>&amp;layout=standard&amp;show_faces=true&amp; width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px"></iframe>

Hope this helps and let me know if this was useful by clicking the "I Like" link :-)

No comments: