Avoiding Movable Type's Comment Date Bug

I was reminded today of a nettlesome Movable Type template bug with how comment dates are displayed by the MTCommentDate tag.

As noted by Michael Hanscom, if you place an MTCommentDate tag inside an MTCommentEntry container, it displays the date and time the entry was published, not the comment's date and time.

A workaround is to place the tag outside the container, even if you have to use two MTCommentEntry containers for the same comment.

Here's template code to display the 10 most recently posted comments with proper timestamps:

<MTComments lastn="10" sort_order="descend"> <MTCommentEntry> <p><a href="<MTEntryLink>"><MTEntryTitle></a> <MTCommentBody> Posted by <MTCommentAuthorLink spam_protect="1"></MTCommentEntry> <MTCommentAuthorIdentity> at <MTCommentDate><MTCommentEntry> | <a href="<MTEntryLink>#reply">Reply</a><br clear="all"> </MTCommentEntry> </MTComments>

Incidentally, in Six Apart documentation and most books on the subject, template tags like MTCommentDate include dollar signs in their names, as in <$MTCommentDate$>.

In writing Movable Type 3 Bible Desktop Edition, I decided to never put dollar signs around tags. They're unnecessary -- you can refer to all tags without them -- and they don't work with container tags, so it's a confusing aspect of template creation.


I actually agree with you that it can be confusing that some tags have dollar signs and some don't, but for me, it's been useful to distinguish between container tags and 'data' tags.

Hi Richard,

Thanks for your great blog. It's been quite helpful to me.

I just migrated my blog from TypePad to Movable Type and I can't fix something that is bothering me.

I built 2 modules for the sidebars. The sidebar on the left has recent posts and recent comments. However, depending on what post is selected the posts and comments contemporaneous to the date of the selected post show up. Of course, I just want to show the actual most recent posts and comments. Do you know how I may fix this?

Thanks again!

Add a Comment

All comments are moderated before publication. These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).