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 a Main Index | Up | Creating a Master Archive Index »

Chapter 3: Templates and Layout

Creating an Archive Template

Problem

You want to create pages that provide different views of a weblog's entries.

Solution

Create an archive template that is mapped to a particular archive type.

Discussion

Archive Templates allows for pages to be created for different views of the weblog's entries. MT supports a few date-based archives -- daily, weekly, and monthly -- in addition to individual entry and category archives. These templates are used to create multiple pages, one for each "unit" (time-period, entry or category) of the archive.

Movable Type ships with Archive Templates for every type of archive. However, merely having archive templates in your weblog is not enough; archive pages will not be generated unless the archive type is enabled in the Archiving Mapping section of the Publishing Settings tab. These settings also enable you to control the naming of archives and create alternate archive templates. See "Controlling the Naming of Archive Pages" and "Creating an Alternate Archive Template" for more information.

Date-based and Category-based Archive Templates

The implied context for these Archive Templates is the current weblog and a selection of entries for a particular time-period or category. Unless instructed differently through its attributes, the MTEntries tagset will list all entries for the category in context.

Because of the adaptive nature of the MTEntries tag we can reuse the same markup in our discussion of the Main Index template (see "Creating a Main Index") and add an archive title. Reusing an entry's layout is entirely at your discretion. MT allows you to create completely unique layouts for each archive if you so choose.

 <h2><$MTArchiveTitle$></h2>
 <MTEntries>
   <h3><$MTEntryTitle$></h3>
   <p><$MTEntryExcerpt$></p>
   <p>
      <a href="<$MTEntryPermalink$>">Continue reading
       "<$MTEntryTitle$>"</a>
   </p>
   <p>Posted by <$MTEntryAuthor$> at <$MTEntryDate format="%X"$></p>
 </MTEntries>

Tags prefixed with MTArchive, such as MTArchiveTitle from this example, are a class of tags for displaying information about archives. These tags used can be used in any Archive Template or in the context of a MTArchiveList tagset.

For more on what these tags see Appendix A.

Individual Entry Archive Templates

Individual Entry Archives have an implied context of one particular entry within the current weblog. Unlike date-based and category-based archives, a MTEntries tag is not needed. While entirely valid when used in an Individual Archive Template, using them in that situation does not make a lot of sense. The MTArchive tags, if they display anything at all, will display information that can be retrieved using MTEntry tags.

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.