Friday 3 February 2012

Create Google +1 plus one button to Blogger Sample code

Google +1 (pronounced “plus one”) is a recommendation button somewhat similar to Facebook Like button. Both of them show friends that recommended your post. But while Facebook Like shows them under the button in your post, Google +1 shows them under your post in Google SERP (search engine results pages).

This tutorial will show you how to add a Google +1 button to every blog post in a Blogger blog. It allows your readers to recommend your posts to their Google friends and contacts right from your blog post.
This button will +1 the containing post, regardless the page you are at. It will work on both multi-post pages (home page, archive etc.) and individual/post page etc. You will have an option whether to include a counter or not.
(If you don’t want to add the button under blog posts, there is another method: Add it to a  floating social media sharing bar)
 1 Blogger below post
Update Sep. 2011: Switch to the new Google +1 (asynchronous) script. Split the code into two parts, the first part (script) placed in the head section of template, the second part (button code) stays.
Let us proceed with the tutorial:
  1. Go to Dashboard > Design > Edit HTML.
  2. Back up your template.
  3. Tick the  Expand Widget Templates checkbox on top right of the code window.
  4. Find the </head> tag, and paste this script right above it:
    01<!-- Google +1 script Start -->
    02<b:if cond='data:post.isFirstPost'>
    03<script type="text/javascript">
    04  (function() {
    05    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    06    po.src = 'https://apis.google.com/js/plusone.js';
    07    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    08  })();
    09</script>
    10</b:if>
    11<!-- Google +1 script End -->
  5. Next, look for <data:post.body/> and paste the following +1 button code immediately under it:
    1<!-- Google +1 button Start -->
    2<b:if cond='data:blog.pageType != &quot;static_page&quot;'>
    3<p></p>
    4<div style='float:left;padding:10px;'>
    5<g:plusone expr:href="data:post.url" size="standard" annotation="bubble"></g:plusone>
    6</div>
    7</b:if>
    8<!-- Google +1 button End -->
  6. Configure button 
    You can configure the button by changing the attributes of the g:plusone tag in line 5 (in step 5). 
    • Select the size of button by replacing the value of  size attribute with a value from the table below.
      Button size (with count)
      Value
      google plus one small  small
      google plus one medium  medium
      google plus one standard  standard
      google plus one tall  tall
    • You can remove the count by changing the value of annotation attribute to none.
  7. Button repositioning
    The +1 button code (in step 5) positions the button on bottom left of each post. You can change the positioning if you wish to.
    • Position it on top of post
      Place the button code before (instead of after) <data:post.body/>.
    • Position it on the right
      Change the float in line 4 from left to right.
  8. Displaying button on static pages
    Conditional tags prevent the button from appearing on static pages. If you want it to appear on static pages as well, remove the tags (step 5 line 2 and 7).
  9. Preview before saving.
Enjoy!


No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...
2leep.com
Devotional Bhakti Songs Free Downloads A. R. Rahman Free Songs Download Share to Twitter Adhinayakudu Free Download Songs 2012 Home Fateah Ali Humen Tumse Pyar Kitna Meri Bheegi Bheegi Si Click here to Download Earn money online How to get it? songs NIRANTHARAM NEE OOHALLO Download Free Songs Rhimjhin Gire Sawan Diye Jalte Hain Tere Mere Milan Ki Yeh Ek Ladki Bheegi bhagi si Phoolon Ke Rang Se Bhakthi Songs 2leep.com Hamein Aur Jeene Ki Yevadu Free Download Songs Movie Phoolon Ka Taron Ka A.R. Rehman Sala Main To Saab click Khilte Hain Ghul yahan Yeh Dil Na Hota Bechara Telugu Movie Stars Together Stills Amazing Mere Samnewali Khidki Share to Facebook Yeh Sham Mastani BlogThis! Who is No 1 Heroine In Tollywood 2011? Businessman Trailer Priyanga Sexy Hot Stills Contact O Mere Dil Ke Chain Gabbar Singh Free Downloads Songs Movie Zindagi Ek Safar Hai Suhana Games Damarukam Free Download Songs Movie Nagarjuns’s Actress Best Hot Vedio Part – 1 Ek Ajnabee Haseena Se Pag Ghunghroo Bandh Yeh Jeevan Hai Raat Kali Ek Khwab Mein song Mr Nokia Free Download Songs Movie Ruk Jaana Nahi Businessman Pilla Chaav Free Download Song Who Sham Kuchh Ajeeb Thi Posts (Atom) Aanewala Pal Mera Jeevan Kora Kagaz 0comments Kishore Kumar Older Posts Hum Bewafaa Jeevan Ke Safar Mein Rahi Email This Hawaon Pe Likhdo Collections Mere Sapnoon Ki Raani Zindagi Ke Safar Mein Kishore Kumar Free Songs Download Haal Kya Hai Naa Istham Free Download songs movie Actress Best Hot Part – 2 Games Download free new pc games watched Samantha Latest Stills Wallpapers looks cute Pal Pal Dil Ke Paas Ina Meena Dika Business Man Movie Review Businessman Sir Vastharostharaa Free Download Song Dekha Na Haye Re Socha Na Haye sri saibaba patalu Free Download Songs Sama Hai Suhana Sameera Reddy Sexy Stills Business man mahesh babu mp3 MOVIE Songs free Download Business man mahesh babu mp3 Movie Video Songs free Download Business man mahesh babu mp3 audio songs free Download Business man mahesh babu mp3 movie trailer, Business man mahesh babu mp3 watch 00:58 January favourite Mana Janab Ne Pukara Nahin