Blogger Ever

How to set up social sharing buttons for Blogger post on home page? [Facebook Google + Twitter]

How to set up social sharing buttons for Blogger post on home page? [Facebook Google + Twitter]

The reason behind sharing this article is not to give tutorial on how to add social buttons,but to explain that the social buttons provided by Facebook,Google Plus and Twitter let you share either the current opened page or a specific URL.

However,on the home page their are several post with different URL and if you select to share the current open page then it will share the home page,to avoid this problem I am sharing this tutorial to make it more easy.So have a look.

To get start first get all the buttons with the following settings.


Make sure that you get like button not like box.Click here to get it.

The Code you will get after clicking get code is:
<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); = id;
  js.src = "//";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
The above code you will get in two parts,you have to do a bit change in second part that is change the data-href="" with expr:data-href="data:post.url".


Now get the Twitter link share button right here.

The code you will get is:
<a href="" class="twitter-share-button" data-url="" data-via="bloggerever">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);;js.src=p+'://';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
Just replace the data-url="" with expr:data-url="data:post.url".

Google Plus

Now get the Google Plus button right here.
The code will get is:
<!-- Place this tag where you want the +1 button to render. -->
<div class="g-plusone" data-href=""></div>
<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = '';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
Same replace the data-href="" with expr:data-href="data:post.url".

Then what?

These code should be added under the div with class post.Actually,I've just changed these codes according to Blogger,it will now work well.If you didn't get something,just throw a comment below.

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.