Archives » October 12th, 2004

October 12, 2004

Permalinked comments

Doc says he wants to see permalinks on comments. And when I read that I thought it should be pretty simple, so I spent five minutes in Movable Type setting it up. So now all my comments are permalinked, not that I ever get many comments. Here’s a post that’s littered with them.

Here’s how to do it in Movable Type. Go into your Individual Entry Archive, and go to the comments section. For each comment you should have some kind of wrapper, like a <div> or a <p>. Add this id attribute to that element:

id="com<$MTCommentID pad="1"$>"

This will give that element an ID something like this: com000471. This sets an anchor point that you can link to. Next you have to put the link somewhere on the page. I chose to make the comment date a link, but you can wrap it around whatever you want. Here’s the code.

<a href="<$MTEntryPermalink$>#com<$MTCommentID pad="1"$>"><$MTCommentDate$></a>

Add those two pieces to your template, rebuild your site, and all your comments will now be permalinked! Now I can put out a link like this: that points right to a comment.

And since he brought it up, where are the permalinked comments at Doc’s IT Garage?