scriptygoddess

27 May, 2002

Master Author Archives

Posted by: kristine In: MT hacks

Because Movable Type doesn't (currently) have an automatic by-Author Archives, I've implemented some tricks to make it work on the red kitchen. With group blogs, its really an important form of archiving. I just posted some of this stuff today on the MT forums, and thought I'd outline it over here as well.

Depending on the quantity of posts and number of authors that will be on the blog, this may change the number of Index Templates used. I'm gonna explain the using a single Index Template.

Create a new Index Template. I named mine Master Author Archives and have it publishing to authors.php. (.php because I'm using includes for the sidebars) I edit it each time I set up or remove an author. It has a snippit like this for each author (using myself as an example!):

<a name="kristine"></a>Kristine<br>
<MTEntries author="kristine"><a href="<$MTEntryLink>"><$MTEntryTitle$></a><br>
</MTEntries>

The bold kristine's are the 3 spots that need to be changed with each added author. I've also tried to be consistant with the author naming so that its easier to do this page – all lowercase and first name.

The page this generates is here.

Now, if you'd like to go further with this (which is why I added the <a name> portion of the above snippit), you can use this to direct link with each post to the archives for that author on the Main Index.

<a href="http://theredkitchen.net/authors.php#<$MTEntryAuthor$>">more posts</a>

You could also add a list of authors on the sidebar that links to each authors archives with a list like this – if you frequently add/remove authors, it might be easier to make this a module and include it on the pages that you want for the sidebar:

<a href="authors.php#kristine">Kristine</a>
<a href="authors.php#christine">Christine</a>
<a href="authors.php#robyn">Robyn</a>
etc…

I may add other tips to do with multiple authors onto this post, and if when questions come in, I'll do my best to answer them :)

16 Responses to "Master Author Archives"

1 | Lynda

May 28th, 2002 at 9:36 am

Avatar

Great tip Kristine!

Another thing you can do if you have a large number of authors/posts like this is more or less just provide a list of names as you do at the top and then only show their posts when their name is clicked.

Just another option, expanding on your idea, you could do the following:

<?php
if (author == "kristine") {
?>

<MTEntries author="kristine">
<a href="<$MTEntryLink>"><$MTEntryTitle$></a><br/>
</MTEntries>

<?php
}
?>

Then, to call it up, instead of "authors.php#kristine" you can do "authors.php?author=kristine"

Just another alternative if you'd prefer to display one author at a time. :)

2 | kristine

May 28th, 2002 at 10:01 am

Avatar

And then it hides all the other authors on the page? That is a cool idea!!! I love it and will look at doing it when I get home this afternoon! Thanks, Lynda!!!

This is why I love already having .php pages… when something neato like this comes up, I'm already set to just mod the code, and don't have to restructure my pages to make room for a new .php page!

3 | Dreama

May 28th, 2002 at 10:15 am

Avatar

Kristine, you rock.

4 | kd

May 30th, 2002 at 1:42 am

Avatar

you know, with a big blog like surreally, i've just resigned myself to having different index pages for each author (otherwise the page becomes too huge, it did when i did the author archives in greymatter back when). the use of PHP includes makes updating the repetetive site content manageable, and i feel separate pages for each author is a better way to go.

also, with the archives by author, you use the MTEntries tag, which gives you so many more options for displaying the list of posts.

5 | kd

May 30th, 2002 at 1:46 am

Avatar

oh, one more thing — using the MTEntry container to list archives does give more options for listing, so even on one author blogs, like mine, i put MTEntry author=kd and it lists ALL my archives, for my master archive list, and i can put in excerpts and so forth in the listing — works quite well.

6 | kristine

June 26th, 2002 at 10:26 pm

Avatar

Just thought I'd add to this – I implemented Lynda's PHP suggestion this afternoon and found one thing that needed to be changed…

<?php
if ($author == "kristine") {
?>

<MTEntries author="kristine">
<a href="<$MTEntryLink>"><$MTEntryTitle$></a><br/>
</MTEntries>

<?php
}
?>

This way, author is a variable :)

7 | Lynda

June 26th, 2002 at 10:28 pm

Avatar

Ack. Sorry! I forgot to add in my dollar sign. :)

I tend to do that from time to time. hehe. Thank God parse errors tell me what line the error is on. :)

8 | itzpapalotl

July 10th, 2002 at 5:52 pm

Avatar

Thanks guys. You rock.

9 | Melanie

July 14th, 2002 at 6:24 am

Avatar

is there a way to actually create the author list dynamically?

11 | Howard

June 10th, 2003 at 10:52 am

Avatar

Ok, this is probably a too-newbie question, but – once you've created that new index template, how is the snippet of code you've outlined above calling it when you click "by author".
Specifically – what makes 'by author' go display that authors page as opposed to a category archive page or something?

12 | no1son

August 8th, 2003 at 4:09 pm

Avatar

hiya, smart people.

i am working on a group blog with some friends. trying to get it up to snuff. it's over here.

i am using the dropdown menu thingie. i would love it if i could use this code to somehow have a dropdown of authors. if i have to create each author by hand for the dropdown options, that's fine. any help is appreciated. thanks in advance.

here's a look at the code i'm using for a dropdown:

<!–By Month–>
<div class="side">
<select style="width:150px;" onchange="document.location=options[selectedIndex].value;" class="jumpbox">
<option value="" selected="selected">By Date…</option>
<option value="">—</option>
<MTArchiveList archive_type="Monthly">
<option value="<$MTArchiveLink$>"><$MTArchiveTitle$> (<$MTArchiveCount$>)</option>
</MTArchiveList>
</select>
</div>

13 | no1son

August 9th, 2003 at 9:40 am

Avatar

nevermind, figured it out!

here!

14 | Danny Froberg

January 2nd, 2004 at 2:42 pm

Avatar

Hi thought i'd pay you back for the inspiration your snippets and pages gave me to solve my entries by author problem 😉

I did a fully automatic version based on your idea;
take a look at http://www.advancedpowers.com/blog/authors.php?author=wizard

Using inspiration from http://www.scriptygoddess.com/archives/001072.php (great gal) i poked around a bit and came up with the following solution to automatically generating authors list and the entries by author page (authors.php)
I use 2 plugins MTCollate and MTAuthors. The MTCollate is optional i just liked it alot becuase of the added sorting etc.

Using this in any sidebars where i want to link to the authors page;

<div class="side">
<MTCollateCollect>
<MTAuthors>
<MTCollateRecord>
<MTCollateSetField name="name"><MTAuthorName></MTCollateSetField>
<MTCollateSetField name="nick"><MTAuthorNickname></MTCollateSetField>
<MTCollateSetField name="url"><MTAuthorURL></MTCollateSetField>
<MTCollateSetField name="posts"><MTAuthorEntryCount></MTCollateSetField>
</MTCollateRecord>
</MTAuthors>
</MTCollateCollect>

<MTCollateList sort="name:+">
<a href="authors.php?author=<MTCollateField name="name">">
<MTCollateField name="name"> (<MTCollateField name="posts">)
</a><br />
</MTCollateList>
</div>
</div>

and this code in authors.php since MTAuthors has the nice sideeffect of setting the MTEntries context to the current author being listed.

<MTAuthors>
<? if($author == "<MTAuthorName>") { ?>
<h2 class="date">
<strong><MTAuthorName> (<MTAuthorEntryCount> posts)</strong>
</h2>
<MTEntries>
<$MTEntryDate format="%x"$> <a href="<$MTEntryLink$>"><$MTEntryTitle$></a><br />
</MTEntries>
<? } ?>
</MTAuthors>

Hope it helps someone.

15 | M E-L

January 27th, 2004 at 12:25 pm

Avatar

Just for the php newbies like myself, if you're implementing Danny's solution you'll need to put

<?php
$author = $_GET['author'];
?>

up at the top of your page, so it can get the author variable from the URL (i.e., http://www.yourblog.net/authors.php?author=ishbadiddle)

16 | Di

April 22nd, 2004 at 5:33 pm

Avatar

Sigh. I am so glad you are here. This is just what I was looking for. You rock!

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements