2009-05-06

Image

Comment Numbering on Blogger

Have you ever thought of numbering your blog's comments? Well, the dream has come true. Thanks to Fernandooo1 of Randomness for this lovely hack.
Follow the steps given below to apply the hack.
Log in to Blogger. Go to Layout > EditHTML. Check Expand Widget Templates. Add the codes highlighted in red at the right places as shown in the code given below.

<dl id='comments-block'>

<script type='text/javascript'>var CommentsCounter=0;</script>

<b:loop values='data:post.comments' var='comment'>

<div class='' expr:id='data:comment.id'>

<dt expr:class='"comment-author " + data:comment.authorClass' expr:id='data:comment.anchorName'>
<a expr:name='data:comment.anchorName'/>
<b:if cond='data:comment.authorUrl'>
<a expr:href='data:comment.authorUrl'><data:comment.author/></a>
<b:else/>
<data:comment.author/>
</b:if>
<data:commentPostedByMsg/>

<span class='comment-number'>
<a expr:href='"#comment-" + data:comment.id' title='Comment Link'>
<script type='text/javascript'>
CommentsCounter=CommentsCounter+1;
document.write(CommentsCounter)
</script>
</a>
</span>

</dt>
<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>
<dd class='comment-footer'>
<span class='comment-timestamp'>
<a expr:href='data:comment.url' title='comment permalink'>
<data:comment.timestamp/>
</a>
<b:include data='comment' name='commentDeleteIcon'/>
</span>
</dd>

</div>

</b:loop>
</dl>

Add the code given below to the CSS area in your template, right before ]]></b:skin>:
.comment-number {
float: right;
display: block;
width: 50px;
margin-right: 5px;
margin-top: -35px; /*comments-counter position*/
text-align: right;
font-family: 'Century Gothic','Lucida Grande',Arial,Helvetica,Sans-Serif;
font-size: 30px;
font-weight: normal;
}

/*since the numbers are actually links, we need to force the color properties*/

.comment-number a:link, .comment-number a:visited {
color: #445566 !important;
text-decoration: none !important;
}
.comment-number a:hover, .comment-number a:active {
color: #FF9933 !important;
text-decoration: none !important;
}
Save Template.
That's it. Let me know your views on this hack. Do contact me if you face any trouble in applying the hack.
If this hack was useful for you then please leave comments so that I'll be able to know who all benefited from this hack. Also post the URL of the blog in which the hack is applied so that it will help the visitors to check how the hack is working in various blogs.




التعليقات:

  1. thnks for this method. it's suc with me

    ReplyDelete

Total Pageviews