07 August 2009

Numbering your Comments in the Blogger Blog

I am trying to keep my blogs in the simple informational style. That means, I am looking for interesting information on the Web and I am sharing with you. In most cases, it is a one-directional process, and I do not get a lot of comments. However, if you blog in more communicational and controversial manner, amount of comments you receive could be huge. If that is the case, the comments numbering might be an excellent idea.

Possible Advantages:
* It is a nice way of differencing/identifying each comment (it’s a great feature for giveaway posts!).
* It allows you to get the permalink of each comment, and this may work for future references (e.g.: “You should read this comment [URL goes here], I found it very interesting.”)
* Indispensible for design purposes.

Possible disadvantages and limitations:
* If your comments are paginated, the counter will reset in each comment page. In Blogger, comments are paginated if they surpass the 200.
* The process requires code modification in several places, so that is not recommended for the beginner bloggers.

Results:

Image and video hosting by TinyPic


Steps involved in implementing this trick
1. Login to your Blogger Dashboard
2. Go to Template >Edit HTML
3. Choose to expand your Widget templates.
4. Find this line of Code
<dl id='comments-block'>
and replace it with
<dl id='comments-block'>
<script type='text/javascript'>var CommentsCounter=0;</script>
5. Now find this line of code
<dt expr:class='&quot;comment-author &quot; + data:comment.authorClass' expr:id='data:comment.anchorName'>
and replace it with
<dt expr:class='&quot;comment-author &quot; + data:comment.authorClass' expr:id='data:comment.anchorName' style='clear: both;'>
6. Now find this line of code
<data:commentPostedByMsg/>
and replace it with
<data:commentPostedByMsg/>
<span class='numberingcomments' style='float: right; font-size: 20px;'>
<a rel='nofollow' expr:href='data:comment.url' title='Comment Link' style='text-decoration:none'>
<script type='text/javascript'>
CommentsCounter=CommentsCounter+1;
document.write(CommentsCounter);
</script>
</a>
</span>

So you should have it working in just 3 replacement steps. If everything went well, you should now have a numbered commenting system on your blog.




Sources and Additional Information:

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...