Adding Categories in Movable Type ------------------------------------------------- I'm writing this as a text document because I fear that MT will try to render all of its tags in a blog entry. This document describes the steps I had to take to add categories to my Movable Type blog, including modifying the entry permalinks to indicate the category name and location, and adding a list of catergories with entry counts to my main archive page. At some point, I may do different things with categories, and if so I'll add to this doc. Step one - Enable categories -------------------------------------- This was the easy part. Go into your blog config, click on the Archiving link, and check the Category box under Archive Type. This enables the creation of category archive files once you have defined categories and published entries to them. Step two - Define categories -------------------------------------- Also easy. Click on the Categories link under Manage on the main menu for your blog, and enter the names of the categories you want. If you want more than five, fill in the five available boxes and hit Save. You'll get five more blank boxes into which you can enter category names. Step three - Put blog entries into categories ---------------------------------------------------------- Once you've defined categories, when you create a new blog entry, the pulldown list next to the Title box will contain all of the categories you've defined. Just choose one when you write your entry, or edit a prior entry and choose a category. Step four - Configure the Main Index ------------------------------------------------- Here's the first tricky part. MT's documentation was not sufficient to walk me through this. I wound up getting help from Michael Croft and Ginger Stampley. Anyway, in your Main Index template, look for the section that contains this code:
Posted by <$MTEntryAuthor$> This is where MT defines the footer for your posts. Prior to adding the category tags, mine looked like this:
Posted by <$MTEntryAuthor$> at "><$MTEntryDate format="%I:%M %p"$> | Comments (<$MTEntryCommentCount$>) | TrackBack (<$MTEntryTrackbackCount$>)
Yours may look a little different, especially if you don't have comments enabled, but this is basically what you're looking for. With this code, your MT posts will have a footer that looks something like this: Posted by Charles Kuffner at 05:08 PM | Comments (0) What I wanted was a footer that looks like it does now on my blog: Posted by Charles Kuffner at 05:08 PM to National news | Comments (0) where "National news" is a category I've defined and is a link to that category archive page, which is "cat_national_news.html", in my archives directory. After several misfires, the code I had to add looks like this: to #<$MTEntryID pad="1"$>"><$MTEntryCategory$> so now the whole thing is:
Posted by <$MTEntryAuthor$> at "><$MTEntryDate format="%I:%M %p"$> to #<$MTEntryID pad="1"$>"><$MTEntryCategory$> | Comments (<$MTEntryCommentCount$>) | TrackBack (<$MTEntryTrackbackCount$>)
Step six - Adding a list of categories to your main archive page ----------------------------------------------------------------------------------- Assuming that you have a link to the archives.html file which is the output of your Main Archive Index, you can show a list of your categories with an enumeration of the individual posts for each category and a link to each category index page. Inside your Main Archive Index, you'll see something like this:
The tags will cause a complete list of links to your posts, in the order that they appear in your database. (Note that if you've imported entries from a previous blog, as I will with my Blogspot blog, this may not be the order in which they appear on your blog itself.) I added the following code between the and
tags:
Archives by category

<$MTCategoryLabel$> (<$MTCategoryCount$>)
<$MTEntryTitle$>


You can see the result on my main archive page. I may add tags to make the <$MTEntryTitle$> a link instead of plain text, and I may add some other spacing, but for now it's OK. The whole thing is now as follows:
<$MTArchiveTitle$>

Archives by category

<$MTCategoryLabel$> (<$MTCategoryCount$>)
<$MTEntryTitle$>


Note that categories which do not have any entries in them will not appear in this list. Step seven - Add titles to the Category Archive index ------------------------------------------------------------------------ The last thing I did was to add some code to my Category Archive index which would make the name of the category appear in the banner. My Category Archive index started out with this code: I added the following after the <$MTBlogDescription$>:
Category: <$MTArchiveTitle$>
making the result I threw in the
tags to make everything go on separate lines. You can see the result by going to my Main Archive page, scrolling down to the category listings, then clicking on any category link. What else is there to do? --------------------------------- Off the top of my head, one thing I might do some day is to add code like this to my Main Index: <$MTCategoryLabel$> (<$MTCategoryCount$>)


This I believe would list all my categories with links to each category page and the count of entries in each. Given the length of my blogroll, I'm not sure I want to add this extra stuff. We'll see. I hope this helps you do categories on your own blog. It will help me remember what I did, which is plenty good enough for me.