Not a developer? Go to MovableType.com

Documentation

Archive File Path Specifiers

Archive mappings are the paths Movable Type creates when it publishes a files using an archive template. Archive mappings determine the URLs of all file published by the archive templates: entries, pages, monthly archives, etc.

One template may have multiple mappings; the author and author-monthly files may be published by the same template and have some conditional logic (mt:If, mt:Else, mt:Unless, etc) using archive template variables).

To create a "Monthly" archive mapping such as:

2008/12/index.html

...use %y for a 4-digit year, %m for a 2-digit month, and %i for the default index file name. Separate the specifiers with forward slashes denoting the path:

%y/%m/%i

To create a "Category" archive mapping such as:

category/sub-category/index.html

...use %-c for a dash-separated category path and and %i for the default index file name separated by slashes like this:

%-c/%i

To create an "Entry" archive mapping like this:

2008/12/entry-basename.html

...use 4-digit year, 2-digit month, and entry basename with the archive file extension specified in publishing preferences:

%y/%m/%-f

Archive File Path Specifiers are used by various Movable Type tags that create links (such as the mt:EntryPermalink tag). When an archive mapping ends with the the directory index--a combination of IndexBasename and the archive file extension specified in publishing preferences, which is "index.html" for most servers--Movable Type will remove it from the url.

Thus if the actual paths to an entry and a monthly archive are like this:

2008/12/entry-basename/index.html
2008/12/index.html

Then Movable Type will create links (respectively) to the above files without the directory index filename:

<a href="2008/12/entry-basename/"><!-- foo entry --></a>
<a href="2008/12/"><!-- foo monthly archive --></a>

Common Archive Paths

The below archive paths suggested values in Movable Type. The default option for each archive type is in bold.

Archive Type Archive Path Specifier String
Entryyyyy/mm/entry-basename.html%y/%m/%-f
Entryyyyy/mm/entry_basename.html%y/%m/%f
Entryyyyy/mm/entry-basename/index.html%y/%m/%-b/%i
Entryyyyy/mm/entry_basename/index.html%y/%m/%b/%i
Entryyyyy/mm/dd/entry-basename.html%y/%m/%d/%-f
Entryyyyy/mm/dd/entry_basename.html%y/%m/%d/%f
Entryyyyy/mm/dd/entry-basename/index.html%y/%m/%d/%-b/%i
Entryyyyy/mm/dd/entry_basename/index.html%y/%m/%d/%b/%i
Entrycategory/sub-category/entry-basename.html%-c/%-f
Entrycategory/sub-category/entry-basename/index.html%-c/%-b/%i
Entrycategory/sub_category/entry_basename.html%c/%f
Entrycategory/sub_category/entry_basename/index.html%c/%b/%i
Pagefolder-path/page-basename.html%-c/%-f
Pagefolder-path/page-basename/index.html%-c/%-b/%i
Pagefolder_path/page_basename.html%c/%f
Pagefolder_path/page_basename/index.html%c/%b/%i
Dailyyyyy/mm/dd/index.html%y/%m/%d/%f
Weeklyyyyy/mm/day-week/index.html%y/%m/%d-week/%i
Monthlyyyyy/mm/index.html%y/%m/%i
Yearlyyyyy/index.html%y/%i
Categorycategory/sub-category/index.html%-c/%i
Categorycategory/sub_category/index.html%c/%i
Category-Dailycategory/sub-category/yyyy/mm/dd/index.html%-c/%y/%m/%d/%i
Category-Dailycategory/sub_category/yyyy/mm/dd/index.html%c/%y/%m/%d/%i
Category-Monthlycategory/sub-category/yyyy/mm/index.html%-c/%y/%m/%i
Category-Monthlycategory/sub_category/yyyy/mm/index.html%c/%y/%m/%i
Category-Weeklycategory/sub-category/yyyy/mm/day-week/index.html%-c/%y/%m/%d-week/%i
Category-Weeklycategory/sub_category/yyyy/mm/day-week/index.html%c/%y/%m/%d-week/%i
Category-Yearlycategory/sub-category/yyyy/index.html%-c/%y/%i
Category-Yearlycategory/sub_category/yyyy/index.html%c/%y/%i
Authorauthor/author-basename/index.htmlauthor/%-a/%f
Authorauthor/author_basename/index.htmlauthor/%a/%f
Author-Dailyauthor/author-basename/yyyy/mm/dd/index.htmlauthor/%-a/%y/%m/%d/%f
Author-Dailyauthor/author_basename/yyyy/mm/dd/index.htmlauthor/%a/%y/%m/%d/%f
Author-Montlyauthor/author-basename/yyyy/mm/index.htmlauthor/%-a/%y/%m/%f
Author-Monthlyauthor/author_basename/yyyy/mm/index.htmlauthor/%a/%y/%m/%f
Author-Weeklyauthor/author-basename/yyyy/mm/day-week/index.htmlauthor/%-a/%y/%m/%d-week/%f
Author-Weeklyauthor/author_basename/yyyy/mm/day-week/index.htmlauthor/%a/%y/%m/%d-week/%f
Author-Yearlyauthor/author-basename/yyyy/index.htmlauthor/%-a/%y/%f
Author-Yearlyauthor/author_basename/yyyy/index.htmlauthor/%a/%y/%f

Editing Archive Mappings

Archive Mappings are found under "Template Options" at the bottom of each archive template.

  1. Navigating to "Design > Templates".
  2. Edit an archive template such as: Entry, Entry Listing, Monthly Entry Listing, etc.
  3. At the bottom of the screen click "Template Options" to reveal the archive mappings associated with a template.

Using Template Tags in Archive Paths

Movable Type template tags can be used directly in the archive mapping.

Warning: users should be aware that the use of template tags, while advantageous in some circumstance, carries with it some risks. There is no absolute guarantee that the output of a template tag and any combined modifier like dirify="1" will be consistent from one version to the next. If you rely on template tags in your archive mappings, please play close attention to the Movable Type change log prior to upgrading to anticipate any changes to relied upon behavior.

For example, to publish entries at a URL like:

2009/September/16/basename.html

Use the mt:EntryDate tag which has additional date formats to produce the archive mapping like this:

%y/<mt:EntryDate format="%B">/%d/%-f

or output the whole date and slashes using the tag:

<mt:EntryDate format="%Y/%B/%d">/%-f

Tips

  • Using a dash after the percent sign will cause the specifier to use dashes instead of underscores. If %a produces melody_nelson, then %-a would produce melody-nelson.
  • In some of the cases the uppercase variants exist and can be used to produce an alternate version of the value returned by the lowercase specifier.

Archive File Path Specifiers

Version-Specific Notes

In Movable Type version 4.261 %-C doesn’t produce dashes. (Bug case #90913.) This is fixed in 4.3. Workaround: use the <mt:CategoryBasename separator='-'> tag directly in a category archive file mapping in place of the %-C specifier.

Dirification (the process of changing a string into a filename-friendly format) changed substantially between Movable Type versions 3 and 4. If your archive paths were built with template tags instead of archive file path specifiers it’s likely that paths have broken. There are a variety of ways to handle this and the right option depends upon specific configuration and requirements: creating redirects and updating basenames are the best things to do though guidance to do that is outside the scope of this document.

Back

Leave a Comment