Manually patch Blogger template for Disqus:2

In the previous post, we know the circumstances to patch Disqus manually and the process of coding is discussed here.This is based on Disqus directions and it is suitable for experienced users , the new users should not jump upon this as it may corrupt yours blog template.

modify the comment count links on the index page:

Search this code(Cltr+F) in yours blogger template in design , then html section.

<b:if cond=’data:post.allowComments’>
<a class=’comment-link’ expr:href=’data:post.addCommentUrl’ expr:onclick=’data:post.addCommentOnclick’>
<b:if cond=’data:post.numComments == 1′>1 <data:top.commentLabel/><b:else/><data:post.numComments/>
<data:top.commentLabelPlural/></b:if></a>
</b:if>

If not found the entire code you may search for parts of the code and after finding this code

Right before the </b:if>, paste the following:

<!– +disqus –>
<b:else/>
    <a class=’dsq-comment-count comment-link commentslink’ expr:href=’data:post.url + "#disqus_thread"’>View Comments</a>
<!– -disqus –>

replace the comment count in the footer of the blog post:

Search for this (Cltr+F) code:

<p class=’comment-footer’>
    <b:if cond=’data:post.embedCommentForm’>
        <b:if cond=’data:post.allowNewComments’>
            <b:include data=’post’ name=’comment-form’/>
        <b:else/>
            <data:post.noNewCommentsText/>
        </b:if>
    <b:else/>
        <b:if cond=’data:post.allowComments’>
            <a expr:href=’data:post.addCommentUrl’ expr:onclick=’data:post.addCommentOnclick’><data:postCommentMsg/></a>
        </b:if>
    </b:if>
</p>
           

Highlight this part of the code and replace the entire code block with :

<!– +disqus –>
<b:else/>
<a class=’dsq-comment-count comment-link commentslink’ expr:href=’data:post.url + "#disqus_thread"’>View Comments</a>
<!– -disqus –>

Comments embed script:

Search for this (Cltr+F) code:

</b:if>
<div id=’backlinks-container’>

Before the </b:if>, paste the following

<!– +disqus –>
<b:else/>
<div id="disqus_thread"></div>
<div style="display:none;" id="disqus_post_title"><data:post.title/></div>
<div style="display:none;" id="disqus_post_message"><data:post.body/></div>
<script type="text/javascript">
var disqus_url = ‘<data:post.url/>’;
var disqus_title = document.getElementById(‘disqus_post_title’).innerHTML;
var disqus_message = document.getElementById(‘disqus_post_message’).innerHTML;
</script> <script type="text/javascript" src="http://SHORTNAME.disqus.com/embed.js"
></script>
<a expr:href=’"
http://disqus.com"’ class=’dsq-brlink’>blog comments powered by <span class=’logo-disqus’>Disqus</span></a>
<!– -disqus –>

 

Important note:Replace SHORTNAME of http://SHORTNAME.disqus.com/embed.js with your website’s Disqus short name.

Comment count script:

Right before the closing </body>, paste the following:

 

<!– +disqus –>
<b:if cond=’data:blog.pageType != "item"’>
<script type=’text/javascript’>
    <![CDATA[
    (function() {
      var links = document.getElementsByTagName(‘a’);
      var query = ‘?’;
      for(var i = 0; i < links.length; i++) {
        if(links[i].href.indexOf(‘#disqus_thread’) >= 0) {
          query += ‘url’ + i + ‘=’ + encodeURIComponent(links[i].href) + ‘&’;
        }
      }
      document.write(‘<script type="text/javascript" src="
http://disqus.com/forums/SHORTNAME/get_num_replies.js’ + query + ‘"></’ + ‘script>’);
    })();
    ]]>
</script>
</b:if>
<!– -disqus –>

Important note: Replace SHORTNAME of http://SHORTNAME.disqus.com/embed.js with your website’s Disqus short name.Preview yours blog and if it is ok, then save yours blog setting, and now your Blogger template should be patched with Disqus installed.

Join Disqus

 

One Response to “Manually patch Blogger template for Disqus:2”

  1. I simply couldn’t depart your web site prior to
    suggesting that I really enjoyed the usual info an individual
    supply to your guests? Is going to be again ceaselessly in order to investigate cross-check new posts

Leave a Reply

Your email address will not be published. Required fields are marked *

You are here

  • Home
  • Uncategorized
  • Manually patch Blogger template for Disqus:2