Blogger Ever

How to get facebook like button to display on home and post for Blogger?

How to get facebook like button to display on home and post for Blogger

Facebook plugin integration is the way to get social sharing through your blog,but the Facebook like plugin was giving me a bit problem while creating the like button.But now I am going to share the problem with solution So let see.

Problem

While creating the like button on Facebook Developers Page,you will find a form like thing,yo need to fill to get like button code.In first field if you write any URL then if the user clicks like the particular URL will be shared but if you leave the field blank then the current opened URL will be shared.
How to get facebook like button to display on home and post for Blogger

If you want to share a particular URL then there is not a problem but if you want to share a current opened page,then you will find problem.

In any case if you put like button on a position,where it shows on home and post both,then if a user likes your post on home page then the homepage will be shared not the post and if your user likes the post on the post page then the post will be shared but it will not get counted on home page,but only on post page.

Solution

Blogger has provided a list of short codes like codes.That I have shared in the link below.
Blogger layout data tags have the solution for this problem.There is a code <data:post.url/>,this code gives the link of the each post.

So to get the like button that shares the post not the homepage and counts the like with not error then fill the whole form and write any URL in first field and click on get code.Make sure that you get the HTML5 code.

How to get facebook like button to display on home and post for Blogger
If you look at the second part of code then it contains
data-href='URL_YOU_PROVIDED'
.But if you change the line with
expr:data-href='data:post.url'
Then your problem will be solved.Link I've done below.
<div class="fb-like" expr:data-href='data:post.url' data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
Then it will share the post only and counts without error.
If you still find any difficulty,then our comments are always open for you.
Blogger

2013-2016 Copyright Blogger E\ver . Coded, managed and founded by Mohammad Hamza (@hamzadhamiya) . Hosted on Blogger and fonts used are Raleway and Open Sans.