This tutorial will show you how to add a Facebook Like button to each blog post in Blogger. Clicking this button will like the containing post. It should work on all pages -home page, individual/post page or any other pages.
The Like button lets your reader share your content with his/her friends on Facebook. When clicked, a story appears in his/her friends' News Feed with a link back to your blog.
Now let us proceed:
- Go to Template > Edit HTML.
- Tick the Expand Widget Templates checkbox on top right corner of the HTML code window.
- Find the following code in your HTML, this is the code for your post content:
1
<
data:post.body
/>
- Paste the Facebook button code immediately below (after) it:
1
<!-- Facebook Like button Start -->
2
<
b:if
cond
=
'data:blog.pageType != "static_page"'
>
3
<
div
style
=
'float:left;padding:5px 5px 5px 0;'
>
4
<
iframe
allowTransparency
=
'true'
expr:src
=
'"http://www.facebook.com/plugins/like.php?href=" + data:post.url + "&layout=standard&show_faces=false&width=450&action=like&font=verdana&colorscheme=light&height=35"'
frameborder
=
'0'
scrolling
=
'no'
style
=
'border:none; overflow:hidden; width:440px; height:35px;'
/>
5
</
div
>
6
</
b:if
>
7
<!-- Facebook Like button End -->
- Configure buttonChoose the type of button and set the appropriate width and height by changing the values of query parameters in line 4.Like button typeQueryValueWidth & Height
layout standard
W: 450pxH: 35px (80px w photos)
button_count
W: 90pxH: 20pxbox_count
W:55pxH: 65pxcolorscheme dark
n.a.
action recommend
n.a. - Button repositioning
The steps above positioned the button on bottom left of each post. You can change the position if you wish:- Position it on top of post
Place the button code before<data:post.body/>
, instead of after. - Position it on the right
Change thefloat
in line 3 fromleft
toright
. - To display the button on static pages, remove the conditional tag -code line 2 and 6.
- Position it on top of post
- Preview, you should see the button appear in each post.
- Click Save if you like what you see.
Enjoy!
No comments:
Post a Comment