Not a developer? Go to MovableType.com

Documentation

Template Types in Movable Type

There are five kinds of templates in Movable Type, each distinct from the other mainly by their output and use within the system.

  • Index Templates
  • Archive Templates
  • Template Modules
  • System Templates
  • Widgets

Index Templates

The defining characteristic of Index Templates is that they produce a single page. The default template set includes a number of these types of templates including the weblog’s main index, RSS/Atom feeds, and a stylesheet. In addition, you can create as many other index templates as you wish, specifying the exact location to which they should be published.

Although they can be used for many different purposes, most of the default index templates are used in presenting different views of the blog’s recent entries either in number, sort order or criteria, or having like attributes. For example, in addition to the main index, Master Archive Index, RSS and Atom feeds, you could offer:

  • Alternate formats - The same content on the main index in alternate formats like PDF, WordXML format, or a stripped down page compatible for mobile-devices.

  • Different volume and content - A larger list of your recent entries but with only excerpts

  • Similar attributes - A list of your recent entries with a particular attribute like a single user, category or tag or even only those with recent comments.

  • Sorting - A list of your recent entries sorted by user, category or other attributes.

  • A combination of all - A list of this year’s entries by a particular user and containing a particular entry tag sorted chronologically by date in plain text format.

We’ll discuss the methods by which all of these options are made possible when we look at the content of the templates themselves.

Archive Templates

While Index templates allow you to publish single pages containing groupings of entries matching a specified set of criteria, it would be burdensome to manually create a page for each new category or new month, or worse, a single page for each entry.

Movable Type automates this process through its archive publishing functionality. Movable Type supports three different types of archive templates:

  • Entry listing
  • Entry
  • Page

These three templates are different from each other in that they contain layouts and unique features that are specifically designed for their respective archive types. They are the default templates in use by default archive maps.

Entry listing templates

Entry listing templates are designed to display lists of entries, and be mapped to different archive time periods (daily, weekly, monthly), archive slices (category or author), or the combination of the two (category archives for a particular time period). This happens through Movable Type’s Archive Mapping feature. Learn more about Archive Maps and how to define them.

Here are some common examples of archive types:

  • Monthly archives comprise a single page for each month in which entries were posted, containing all of the entries from that month.

  • Weekly archives comprise a single page for each week in which entries were posted, containing all of the entries from that week.

  • Category archives comprise a single page for each category, containing all of the entries in that category.

  • Date-based category archives comprise a set of pages for each category, containing a paginated set of entries in that category, split by time period. For example, monthly-paginated category archives would contain a page of entries in the Food category for August 2007, a page of entries in the Food category for July 2007, a page of entries in the Food category for June 2007, etc.

  • Author archives comprise a single page for each author who has published entries in the system, containing all of the entries created by that author.

  • Date-based author archives comprise a set of pages for each author, containing a paginated set of entries written by that author, split by time period. For example, monthly-paginated author archives would contain a page of entries authored by Byrne in August 2007, a page of entries authored by Byrne in July 2007, a page of entries authored by Byrne in June 2007, etc.

Entry templates

Entry archive templates are designed to display an individual entry published by Movable Type. These individual entry archives are published at what is commonly known as the “permalink” for each individual entry.

Page templates

Page templates are designed to display an individual page published by Movable Type.

Template Modules

Template Modules are user-defined sub-templates that contain bits of template tags, text, and other markup that can be arbitrarily included in any other template. This allows you to keep all commonly used code in one place so modifications can be made once from one place. They are also very useful for holding large or complicated blocks of code that rarely need editing in order to make the templates themselves simpler.

Template modules are included in other templates using the include tag.

The default templates for new blogs in Movable Type 4 make extensive use of Template Modules. Learn more about the structure of the new default templates.

System Templates

Unlike Index and Archive templates, system templates are special in that they are used by the system in creating pages which serve as a response to particular functionality. These templates and their functions are listed below:

  • Comment Preview Template: Controls the comment preview page, which is displayed when a commenter decides to preview their comment before posting it

  • Comment Reponse Template: Controls the the comment response page, which is displayed to a commenter when their comment is not published immediately. This happens when a comment has been moderated, has been flagged as spam, or when your blog administrator has configured your blog to display a comment confirmation page after comments are submitted by readers. ([Learn more about configuring comment options(../administrator/managing-blogs/settings/comment-settings.html).)

  • Dynamic Error Template: Controls the page that is displayed to users when there is an error with dynamic publishing.

  • Popup Image Template - Controls the popup image page created by the upload image functionality if the user chose to use a popup window.

  • Search Results Template: Controls the results page from the blog’s search interface when only one weblog is searched.

Because the system templates are required in providing certain functionality, they can not be replaced and new ones cannot be created. Also note, the system templates are always rendered dynamically by a Movable Type CGI script regardless of your publishing settings. They are never statically published and do not use the Smarty/PHP-based dynamic engine.

Widgets

Widgets are very similar to Template Modules. They are user-defined sub-templates that contain bits of template tags, text, and other markup. However, instead of being included in your blog with an include tag, they are designed to be managed through Movable Type’s Widget Sets feature. Learn more about Widget Sets in Mobable Type.

Back

2 Comments

HaloX

HaloX on October 30, 2007, 6:38 a.m. Reply

The link for “Learn more about the structure of the new default templates” doesn’t work (404 - Page not found).

http://www.movabletype.org/documentation/designer/default-templates.html

toni.hambilton.myopenid.com

toni.hambilton.myopenid.com on January 9, 2008, 11:12 p.m. Reply

Nit-picky:

“Monthly archives comprise a single page for each month in which entries were posted, containing all of the entries from that week” should read “…containing all entries from that month.”

Leave a Comment