Sunday, April 9, 2017

How to add a facebook like button to each post on blogger

1. go to https://developers.facebook.com/docs/plugins/like-button
    fill out details like your site's url (your blogger's main url).
    width of 550
2. Click "Get Code", you'll get 2 pieces of code
3. Add the first piece of code as an HTML/Javascript gadget on your blog (unless you've already done this for comment plugin then you don't need to add this first piece of code again).

4. With the second piece of code, copy it, then in Blogger, go to Theme/Edit Html
find <b:include data='post' name='post'/>
add the second piece of code after the found text.
5. But for your all your posts not to have all the same likes,
you'll have to change in the second piece of code, instead of data-href="your_blog_URL"
put expr:data-href='data:post.url'
expr: just tells it that it's an expression
and 'data:post.url' will grab the the posts url for each posts as it loops through them so you'll get unique likes (counter) for each posts.

You also might be interested in How I added facebook comments to my blog