How to Automatically Number Blog Comments

I realize I’m a bit late to the game on this one, but there may be other folks out there who would also like to automatically number their blog comments and don’t know how or think it might be too difficult.

I always thought it would require some complicated programming or some arcane use of Movable Type tags. How wrong I was.

It’s actually quite simple – thanks to Left in Front for showing me the way. Basically, you need to add the MTCommentOrderNumber tag (Movable Type user manual) to your Individual Entry Archive template.

Here’s how I added it to my template:

...
<MTComments>
<div class="comments-body">
<span class="commentNumber"><$MTCommentOrderNumber$></span>
<$MTCommentBody$>
...

Then all you have to do is to style your comment number via the <span> tag you inserted. I floated mine to the right and then just styled the font and added the necessary margins, padding and colors. Easy!

Sidenote: Of course, if I hadn’t just unwittingly deleted a whole bunch of legitimate comments as a result of an overzealous reaction to a huge spam attack (got a little too free and easy with MT-Blacklist), I would actually have some recent comments to show how I’ve implemented this feature. [Sigh]

3 thoughts to “How to Automatically Number Blog Comments”

  1. Brendyn, thanks for your good write up that pointed me in the right direction.
    I figure that for some people this is a pretty simple customization. However, for me it was quite a big deal to get it working.
    I’m sure there are other people who would like to be able to do the same, but haven’t taken the plunge because they didn’t know how (or couldn’t be bothered to do the research – which is fine; I know I couldn’t for a while). Perhaps this post will help.

  2. It would be nice to be able to style the numbers in ordered lists to do this – then you wouldn’t have to worry about numbering at all.

Comments are closed.