Archives » December 22nd, 2003

December 22, 2003


Spiffy new archive page for my MT site. The dates link to the monthly archive for that month, but click on the little plus signs for the extra treat. It works in the latest IE, Mozilla and Opera, but there might be other browsers that it falls down on. It uses a simple piece of JavaScript to toggle the visibility of a <div>.

Here’s the Movable Type template:
<MTArchiveList archive_type="Monthly">
<h2><a href="" onclick="hideshow('arch<$MTArchiveDate format="%y%m" $>');return false;">[+]</a> <a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a></h2>
 <div class="list" id="arch<$MTArchiveDate format="%y%m" $>" style="display:none;">
   <p><$MTEntryDate format="%Y-%m-%d" $> [<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a>]</p>

And the JavaScript:
<script type="text/javascript" language="JavaScript1.2">
function hideshow(elementid){
if (document.getElementById){
which = document.getElementById(elementid)
if ("none")""

Add a little bit of CSS to adjust the font sizes and tighten up the margins, and you’ve got yourself a collapsable archive list for Movable Type.

P.S. Yes, I see the footer crawling up underneath the sidebars when the page is too short. That’s one drawback of absolute positioning. Gotta work on a fix.