Category-based Combo Boxes
Less Is More
One key principle of interface design is not to overload your users by dumping every choice available on your site right there on the front page. Users don’t mind drilling for information that needs to be drilled for. Important stuff should be readily and easily accessible, and category archives falls into the category of important stuff, especially since they’re one of the primary ways someone navigates your site. But for anyone who posts on a regular basis, your category section can become rather large and unwieldy, very quickly falling under the category of “choice dumping”. Fifty-one categories and seventy-two months listed on your sidebar may be intellectually impressive, but certainly aren’t going to help the newcomer figure out your site.
The category-based combo box really solves a lot of problems, because the information is there, hidden only in a simple form element which most users are comfortable with because they’ve used these in other applications. A simple click of the button and your categories or months are displayed; another click and they’re off to that page. A useful tool that’s made even more so by Movable Type’s publishing capabilities.
How To Do It
What we’re going to do, essentially, is create a combo box that uses a bit of javascript to load the URL from the value of the selected option. The options are generated just like you’d generate list items (<li>) inside of an unordered list (<ul>), using the <MTArchiveList> tag with the archive_type qualifier set to “Category”:
<form action="">
<select name="CategorySelect" onchange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">
<option value="#">Browse by category:</option>
<MTArchiveList archive_type="Category">
<option value="<$MTArchiveLink$>"><$MTArchiveTitle$> (<$MTArchiveCount$>)</option>
</MTArchiveList>
</select>
<noscript><input type="submit" value="Go" /></noscript>
</form>
Let me point out the most important part of this code: The <$MTArchiveLink$>. Without this value in your option tag, you’re browser ain’t goin’ nowhere, Batman. That tag tells MT to place the link as the value of the option and the <$MTArchiveTitle$> provides an easier translation of that for the user. I’ve put the category count in with the option, but that’s completely optional (pardon the pun). You can just remove the parenthesis and the <$MTArchiveCount$> to taste.
You can also change the flavor of this combo box to “Monthly” simply by changing the archive_type qualifier in the <MTArchiveList> tag to “Monthly”. Movable Type will do the rest.
An important note: The first option I’ve set up is “Browse by Category” and cannot be chosen (or rather, it is the default state so you cannot change to it). However, if a user visits a category and uses the browser back button, some browsers will have that category option still selected. So if they (for whatever reason) choose “Browse by category:” it’s going to send the value “#” to the browser, basically telling it to stay on the current page.
Accessibility Issues
To ensure usability for those with scripts disabled, we’ve wrapped a submit button inside of a <noscript>. One extra step for those users, but if they’ve disabled scripts, they’re probably used to that.
Be aware that this drop down box doesn’t quite work with subcategories. If you’d like a thorough explanation of how to put a hierarchical dropdown list of category archives on your page, check out David’s Raynes article on it.
InterAction:
22 August 20052. Arvind:
An alternative I discussed here using Ajax.
I myself have Monthly only enabled on my personal blog for my personal use to see how much I'm blogging and for reminiscing!
22 August 20053. Jesse:
Arvind, that's a beautiful dynamic solution. I'm really a fan of dynamic publishing, though I know many who aren't, one friend in particular owns his own server and argues that it's six of one and one-half dozen of another. To me, switching to dynamic publishing is like breaking up with a so-so girlfriend; you feel kinda lousy at first, but you're pretty sure life just got a whole lot easier.
As for blog reminiscing, I just employed a David Raynes plugin to give me the total age of my personal blog... SIX YEARS!
YourThoughts?
(Minutia)
- Author:Jesse
- Published:Aug 22, 2005
- Chapters:
- Previous:
- Next:
GetUpdated
ElseWhere
AllChapters
- 2 articles in the chapter Accessibility
- 6 articles in the chapter Announcements
- 4 articles in the chapter Blogging
- 7 articles in the chapter CMS
- 1 articles in the chapter Code
- 3 articles in the chapter CSS
- 15 articles in the chapter Design
- 4 articles in the chapter Downloads
- 1 articles in the chapter Freebies
- 1 articles in the chapter Gadgets
- 4 articles in the chapter Journeys
- 1 articles in the chapter Miscellany
- 59 articles in the chapter Movable Type
- 2 articles in the chapter Plugins
- 1 articles in the chapter Print
- 1 articles in the chapter Projects
- 2 articles in the chapter SEO
- 6 articles in the chapter Social Networking
- 1 articles in the chapter Standards
- 1 articles in the chapter Writing
BiteSize.blog
ReaderFavorites
- CSS Image Framing
- Tools of the Web Design Trade, Pt.1: Where to Begin
- Tools of the Web Design Trade, Pt.2: Building Trust
- 10 Tips For Creating Website Mockups In Photoshop
- Movable Type As A Desktop App
- Redesign, Part 1: The Logo
- Redesign, Part 2: Stylesheet Philosophy
- The Social Graph in Plain Language
- Writing Your Own Autobiography: The New Persistence of Information
- Designing eComm 2008


















22 August 20051. Dan Wolfgang:
An excellent little piece of code!
And I agree 100%, displaying more than a screen of categories and years of monthly archives doesn't help anyone. (In fact, I often wonder how useful monthly archives are to the average user!)