Category Archives with MTMultiBlog

This is mainly for anyone Googling for how to get MTMultiBlog to display a list of entries in their Movable Type Category Archive pages. I spent a while Googling for an answer this week, finding only questions. So here’s what I’ve done.

Originally I tried this:

<MTMultiBlogEntries include_blogs="1,2,3">
    <div><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></div>
</MTMultiBlogEntries>

I assumed that should have worked, because you’re just displaying entries in a Category context. But it seemed to display all entries, no matter which category they’re from. The only solution I could find was to force MTMultiBlogEntries to a specific category, which I did using the handy MTTagInvoke plugin:

<MTTagInvoke tag_name="MTMultiBlogEntries" include_blogs="1,2,3">
    <MTTagAttribute name="category"><$MTCategoryLabel$></MTTagAttribute>
    <MTTagContent>
        <div><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></div>
    </MTTagContent>
</MTTagInvoke>

If you have a long list of entries in each category and want to display them in a series of shorter pages, you could use the MTPaginate plugin like this:

<MTPaginate>
    <MTPaginateContent max_sections="5" section_start_tag="div">
        <MTTagInvoke tag_name="MTMultiBlogEntries" include_blogs="1,2,3">
            <MTTagAttribute name="category"><$MTCategoryLabel$></MTTagAttribute>
            <MTTagContent>
                <div><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></div>
                <$MTPaginateSectionBreak$>
            </MTTagContent>
        </MTTagInvoke>
    </MTPaginateContent>
    <MTPaginateIfMultiplePages>
        <p class="pages"><$MTPaginateNavigator style="links"$></p>
    </MTPaginateIfMultiplePages>
</MTPaginate>

That should split the list of entries up into pages of 5 entries per page.

Obviously, in all examples, replace “1,2,3” with your list of blog IDs to use. This was using Movable Type 3.2 and, I think, MTMultiBlog v1.99.4a.

Comments

  • hi,
    i tried this same code in my new blog (MT 3.2)
    and got an error when rebuilding the category archive
    page thus:

    Can’t call method “id” on an undefined value at lib/MT/Entry.pm line 215.

    do you use mt 3.2 or 3.3?

  • I’m tying to use this code and it’s not working for me in MT42. I’ve got MTInvoke installed and I’m using the exact same snippet, but I get nothing. Well, that’s not totally true. I get some errors, but some of the tags you are using are out of date, but when I fix that, I can’t get the entries I want to show up or even any entries. Do you have an update for MT4 that works?

    thanks,

    Andrew

  • Sorry it’s not working for you Andrew — maybe it just doesn’t work in MT 4.x. I can’t even remember what I needed this for, as I don’t have MTInvoke installed anywhere now. Sorry I can’t be more help.

24 Jun 2006 in Writing

Foundation course final essay
The final essay I wrote about the course — what had worked for me and what hadn’t.

24 Jun 2006 in Links