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)
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: - Go to Dashboard > Design > Edit HTML.
- Back up your template.
- Tick the Expand Widget Templates checkbox on top right of the code window.
- Find the
</head>tag, and paste this script right above it:01<!-- Google +1 script Start -->02<b:ifcond='data:post.isFirstPost'>03<scripttype="text/javascript">04(function() {05var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;06po.src = 'https://apis.google.com/js/plusone.js';07var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);08})();09</script>10</b:if>11<!-- Google +1 script End --> - Next, look for
<data:post.body/>and paste the following +1 button code immediately under it:1<!-- Google +1 button Start -->2<b:ifcond='data:blog.pageType != "static_page"'>3<p></p>4<divstyle='float:left;padding:10px;'>5<g:plusoneexpr:href="data:post.url"size="standard"annotation="bubble"></g:plusone>6</div>7</b:if>8<!-- Google +1 button End --> - 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
sizeattribute with a value from the table below.Button size (with count)Valuesmallmediumstandardtall - You can remove the count by changing the value of
annotationattributetonone.
- Select the size of button by replacing the value of
- 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 thefloatin line 4 fromlefttoright.
- Position it on top of post
- 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). - Preview before saving.
No comments:
Post a Comment