Chapter 3: Templates and Layout
Creating a Master Archive Index
Problem
You want to create a master index of your weblog's archives.
Solution
Create an index template using MTArchiveList and related
tags.
Discussion
In "Creating an Archive Template" we discussed how
to create pages that provide different views of a weblog's entries. No
matter what type of archiving you use, you are likely to need a master list
of all of your archives. Movable Type ships with such a listing as a
template named Master Archive Index. In MT, the Master Archive Index is
just an index template that uses the MTArchiveList tagset
instead of MTEntries.
Tags such as MTArchiveList are a class of tags for
displaying information about archives. These types of tags can be
identified by their MTArchive prefix.
MTArchiveList is a container tag representing a list of all
of your archive pages and can be used in any template to create a context
that all the other MTArchive tags can use.
<MTArchiveList>
<a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a><br/>
</MTArchiveList>
Additionally, you can use a MTEntries tag to display
information about the entries in a particular archive. For example:
<MTArchiveList>
<p>
<a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a><br/>
<MTEntries>
[<$MTEntryTitle$>]<br/>
</MTEntries>
</p>
</MTArchiveList>
This will display a link to the archive page, followed by a list of entry titles.
This tag takes two attributes archive_type and
lastn. archive_type that specify the type of
archive to list with values of "Individual," "Daily," "Weekly" or
"Monthly." lastn limits the number of archives that will be
listed.
The attribute archive_type is optional. If omitted, the
listing will use the Preferred Archive Type setting. This attribute is
useful when you have selected more than one value for the weblog's Archive
Type, and you wish to list something other than your Preferred Archive
Type. For example, if you have chosen to keep both Individual
and Daily archives, and your Preferred Archive Type is
Individual, you can list your Daily archives
using this tagset:
<MTArchiveList archive_type="Daily">
...
</MTArchiveList>
lastn can be used to limit the number of archives in the
list. For example, if you have 10 months worth of archives in your weblog,
and you only wish to list the last five monthly archives you could use this
tagset:
<MTArchiveList archive_type="Monthly" lastn="5">
...
</MTArchiveList>
For the full list of archive-related tags see Appendix A.



