How to add Facebook Send button to every post
Update Oct 2011:
Upgrade to the new asynchronous script. Add conditional tags to load script only once, even on multi-post pages.
Facebook has introduced a new sharing tool – the Send button. The Send button allows your readers to privately share things with groups and individuals. It enables them to:
- Share your posts with selected friends through Facebook Messages.
- Post them to Facebook Groups.
- Email them (without snippet) to individuals.
The are two notable characteristics of the Send button:
- Auto suggestion -it auto-suggests friends and groups, so you don’t have to memorize friends’ and groups’ names.
- Privacy -what you send to a friend or email will not appear on your friend’s newsfeed or your wall. (What you post to a group on the other hand will appear).
This tutorial will show you how to add a Facebook Send button to each blog post in Blogger.
I. Installing a standalone Send button
- Go to Dashboard > Design > Edit HTML.
- Back up your template.
- Tick the Expand Widget Templates check box on top right of the HTML window.
- Find the following code in your HTML (this is the code for your post content):
<data:post.body/>
- Paste the following XFBML code right below that line:
<!-- Facebook Send script Start --> <b:if cond="data:post.isFirstPost"> <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); js.id = id; js.src = "http://connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> </b:if> <!-- Facebook Send script End --> <!-- Facebook Send button Start --> <div style='float:left;padding:5px 5px 5px 0;'> <fb:send expr:href='data:post.url' font='' colorscheme='light'></fb:send> </div> <!-- Facebook Send button End -->
- Preview, you should see the button appear under each post.
- Click Save if you like what you see.
II. Installing a Like + Send button
Go through similar steps as in section I but replace the code in step 5 with the following:
<!-- Facebook Like+Send script Start --> <b:if cond="data:post.isFirstPost"> <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); js.id = id; js.src = "http://connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> </b:if> <!-- Facebook Like+Send script End --> <!-- Facebook Like+Send button Start --> <div style='float:left;padding:5px 5px 5px 0;'> <fb:like expr:href='data:post.url' font='' layout='standard' send='true' show_faces='false' width='450' colorscheme='light'></fb:like> </div> <!-- Facebook Like+Send button End -->
III. Configuring the buttons
Choose the type of button and set the appropriate width and height by changing the attribute values in line 16. (For Send button only colorscheme and font attributes are applicable).
Like button type | Attribute | Value | Width |
layout | standard |
450px | |
button_count |
150px | ||
box_count |
110px | ||
action | recommend |
n.a. | |
colorscheme | dark |
n.a. | |
n.a. |
font | font name |
n.a. |
IV. Repositioning the buttons
The steps above position the button at 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 15 fromleft
toright
.
Enjoy!
69 comments to "How to add Facebook Send button to every post"
Thanks for this - I tried to get the code yesterday, but FB was kinda not responding to me!
It doesn't work in my template. I have the old iframe code for the like button. I took that one off and put the new code, but nothing shows up. It works on my other blog, but not this one. Have any ideas why?
@Mary
The button is working now...except for the popup dialog being cut off (I was having the same problem too). Maybe you want to move the button more towards the center.
@Bonny
Which blog is that? The URL?
replace
with
to display only on post :) kekeke
http://www.quicktattletails.com/ it won't work on this one.
I also cannot apply this button to my blog post...seems like the template cannot use the xfbml code...
URL: www.sunahsukasakura.com
Thank, and if you agree, I just say that for French or other langage : (change /en_US/ by /fr_FR/)
How do I display the Send button in different languages?
If you are using the XFBML version include the language code when you instantiate the library. Replace ‘en_US’ in this line with the correct locale code:
'//connect.facebook.net/en_US/all.js';
not working with me!
ok jadi.. thanks.. kalau yg guna facebook like versi baru macam dekat blogpost sy, macamana nak tambah button send?
Hi Greenlava :)
In the code for "Installing a standalone Send button" it's a little problem and the code doesn't work.
You probably misstyped, instead of: Send button End –> it should be Send button End -->
It's always a problem when one teeny details in a code gets messed up. But putting an FB button for every post really helps make your blog more interactive.
@Bonny, Sunah Mohammad and darxniq
There were bugs in the standalone Send button code. I've since debugged it. Try copy pasting it again, it should work now.
@Attention à la Terre
Thanks for the tip :)
@Haz Issac
Like versi baru, yang mana tu?
@Blog Help
Thanks for pointing that out. I really appreciate it.
thanks for tip will apply on my old blogspot blog. Dah lama tinggal blog tu sejak guna domain dan hosting sendiri.
Thanks for the post Greelava,
Is it possible to customize the text "13 people like this. Be the first of your friends" ?
I tried but it did not work out. I got this message below for standalone code
Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly.
Your comment box did not allow me to paste the Tag displayed along with the error message
Greenlava thanks for the nice jobs u're doing for bloggers.
Can you write tutorial on this please
How To Add Facebook Comment Box To Blogger Blogs
Thats so nice of you..A wonderful tip..I will try this on my blog..Thanks..
The code seems to work wonderfully for putting the like and send buttons at the bottom of each post. But the problem is that the Like and Send only refers to the main page, not the individual posts' permalinks. So, it only totals the likes for the whole blog, rather than one post. Is there a way to fix that? Thanks.
@Noridah
You're welcome.
@Muneer Ahmad
No I'm afraid that's not possible.
@Emenike Ojiako
When did you try it? There were bugs when I first posted this tutorial, but I've fixed it and retested. It's bug-free now.
A ptutorial on How To Add Facebook Comment Box To Blogger Blogs? I'll look into it :)
@nisheeth
You're welcome.
@Joe Simmons
It does refers to the individual posts, not the homepage.
The "expr:href='data:post.url'" in the code ensures to that.
ada dalam setiap post sy.. boleh check :) kalau tau caranya, tolong ajar..
@Greenlava: It just doesn't seem to be working for me. If you get a chance, check out my blog:
http://slowjoe12.blogspot.com
I have your code installed right now. But see how on every posts it totals the likes for the entire page, not just that individual post? And the send button only sends the main page as well. Do you have any idea what I might be doing wrong?
Thanks!
@Haz Issac
Ha Like button biasa je tu. Cuba cari kod yang macam ni:
< iframe..bla bla bla.../>
Gantikan kod tersebut dengan kod dalam step III.
Ok thanks,
@Joe Simmons
These are the culprits -the Facebook open graph meta tags (that you added I presume):
[meta content='Joe Simmons. Comedian. Humorist. Loserist.' property='og:title'/]
[meta content='blog' property='og:type'/]
[meta content='http://slowjoe12.blogspot.com' property='og:url'/]
[meta content='http://a0.twimg.com/profile_images/1313248433/OffTheHook_1.jpg' property='og:image'/]
[meta content='Blog' property='og:site_name'/]
[meta content='500757816' property='fb:admins'/]
By putting these meta tags in your template, you're actually telling Facebook to use those data on all of your pages. In other words all pages (posts, static pages etc.) sharing the same data.
To fix it:
Try removing the og:title and the og:url meta tags. Without these tags Facebook should get the correct data. These new data will take effect after 24 hours.
But I doubt you can wait 24 hours to see if works or not :)
Here's what you do -take a permalink of a post, run it through Facebook URL Linter,and finally go to the post and test the button. If the button works on that post the it should also work on other posts (after 24 hours).
Facebook should get the correct data ==> Facebook should get the correct post title and post URL data
the best guide ever!
keep up the good work!
@Greenlava: First off, thank you VERY much. You've already helped more than you had to. I owe you a beer or something. Hey, actually, I 'll link you whenever I get my stupid page working. :-)
But the bad news: It's still not working. I removed the two tags, as you suggested. But when I run it through the facebook Linter it still shows a Like button with the Likes from the main page, not the individual post. Also, the Linter showed:
Warning
Required Property Missing og:title is required
Required Property Missing og:url is required
Do you think waiting 24 hours will help? Or does the Linter show how it's processed immediately? I can't understand why only my blog is having this problem.
By the way, I also tried deleting [i]all[/i] the meta tags I added, and it still didn't help.
As of right now, it's back to the way it was, minus the two meta tags. I guess I'll wait out the 24 hours, unless you think it won't help. If you have any other suggestions, I'll be more than happy to try them.
Thanks!
@Joe Simmons
Try removing all open graph meta tags, except the one for og:image. (BTW I only use this tag in this blog, to prevent Facebook from fetching a image at random)
thanks GreenLava atas respon yg sgt cepat.. good job n thanks for helping! jadi dah :)
Thanks for the update Greenlava. Really like your blog
interesting...facebook can other way to famous of blog
@Greenlava: Well, I simply left it alone for 24 hours, and it seems to be working! Curiously, two of the most recent blog posts are still incorrect, but all the others seem to be tabulating data for just their individual entry. I guess facebook scraped it.
I just want to thank you again for all of your help. I may yet remove all of the meta tage except for the image one, but for now I'll leave it be.
Joe
kenapa send button tu kejap ada kejap tak ada? sy pun send dan like button dah ilang dah.. kenapa ek?
@All readers
Please read the latest update at the beginning of the post.
@Greenlava ... Thank You 4 the Update ..
Do you know how to Change d Background of the Frame that appears on the Click of the Send Button using Facebook API ... :P
or the Image while sending to Facebook.. (http://i56.tinypic.com/4gj21h.jpg)
It would have Been a great help ... :)
Hey thanks for the trick and help !
@hackrishna
Put this Facebook open graph meta tag in the [head]...[/head]
[meta content='PUT YOUR IMAGE URL HERE' property='og:image'/]
However with this meta tag on, Facebook will use the same image for all posts!
Hey Greenlava, thanks for detailed explanation of how to add facebook button to blog. I am searching for this. Awesome article
Many thanks for this! Is there any way how to let the "dialogue" box (once you clicked on the "send"-button) pop up to the left? I want to have the send-button in a right-handed module so if it pops up I cannot read the whole text. Thanks!
@Peter
I don't think you can change that :(
its not working on static pages. yeah, it works on all other pages but not for static pages. When I click send, it was sending the homepage rather than the static page
i can't find code
help please
@ARC™
That's because your open graph meta tags lead you to the homepage:
[meta content='BLOG ARCX13.COM' property='og:title'/]
[meta content='http://www.arcx13.com/' property='og:url'/]
@Global Insyaka Resources
Make sure you tick the Expand Widget Templates checkbox first.
bangus banget kamu punya tips... terima kasih daun keladi...
salam sejahtera, macam mana mahu buang confirm button bila klik pada like?? boleh kah hanya like dia terus confirm tanpa ada pop up ??? terima kasih atas bantuan..
@SyedAbuSayyaf
I don't think that's possible.
saved my life
nice!! thanksss =)
Is canonical i causing this problem
Awesome blog! Thanks for sharing this info. I will visit your blog again to check your new articles.
I can't even find after scrolling two miles of code from top to bottom THREE times. Could you give a hint as to where one might normally look? I like the tutorial, but when I can't past the first step it's really annoying. Thanks!
@Dell
Have you checked the Expand Widget Templates checkbox before looking for the code?
And you might want to use the browser search function (by pressing Ctrl+F) for that.
@Greenlava
Yes, I found the "expand" box and checked it. Then I started scrolling but still haven't located whatever it is I was looking for. Using the browser search function simply does not compute to me. I have no idea what that means. It's really awful to be old.
Greenlava, don't waste your time on me. I give up. But thanks for your quick response and attempt to teach an old dog new tricks.
@Dell
I'm not giving up just yet :)
To invoke the search bar, you first press CTRL key and F key simultaneously.
Having done that you should see a bar at the bottom (or top) of your browser window, with the word "Find" on the left side of the bar.
Enter the search term "data:post.body" (minus the quotation marks) in the text field next to "Find" and hit Enter key.
The browser should take you to the first occurence of "data:post.body" and highlights it.
Its a different concept....
lets see....
Thanks for your Tip. I was trying many ways to do this. Did not realize it was very simple.
Cheers! :)
After 2+ hours of trying to get this to work, i found this site and within 5 minutes it was working. Thanks!
I've tried everything with this FB Send/Like Button Java script to get it to work on my blogs. Nothing seems to do the trick. When I add it to any of my blogs it conflicts with a few other Java scripts. An example is on http://myhowtogoogle.serveblog.net, after adding the send button script the G+ in the slide bar does not show and the FB login button disappears in my left sidebar and the Facebook send/like button still does not show below the post. Something else I noticed is that when I go into my HTML in blogger there are two data:post.body tags.
Excellent information for bloggers. I got a great help from these step by step tips. Really you have done a great job....!!!
I bookmarked this blogging which helps me a lot excellent info with step by step points which I will apply on my aacount.Thanks!!!
Facebook doesn't allow you to add send button for every page of blogger by default, but you have tweaked it very well.
Best Regards!
Hi there. I tried everything you said in the comments as well but I cannot figure out for the life of me - why FB keeps sending the Main blog instead of individual posts and if you like one post - it like everything. I couldn't find any og tags either. :(
I'm here:
www.lookwhoswearing.com
@Gayatri
Recheck the content of code line 16. Make sure you have expr:href='data:post.url', and not expr:href='http://lookwhoswearing.com' or href='http://lookwhoswearing.com'
Post a Comment
We love to hear from you! Leave us a comment.
To ensure proper display, HTML/XML/Javascript need to be escaped first using this escape tool.