Paul Makepeace ;-)

June 11, 2004

Movable Type Recent Comments

Posted in: Movable Type

It struck me that without indication somewhere, that readers would never know when an older entry was commented on. Only the author would know since they get handy notifications from MT. You'd in effect have to look at every archived post and try to figure out what had been commented on. I.e. you wouldn't bother. The effect of this is that conversations on older entries would be only between the author and the tardy reader.

Here's my solution.


So, digging about found some code at elise.com. This was enough to get me going but I wasn't really happy with it as it sorts by entries (see MTEntries tag around everything). If I were going to do that I'd attempt to merge it into the Recent Entries section already there.

(In fact, I actually did but <MTIfNotEmpty tag="MTComments"> gave some kind of bizarre Perl error, possibly since it's a container tag?)

So...

<div class="sidetitle">
Recent Comments
</div>
<div class="side">
<MTComments lastn="5" sort_order="descend">
<MTCommentEntry>
<$MTCommentAuthorLink show_email="0"$> wrote:
<$MTCommentBody trim_to="35" remove_html="1" convert_breaks="0"$>...[<a href="<$MTEntryLink$>#<$MTCommentID$>">more</a>]<br /><br />
</MTCommentEntry>
</MTComments>
</div>

Notes:

  • The MTCommentEntry tag to find out the associated MTEntryBlah info so in this case MTEntryLink would work.
  • I have sort_order="descend" to show most recent at the top.
  • show_email="0" - jeez, as HTML authors, don't ever put email online, mm'kay?
  • The MT [Save], [Rebuild], [Rebuild] (no, really!), [View this page] button pressing is a real chore. I struggle to see how the MT pair let this UX horror through.

PS How do people translate chunks of HTML for display in a blog? I crafted this perl one-liner:

  perl -pe 's/&/&amp;/g; s/</&lt;/g; s/>/&gt;/g' > /tmp/esc

(which amusingly I had to run through itself to show it here :-)

Posted by Paul Makepeace at June 11, 2004 19:00 | TrackBack
Comments

Regarding showing HTML in a blog, see

http://www.elise.com/mt/archives/000235display_code_in_entries.php

for some ideas. I like the Wordpress Encoder.

Posted by: elise at June 11, 2004 20:11

Thanks very much for the code; this was exactly what I was looking for.

Posted by: zachery at November 6, 2004 19:09
Post a comment









Remember personal info?