During the template modularization in MT4 we realized that we could combine the Date-Based Archive and the Category Archive templates because they essentially provided the same functionality, they output a list of entries, and thus the Entry Listing template was created.
In addition to category and date-based archives we added the ability to create author archives. To make sure that author and category archives didn't get too big, we updated each of them to only show the most recent entries (of course this default behaviour can easily be changed).
Because the author and category archives now only displayed recent entries we needed a way to display the older entries. To do this we combined the date-based template with author and category to offer the following template mappings:
Movable Type 4 Template Mappings
- Daily
- Weekly
- Monthly
- Yearly
- Category
New in Movable Type 4.0
- Category-Daily
- Category-Weekly
- Category-Monthly
- Category-Yearly
- Author
- Author-Daily
- Author-Weekly
- Author-Monthly
- Author-Yearly
One Template, Many Mappings
You can have one template per archive mapping, say one for categories, one for monthly, another for author-monthly... but if there is not very much differentiation within the templates you can use one template and then condition various portions where there are differences.
Now because all these archive types could be created using the Entry Listing template, we wanted to provide a method for a template editor to do different. To do this various variables are set in the app for each archive mapping. The value of these variables can be used to condition content in the template.
For example, you have one entry lising archive template which is used to publish the following archive types:
- monthly
- category
- category-monthly
- author
- author-monthly
Your goal is to place a link to the home page of your site on all the pages that are date-based: monthly, category-monthly, and author-monthly. Here's the code you would place in the entry listing template:
<mt:if name="datebased_archive">
<a href="http://www.domain.com">home page</a>
</mt:if>
If you want add a link for category-monthly and author-monthly you could do this:
<mt:if name="category_monthly_archive">
<$mt:setvar name="foo" value="1"$>
<mt:else name="author_monthly_archive">
<$mt:setvar name="foo" value="1"$>
</mt:if>
<mt:if name="foo">
<a href="http://www.domain.com">home page</a>
</mt:if>
So that's basically how it works. Should you wish to dig deeper, the archive variables are set in $MT_DIR/lib/MT/WeblogPublisher.pm.
Below is a summary of the auto-created variables in archive and system templates, as well as the manually created variables in system and index templates.
Template Variables
Entry & Page Archives
Entry
- archive_class: entry-archive
- entry_archive: 1 (this var added in 4.15)
- archive_template: 1
- entry_template: 1
- feedback_template: 1
Page
- archive_class: page-archive
- page_archive: 1
- archive_template: 1
- page_template: 1
- feedback_template: 1
Datebased Archives
Daily
- archive_class: datebased-daily-archive
- datebased_archive: 1
- datebased_only_archive: 1
- datebased_daily_archive: 1
Weekly
- archive_class: datebased-weekly-archive
- datebased_archive: 1
- datebased_only_archive: 1
- datebased_weekly_archive: 1
Monthly
- archive_class: datebased-monthly-archive
- datebased_archive: 1
- datebased_only_archive: 1
- datebased_monthly_archive: 1
- module_monthly_archives: 1 (Deprecated in MT4.1)
Yearly
- archive_class: datebased-yearly-archive
- datebased_archive: 1
- datebased_only_archive: 1
- datebased_yearly_archive: 1
- module_yearly_archives: 1 (Deprecated in MT4.1)
Category Archives
Category
- archive_class: category-archive
- category_archive: 1
- datebased_archive: 0
- module_category-monthly_archives: 1 (Deprecated in MT4.1)
- module_category_archives: 1 (Deprecated in MT4.1)
Category-Daily
- archive_class: category-daily-archive
- category_archive: 1
- datebased_archive: 1
- category_daily_archive: 1
Category-Weekly
- archive_class: category-weekly-archive
- category_archive: 1
- datebased_archive: 1
- category_weekly_archive: 1
Category-Monthly
- archive_class: category-monthly-archive
- category_archive: 1
- datebased_archive: 1
- category_monthly_archive: 1
- module_category-monthly_archives: 1 (Deprecated in MT4.1)
- module_category_archives: 1 (Deprecated in MT4.1)
Category-Yearly
- archive_class: category-yearly-archive
- category_archive: 1
- datebased_archive: 1
- category_yearly_archive: 1
Author Archives
Author
- archive_class: author-archive
- author_archive: 1
- datebased_archive: 0
- module_author-monthly_archives: 1 (Deprecated in MT4.1)
- module_author_archives: 1 (Deprecated in MT4.1)
Author-Daily
- archive_class: author-daily-archive
- author_archive: 1
- datebased_archive: 1
- author_daily_archive: 1
Author-Weekly
- archive_class: author-weekly-archive
- author_archive: 1
- datebased_archive: 1
- author_weekly_archive: 1
Author-Monthly
- archive_class: author-monthly-archive
- author_archive: 1
- datebased_archive: 1
- author_monthly_archive: 1
- module_author-monthly_archives: 1 (Deprecated in MT4.1)
- module_author_archives: 1 (Deprecated in MT4.1)
Author-Yearly
- archive_class: author-yearly-archive
- author_archive: 1
- datebased_archive: 1
- author_yearly_archive: 1
Index Templates
Main Index
- main_index: 1
Archive Index
- archive_index: 1
System Templates
Comment Response
- system_template: 1 (this var added in 4.15)
- comment_response_template: 1 (this var added in 4.15)
- body_class has three variations based upon response type:
- mt-comment-confirmation
- mt-comment-pending
- mt-comment-error
Comment Preview
- system_template: 1 (this var added in 4.15)
- comment_preview_template: 1 (this var added in 4.15)
- body_class: mt-comment-preview
Dynamic Error
- system_template: 1 (this var added in 4.15)
- dynamic_error_template: 1
- body_class: mt-dynamic-error
Search Results
- system_template: 1 (this var added in 4.15)
- search_template: 1
- body_class: mt-search-results
Submit a User Contributed Note
User contributed notes are a great way to share the knowledge you have gained in using Movable Type.
If you have a technical question or problem, please visit Movable Type Support.