FAQ: How to change Directory Structure

Question

I do not like the directory structure that results from rebuilding the site. Can I change this somehow?

Answer

You can change both, the names of the generated files and the directory structure. We have to look at two different components.

  • There are several Index Templates. Each of those templates results in exactly one output file being created. The Main Index is most important, as it is responsible for creating the start page of your weblog.
  • Moreover, there are Archive Templates. Each of those templates may result in many different files being created at several locations. For example, there might be one HTML file for each month. And there might be one HTML file for each category.

The output definition for these two types of templates will be done with two different dialogs. For using both dialogs, you will first have to open your project's template list. Enter the project, and then choose »Templates« from the left navigation bar.

  • If you then click on the »Main Index« template, a dialog will appear. In this dialog you can find a textbox labelled »Output File«. In this textbox enter the name and path of the file that is to be created. As only one file is created from an index template, you may not put any generic parts into the filename (as we will do with the archive templates).
  • When looking at the list of templates, there is a link labelled »Edit Archive File Options«. Clicking on that link will show another dialog. For each archive type there may be several templates. For example, you might have two monthly archives - one showing only the entries' titles, the other showing the title and the excerpt. Each of those templates has an »Archive File Template« textbox. This is the place, where the names of the generated HTML files have to be specified. If no value is entered into a textbox, a default value will be taken.

With the archive file templates, the name of the output file must be specified in a generic way. For example, as one category archive will be created for each of your categories, it would be wrong, if we entered cat-arc.html as the output file. All category archives would be written over one file.

Because of this, the names for the archive file templates must be generic. They must contain some Movable Type tags, which are evaluated for a specific template. For example, the name for a category archive might be as follows.

category/<$MTArchiveTitle dirify="1">.html

With this, the output for a category archive will be placed into a directory named »category«. The filename will be category's name. The category name will be dirified: it is modified so that it is a valid filename.

You might be interested in Filename with Underscore or Dash? or Umlauts in Filenames. In these entries, I give additional information about the dirify function.

mgs

Feedback is welcome!

What do you think about this entry? Was it interesting or boring? I would like to hear your comments. If the text was helpful, please consider setting a link to http://www.movable-type-weblog.com/.

No spam please!

For protecting this weblog I have installed the MT-Approval Plugin. You have to view a new comment in preview mode, before it is saved on the server. Moreover, I will view your comment manually, before it is published. You can find more information on the subject in the entry Weblog Spamming Basics.

With an active TypeKey session, your comment will be published immediately.

Post a new comment

TypeKey has temporarily been disabled at this location. Please create your comment without using TypeKey or log in from the preview dialog.




Remember Me?


Comment

Emilio | April 27, 2005 10:08 AM

I do not know english very good. But these entry really helped me much. Thank You.