Facebook Send Button for Blogger

If you have previously followed the tutorial of Facebook XFBML Like button for Blogger then skip first 3 steps as you don’t require it. Otherwise:
Step 1: Go to Design > Edit HTML tab and check “Expand Widget Templates”.
Step 2: Find the attribution:
<html ...... xmlns:expr='http://www.google.com/2005/gml/expr'>And add the namespace attribute of Facebook after it so that it works with Internet Explorer:
xmlns:fb='http://ogp.me/ns/fb#'The full attribution will look like:
<html ...... xmlns:expr='http://www.google.com/2005/gml/expr' xmlns:fb='http://ogp.me/ns/fb#'>Step 3: Find
<body>Or
<body expr:class='"loading" + data:blog.mobileClass'>For templates based on blogger's Template Designer and immediately after it add:
<div id='fb-root'/>Step 4: Find
<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 = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<data:post.body/>
and immediately after/before it (or both) add:<b:if cond='data:blog.pageType != "static_page"'>Step 5: Save you template.
<div class='like'><fb:send expr:href="data:post.canonicalUrl" font="arial"></fb:send>
</div>
</b:if>
Customize Send Button Attributes
font
- The font to used by the button. I have used "arial" as default. The other options are: 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', 'verdana'colorscheme
- The color of the "Send" button. The default I used is light. If you have a darker background then add:colorscheme="dark"
Let’s see two live examples with attribution set:
<fb:send expr:href="data:post.canonicalUrl" font="trebuchet ms" colorscheme="dark"></fb:send>
Conclusion
- If you ask me, I will prefer the XFBML version of “Like” because it will give you both the options to “Like” and “Send”.
- Conditional tags marked in blue are used to show it every page excluding static page. Replacing these tags with below codes will let it to be seen in post pages only.
<b:if cond='data:blog.pageType == "item"'>
Facebook Send button code goes here...
</b:if>
0 comments:
Post a Comment