More hacking into the comments line

On second thought: why not adapt the "0 comments" to something more interesting like "No comments at all" or "Please please please leave a comment" ?

It is easy as this. For explanation see my post on the 1 comment workaround.

<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 comment
<b:else/>
<b:if cond='data:post.numComments == 0'>No comments
<b:else/>
<data:post.numComments/> <data:top.commentLabelPlural/>
</b:if>
</b:if>
</a>
</b:if>

This is what people say:

ilker said...

i tried this on my blog but somehow the "X comments" doesnt show in IE6 anymore..

Hans said...

@ilker: I am using IE6 myself, and the number of comments displays fine. Carefully check everything.

domeheid said...

Thanks for this.

Shirts on Sale said...

Hey Hans,

Thanks for all the great hacks. They are certainly invaluable.

While loading this comments hack, I noticed that some of the custom text has an extra space at the end of the link. After playing with the spaces in the code, I've fixed it so that it displays the same (no extra space at the end of the link) for 0, 1, and more than 1 comment:

You can download the text file here.

P.S. Obviously, I couldn't paste the code here directly, so I had to upload a text file.