implementing recent comments

As you can see, I’ve added a “recent comments” section to my blog sidebar. I can’t take credit for figuring it out on my own, however. Back at the beginning of April, Liz generously posted some of her template files, and I’ve just used the relevant portions from her pages in my pages.

Here’s how you do it, provided you’re using Movable Type for your blog.

On your “Main Index” template, insert the following code in your sidebar where you want your recent comments to be displayed. Change the value for the lastn attribute of the MTComments tag to indicate how many comments you want displayed.

Then in the template for your “Individual Entry Archive,” change the relevant section of code so that it looks like this:

It’s just that easy.

Print Friendly

11 thoughts on “implementing recent comments

  1. Rad. Thanks for saving me the time digging in others’ markup. Mind adding it to the Wordherder help as well?

  2. Game Methodology (and misc.)

    Lots of folk tinkering with blogs yesterday (yes, in my little world, two = “lots”). Rain must bring out the handy(wo)man in all of us. I recall Neal Stephenson saying something like “PC people are tinkerers; Mac users are aesthetic…

  3. Any idea of a way to:
    1. incorporate recent trackbacks (preferably in the same list as comments, rather than a different one)
    2. place trackback text (the text you get inside the trackback link) within the comments text, so you can see both comments and trackbacks together? (seems to be a better way to follow the discussion)
    ?

  4. Clearly Liz has this functionality in her pages. If you just follow the link listed above in my original post, for example, you’ll see it in action. When/if I have time, I’ll look at her template pages and see if I can’t excavate the code.
    Or … someone else could do that… ;-)

  5. I suppose someone else could (boy, my leading question didn’t have the effect I was hoping for ;) )… have about five new blogs to set up this weekend, so I’ll probably not get to it until the following weekend. So, if you get bored … ;)
    I did notice that Liz’s links for trackbacks and comments both jump to the permalink version rather than using a pop-up. I wonder if that was just to centralize things, or because it was for some reason more difficult to implement in the pop-ups? I can’t imagine that it’s the latter…

  6. Cool. This looks good, except I couldn’t get it to work “out of the box.” I had to tweak the tags to avoid error messages. For example, the first rebuild resulted in:
    “Build error in template ‘Main Index’: Error in tag: You used an ‘MTPingID’ tag outside of the context of a ping; perhaps you mistakenly placed it outside of an ‘MTPings’ container?”
    I don’t think this is supposed to occur. I had to add additional MT tags and work my way through two more error messages before it stopped giving me error messages.
    When it *did* work, it listed all the TrackBacks first, and then listed all the comments. J had suggested a function that would intertwine them based on when they were posted. Probably possible to tweak to get it to work that way.
    I altered my tags, then I put it back to the way it was.
    This one that implements threaded comments also looks like a good one to tackle, but it “[r]equires modification of MT source code”:
    http://mt-plugins.org/archives/entry/threadedcomments.php
    Too early right now. And it’s *Saturday*! Must get coffee.

Comments are closed.