Simple Blogger Tutorials

Facebook Send Button for Blogger

Send button by Facebook enables your blog readers to send your content to their Facebook friends privately in their inbox or to the group wall or to any email address. Let’s see how to add Send button to Blogger.

facebook send 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='&quot;loading&quot; + data:blog.mobileClass'>

For templates based on blogger's Template Designer and immediately after it add:

<div id='fb-root'/> <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>

Step 4: Find <data:post.body/> and immediately after/before it (or both) add:

<b:if cond='data:blog.pageType != &quot;static_page&quot;'>
<div class='like'>

<fb:send expr:href="data:post.canonicalUrl" font="arial"></fb:send>

</div>

</b:if>

Step 5: Save you template.

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:


For this above Send button, the code is shown in step 4.

<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 == &quot;item&quot;'>
    Facebook Send button code goes here...
    </b:if>

0 comments :

Post a Comment

Don't SPAM! Read comment policy.

Like