Industry guru Dave Taylor offers free tech support on a wide variety of technical and business topics, including HTML, Apple iPhone, online advertising, Cascading Style Sheets, Web design, management, Unix, Linux, search engine optimization, online dating, Mac OS X, shell script programming and Microsoft Windows.

How do I customize my archive filename format in Movable Type 4?

I've been using Movable Type almost as long as you have, Dave, and just noticed that the way you name your blog entry archives is pretty different to how Movable Type 4 does it by default. I'm setting up a new blog for my sister and would like to see if I can mirror your archive filename format. My question is: how do you change the template file naming scheme in MT4?


Dave's Answer:

What we have here are two cases of imitation being the sincerest form of flattery, I think. First off, I appreciate that you want to mimic how I've been doing things for quite a long time, but it's also interesting to see that the default file naming scheme for Movable Type appears to have changed when they switched from MT3 to MT4, switched to mimic what WordPress had been doing for a while.

Specifically, MT used to have individual archive filenames look like this:

http://domainname/beginning_of_blog_title.html

Then WordPress came along and they realized that it is possible to have more than one blog entry with the same title, even if rather inadvertently. To avoid that, they use the date as part of the filename:

http://domainname/YYY/MM/beginning_of_blog_title.html

So a blog entry published on May Day of 2009 might look like 2009/05/my_blog_entry.html

Not exactly how I like to organize things, as you can see by checking out the URL for this page.

To make this change in MT, however, is a bit tricky, especially if you're used to MT3, as I have been for so many years!

Here's the path you need...

Start by going to the templates area of the design menu:

mt4 design templates

About halfway down the page, you'll see the default template for individual, category and date archive pages:

mt4 archive templates

What I'm going to change here is the individual entry template: the others I will leave as-is because they're fine, and it makes some sense for date archives to be neatly tucked into different directories, I think, anyway.

To get to the individual entry, I click on "Entry", as shown above. The result is a page that shows the actual MT template, but if you scroll down (the secret!) underneath that you'll see:

mt4 template options

That's where we want to make these modifications. Click on the little triangle adjacent to "Template Options" and it opens up to show you the configuration. Click on the menu there and you'll see there are quite a few archive template choices:

mt4 template archive mapping

Since I want to do something that's a bit off the beaten track, apparently, it's not a default choice, so I'll have to pick "Custom..."

This puts me here:

mt4 template archive mapping default

Now I need to learn the secret "%" language of the MT template. Fortunately, that's exhaustively defined here: Archive file path specifiers in MT4. By reading that, I learn that what I want is to use %b%x to get the title of the blog entry followed by the standard filename suffix (".html" in this case). If I wanted to use dashes instead of underscores, I'd make it "%-b" instead, and on my new weblog, I'm actually using the template "%-b-%E%x" to add the entry number as a way of sidestepping the possibility of two blog entries with the exact same title.

I hope that helps you tweak Movable Type to work exactly as you need.



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments
Rather amazingly, there are no comments on this article yet.

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.








Ask Dave Taylor: The iPhone App: Advertisement



Follow me on Twitter @DaveTaylor

Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Book Links
© 2002 - 2010 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.