Displaying the Latest Post for Each Author in Movable Type

| 4 Comments | No TrackBacks |
Suppose you are running an MT installation with multiple (sub)blogs and multiple authors.  Wouldn't it be neat to be able to display a list of all your authors somewhere, along with the latest entry they published anywhere on the site?  Actually, it is not that hard to do... 
Code example
Here is a quick code snippet that gives you the basics you need to get started: 

<mt:authors include_blogs="all">
<mt:setvarblock name="authorname"><mt:authorname></mt:setvarblock>
<mt:authordisplayname> 
<mt:entries include_blogs="all" author="$authorname" lastn="1">
<href="<mt:entrypermalink>"><mt:entrytitle></a>
</mt:entries><br>
</mt:authors>​

Turn this into an index template somewhere on your installation (or add it to an existing index template) and you are all set.  Dont forget to enable a rebuild trigger though, if you want the list to be updated now and then...

A little explanation
The <mt:authors> loop simply loops over all authors on your system.  We capture the author's username in a variable and then we display the author's 'display name' (which is different from the username).  Finally we use the <mt:entries> loop to get and display the title + link of the most recent entry written on any blog in the system by the author with the username we just captured before.

Possible extensions
You could use any of the 'Entries' tags to display more info about the entry: date, number of comments, name + link of the blog on which the entry was published...  In a similar vein, you can also use the 'Author' tags to display more info about the author: userpic, e-mail address, profile page...

No TrackBacks

TrackBack URL: https://www.movabletips.com/cgi-bin/mt/mt-tb.cgi/47

4 Comments

Very nice tip. Simple, clear and useful! Waiting for new tips ;)

What I do on one site I look after is have the authors template code as a file in every single blog - all publishing to the same file. That way, whenever anyone does a publish from a particular blog, the authors page is automatically updated.

Each index file just contains an included template module for maintenance. It's a bit klunky in setting up however in practise works well.

I wasn't aware of rebuild triggers but that looks a more sensible solution.

Hi there! This post couldn't be written any better!
Reading this post reminds me of my good old room mate!

He always kept chatting about this. I will forward this write-up to him.
Pretty sure he will have a good read. Thank you for
sharing!

Leave a comment