Splitting Up MT Category Archives

I absolutely love MovableType for publishing this weblog, and know there is quite a bit more to dig into. One thing that has bothered me is in creating my category archives, they potentially have no end in sight for how long they will get to be. They just grow and grow as you add more to your blog. And I loathe slow-loading, ever scrolling web pages.

For example, my learning objects category now has 34 posts and I see quite a few more to come. It is getting fat.

It is not too much to ask that there be some tools to break up the categories into segments, e,.g pagination. The idea would be to have a set amount of content per page (x posts), and some sort of drop down menu, or next/previous link, or even the google-style numbered sets that would self-organiize a long category archive.

Here I describe the cheap route I took.

I am not alone, as I see pagination as making the MT Support Forum list of requested features. (If you are an MT user and have not trudged through the support forums, you are missing a gold mine of tips!).

There are approaches with arcane contructs of tags with embedded mySQL queries. I am not afraid of database work, but really do not see it as necessary here and liable to breakage (and my typos).

I also found a nifty MT plug-in (MTPaginate) that would do the job quite nicely, except it calls for changing all of my category files to *.php from *.html. If I had been smarter I would have opted for PHP in the first place to leave the door open to more interactive and extensible things you can do in PHP, but I missed that boat, and do not want to render to linkrot of the old hand written links to *.html files.

So this is the cheap way.

I have my primary category page that lists the 15 most recent posts in that category, and a secondary link to see all the rest. It is not optimal, but better than slugging the first view of an archive with a long list of results.

So how is it done?

The first thing is to edit your existing category template to spit out only a set number of recent posts. In your MT template, in the middle of the page is the link for the Category Archive. Click the template name to edit this template.

First look for the part that reads:


and modify it to read:

<MTEntries lastn=”15″>

And since navigation is important (there are many ways to do this), we will add above the beginning of the MTEntries tag, a navigation bar:

<div class=”side”>

in this category ||

<strong>recent 15</strong> ||

<a href=”morecat_<$MTArchiveCategory dirify=”1″$>.html”>the rest</a> ||


We use the same style class for the navigation links that we use on our side navigation bar. This style is available in all standard issue MT stylesheets.

I put a bold tag on the “recent 15” to indicate that this is the content in view, and then we have a link to open the other category template page. This is where it gets interesting.

<$MTArchiveCategory$> will prdouce the name of the cateory, say, “Learning Objects”. By adding the parameter dirify=”1″, MT converts it to a unix file friendly name (all lower case, replacing spaces with “_”, or producing a string of text “learning_objects”.

Now all of my category (primary ones) are named “cat_xxxxxxxxx.html” so I will have a second set of category files named “morecat_xxxxxxxxx.html”. This is one of those things MT does nicely with its templates.

That is pretty much it for the primary category template. Click the save button (do not worry about rebuilding yet, we have more to do).

Since we want a similar layout, I would suggest copying all of the text from this template so we can paste it in a new template.

Return to your MT templates screen, and under the Archive-Related Templates heading, click Create new archive template.

For this new template, give it a meaningful name in the Template Name field- I called mine “More Cat Archive”.

Next, paste in all the template text you copied from the Category Archive. This new archive is intended to spit out all of the posts in a category priior to the most recent 15.

Again, find the <MTEntries> tag and edit it to read:

<MTEntries lastn=”100″ offset=”15″>

We are telling MT here to display the entries that are “offset” from the 15 most recent, and then spit out the next 100 posts (you just need a very large number here, maybe 1000 if you are prolific, or 10000 if your are Stephen) You must specify some value for lastn if you use offset.

And like before, we will insert above the tag a navigation bar, noting how the tags are now toggled to emphasis the current page versus the link to the primary category “cat_xxxxxx.html”:

<div class=”side”>

in this category ||

<a href=”cat_<$MTArchiveCategory dirify=”1″$>.html”>recent 15</a> ||

<strong>the rest</strong> ||


Click the save button . But we are not quite done yet. One more critical step!

Now go to your Weblog Config screen and then click on the top link for Archiving. From here, you will be associating your new template with the Category templates, so it will build your new files.

Click Add New…. In the pop up window, be sure to select Category for Archive Type (top menu), and from the (lower) Template menu, select the new archive we created above “More Cat Archive”.

This will create a second entry in your Category template sections. Be sure to leave the radio button selected on your primary Category Archive. The nifty thing here is that you can use MT tags to properly name your new category archives, so next to the label for “More Cat Archive” enter in the field for Archive File Template :

morecat_<$MTArchiveCategory dirify=”1″$>.html

When you save your templates and rebuild, this will create new archive files that match the names used in your modified templates. See:


Now it is time to Rebuild Site (selectiing Category Archives Only is okay).

If all goes well, you will have two sets of category archives- one with the last 15 posts and another with all the rest. It is not optimal but it will do for now. And you always learn a bit more when you muck around the templates (but keep backup copies before doing anything radical!)

If this kind of stuff has any value, please support me monthly on Patreon or a one time PayPal kibble toss
Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.