Header Ads

Add Facebook and Blogger comments on Tab

This is one of the best tweak for blogger. This is a comment form with the combination of Facebook and Blogger comment as a tab.

Your reader will get more choices to comment on your blog. They can use their Facebook account or their blogger account.

Without much further a do. Let us begin the tutorial.




Creating Facebook App

The first thing that we need to do is to create a Facebook App.

Facebook Developer: Click Here

Just follow the steps to setup a Facebook App just make sure will you came up with a Facebook API.


Installation Process in Blogger

A. Set the the blogger comment to embedded.

Instruction: Blogger > Settings > Comments > choose embedded 

B. Editing Template
  1. Go To  Blogger > Design > Edit HTML
  2. Backup your template
  3. Click the "Expand widget templates" box
  4. Search for <head>
  5. Just below it add the following code,
<meta expr:content='data:blog.pageTitle' property='og:title'/>
<meta expr:content='data:blog.url' property='og:url'/>
<meta content='article' property='og:type'/>
<meta content='FACEBOOK APP ID' property='fb:app_id'/>

<script src='http://connect.facebook.net/en_US/all.js#xfbml=1'/>
    <script src='http://code.jquery.com/jquery-latest.js'/>
    <script type='text/javascript'>
    function commentToggle(selectTab) {
      $(&quot;.comments-tab&quot;).addClass(&quot;inactive-select-tab&quot;);
      $(selectTab).removeClass(&quot;inactive-select-tab&quot;);
      $(&quot;.comments-page&quot;).hide();
      $(selectTab + &quot;-page&quot;).show();
    }
    </script> 
Replace FACEBOOK APP ID with your own Facebook APP ID, the one that you made on top.

6. Search for <html and replace it with the following code.
<html xmlns:fb='http://www.facebook.com/2008/fbml'  It should look like this:


C. Adding CSS

Search this code ]]></b:skin> and just above it paste the following CSS:
/*--- Tabbed Facebook Comments ----*/ 
.comments-page {  background-color: #f2f2f2; width:450px;}
    #blogger-comments-page {  padding: 0px 5px;  display: none;}
    .comments-tab { float: left; padding: 5px; margin-right: 3px; cursor: pointer; background-color: #f2f2f2;}
    .comments-tab-icon { height: 14px;  width: auto;  margin-right: 3px;}
    .comments-tab:hover { background-color: #eeeeee;}
    .inactive-select-tab { background-color: #d1d1d1;}
 
 D. Search the this code <div class='comments' id='comments'>, Just below it paste the following code:
<table><tbody><tr>
<td><div
 class='comments-tab' id='fb-comments' 
onclick='javascript:commentToggle(&quot;#fb-comments&quot;);' 
style='float:left;' title='Comments made with Facebook'> <img 
class='comments-tab-icon' 
src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixMid1NmGYwpjVzD_jtz4_6Cnxax0Sed3JlOlFruSBmnHn6VdXD5IOvAuTstcafBJM4WD5fnu4PK6tzBKVoIyMWkeWdavxh62gFhq16xKVVQDshjNMZ_2_J9tTfU4NuEOPlnSWwoRZFvM/s400/fbcomment.png'/>
 <fb:comments-count expr:href='data:post.url'/> Comments 
</div></td>
<td><div class='comments-tab 
inactive-select-tab' id='blogger-comments' 
onclick='javascript:commentToggle(&apos;#blogger-comments&apos;);'
 title='Comments from Blogger'><img class='comments-tab-icon' 
src='http://www.blogger.com/img/icon_logo32.gif'/><data:post.numComments/>
 Blogger Comments</div></td>
</tr></tbody></table>
<div class='comments-page' id='fb-comments-page'>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div
 id='fb-root'/><div 
id='fb-root'/><script>(function(d){var js, id = 
&#39;facebook-jssdk&#39;; if (d.getElementById(id)) {return;}js =
 d.createElement(&#39;script&#39;); js.id = id; js.async = 
true;js.src = 
&quot;//connect.facebook.net/en_US/all.js#xfbml=1&quot;;d.getElementsByTagName(&#39;head&#39;)[0].appendChild(js);}(document));</script>
<fb:comments
 colorscheme='light' expr:href='data:post.url' 
expr:title='data:post.title' expr:xid='data:post.id' 
width='450'/></b:if></div>
<div class='comments comments-page' id='blogger-comments-page' style='display:none; '> 
 E. Search this code 
 </b:includable> 
 Just above it paste this code: 
</div>

That's it save your template and your good to go.

1 comment:

Post Top Ad

Post Bottom Ad