HOWTO: Adjust Plurality of Blogger Comment Count
...or, 'If I've Told You Once, I've Told You A Thousand Time'
I've often been bothered by the fact that my Blogger template doesn't distinguish between a single comment and zero or multiple comments. Well last night, I decided to do something about it. I'm by no means a JavaScript expert, but this was trivial.
Now, if I have a single comment, it will reflect "1 comment." If I have 0 comments, "0 comments," or 2+ comments, "2 comments."
To make the change yourself, back up your Blogger template, then search it for any entries like so: "<$BlogItemCommentCount$> comments", (without the quotes). Replace the "s" in "comments" with the following code, (on one line, for simplicity, and immediately after the word "comment"!):
<script type="text/javascript">document.write((<$BlogItemCommentCount$> != 1)?'s':'');</script>
Save Template Changes, Republish and you'll be good to go.
The template will now spit out "# comment" unconditionally. It will then look at the number of comments. If it is 1, it does nothing, otherwise, it appends an "s", making it plural.
0 Comments:
Post a Comment
« Home