The Movable Type User Manual

NOTE: This documentation is for Movable Type 3.2. If you are using a newer version, please see the documentation for Movable type 3.3x or Movable Type Enterprise.

« Creating an Archive Template | Up | Editing a Template using an External Editor »

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.

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Support.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.