2008-08-11

Blogging Tip : Adding Comment Numbers


I've seen a lot of Blogger Themes that don’t come with numbers on the blog’s comments including myself. I'm too lazy and that's the obvious reason behind it. But for those who are interested to add comment numbers to your blog, here's a quick guide to get it done.

Login to your Dashboard> Layout> Edit Html. Check the Expand Widget Template check box. Copy and paste these lines into your CSS section. The preferred place to add CSS code is right in front of the closing b:skin tag

.stylingcomment{
float: right;
display: block;
width: 50px;
margin-right: 5px;
margin-top: -35px; /*comments-counter position*/
text-align: right;
color: #000000;
font-family: Arial,Helvetica,Sans-Serif;
font-size: 30px;
font-weight: normal;
}

.stylingcomment a:link, .stylingcomment a:visited {color: #000000; text-decoration: none;}
.stylingcomment a:hover, .stylingcomment a:active {color: #FF3333; text-decoration: none;}


Look for this code <dl id='comments-block'>. Press CTRL F and type the above code in the search box.




Copy and paste this code <script type='text/javascript'>var CommentsCounter=0;</script> right after it.

Next, locate the following code in your template:-
<b:loop values='data:post.comments' var='comment'>
Again, press CTRL F to help you search for the code.


Place this code <div class='' expr:id='data:comment.id'> right after it.

For the third time, find the code below by pressing CTRL F.
<data:comment.author/>
</b:if>


Copy and paste the following code right after it.
<span class='stylingcomment'>
<a expr:href='"#comment-" data:comment.id' title='Comment Link'>
<script type='text/javascript'>
CommentsCounter=CommentsCounter 1;
document.write(CommentsCounter)
</script>
</a>
</span>


Last but not least, look for the following code:-
<dd class='comment-body'>
<b:if cond='data:comment.isDeleted'>
<span class='deleted-comment'><data:comment.body/></span>
<b:else/>
<p><data:comment.body/></p>
</b:if>
</dd>

Add this closing tag </div> right after it. Save the changes.

If you need my assistance, just let me know. That's all for now. Happy commenting :)

0 comments:

Post a Comment

1. Comments posted must be accompanied by names or pseudonyms.
2. Anonymous posting and those containing profanities will be rejected.
3. Comments are moderated due to spam problems. I have to approve the comment before it will show up.

:)) ;)) ;;) :D ;) :p :(( :) :( :X
=(( :-o :-/ :-* :| 8-} :)] :-t b-( :-L