March 29, 2011
The other day I was looking around the new BlogEngine.net Gallery and stumbled across a nifty little extension that adds a FaceBook “Like” button to all posts and posts’ pages. This type of extension has been a much sought after request in the BE community for a while so I had to take a look and see how it works.
Wow! I was totally impressed because this little extension does exactly what I wanted it to do, plus it has the added feature of adding a Tweet button as well!!! Easy to implement and works like a champ!
Being that the code is open source and the author said that “any changes accepted” I wanted to make some layout changes to the extension because I wasn’t happy with having to modify the CSS file(s) of BE. Yes, I could have just added the author’s code to the Global.css file as he suggests for installation but that would mean that every time I updated BE I would have to manually update that CSS file. Or I could have just added it to my theme’s CSS file, but not only would I have the same problem, but I have multiple themes and I didn’t want to update them all. Plus, I think my modifications make installation easier by just dropping the extension into the extensions folder.
The extension has three options for displaying your Like Button but because the author’s code was limiting what was being viewed I added an option to adjust the height of the extension. I also changed the alignment of the Tweet and Facebook buttons (they’re side-by-side) because they weren’t aligning properly for me (the Tweet button was lower than the Facebook button). I also left the author's credits intact in the extension because he did all of the hard work and he deserves the credit! Great job Gayan!
To install the extension place it in your App_Code\Extensions folder.
FacebookLike.zip (2.01 kb)
****UPDATE**** There's an issue that you should be aware of with how FaceBook parses information from posts. Read here for more details.