Wednesday, May 15, 2013

Adding a Facebook Like Button to Each Blogger Post

Blogger already includes share buttons, but if you really need the approval of a "like" on each post:
Put the FB Javascript code in the template
This code was retrieved from https://developers.facebook.com/docs/reference/plugins/like/
at the time of this writing.
# Add to the Template:
1 Template/Edit HTML
2 Underneath the <body> tag:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
# Add the tag to all new posts:
1 Posts and Comments/Post Template
2 Add the code:
<div class="fb-like" data-send="false" data-width="450" data-show-faces="true"></div>
From now on, your posts will include the like tag.
# To add to older existing posts,
1 Edit each post, click "html"
2 add this code to the bottom of the post.
<div class="fb-like" data-send="false" data-width="450" data-show-faces="true"></div>

No comments: