Learning Movable Type: Adding a Calendar to Your MT Blog


This tutorial is written by LMT author Arvind Satyanarayan of Movalog. Tutorial cross posted on Movalog and LMT.

mtbadge-small.gifWith the release of Movable Type version 3.2, Six Apart opted to not include the calendar feature that had been included by default in earlier versions. The reason for this is that calendars, with the days linking to blog archives, are resource intensive; they can significantly lengthen rebuild times. Six Apart has posted the code that was used in previous versions of MT. However, many users have found that simply copying and pasting the code as given doesn't yield a properly formatted calendar.

The following code will create a calendar that will be correctly formatted and styled according your stylesheet. Simply copy the code and put it in the sidebar section of your index template. A good location would be just above <div class="module-search module">.

<div class="module-calendar module">
<h2 class="module-header"><$MTDate format="%B %Y"$></h2>
<div class="module-content">
<table summary="Monthly calendar with links to each day's posts">

<tr>
<th abbr="Sunday">Sun</th>
<th abbr="Monday">Mon</th>
<th abbr="Tuesday">Tue</th>
<th abbr="Wednesday">Wed</th>
<th abbr="Thursday">Thu</th>
<th abbr="Friday">Fri</th>
<th abbr="Saturday">Sat</th>
</tr>
<MTCalendar>
<MTCalendarWeekHeader><tr></MTCalendarWeekHeader>
<td>
<MTCalendarIfEntries>
<MTEntries lastn="1">
<a href="<$MTEntryPermalink$>"><$MTCalendarDay$></a>
</MTEntries>
</MTCalendarIfEntries>
<MTCalendarIfNoEntries>
<$MTCalendarDay$>
</MTCalendarIfNoEntries>
<MTCalendarIfBlank>&nbsp;</MTCalendarIfBlank></td>
<MTCalendarWeekFooter></tr></MTCalendarWeekFooter>
</MTCalendar>
</table>
</div>
</div>

Posted by Arvind Satyanarayan on November 10, 2005 8:40 PM to Learning Movable Type http://www.learningmovabletype.com/