Archive Date Header Plugin

Freshness Warning
This article is over 9 years old. It's possible that the information you read below isn't current.

In the Movable Type support forums I’ve seen requests for the ability to group archives by date. Most of the time, people want to have an archive index that looks something like:

2002 August July June May April March February January

2001
December November October September August July June May April March February January

There have been a few people that have posted solutions using PHP or JavaScript, but I thought it would be nice to do this straight out of Movable Type.

Thus the Archive Date Header plugin was born.

Tim Appnel has taken over the maintenance and support of this plugin as of Oct 2004.

Download

You can get this plugin by downloading ArchiveDateHeader.zip

Installation

Unzip ArchiveDateHeader.zip and connect to your FTP server and open the directory where you have Movable Type installed.

Create a directory there called plugins if there isn’t one already and copy ArchiveDateHeader.pl to the plugins directory.

Using the plugin

Once you’ve installed the plugin you will have a new container tag, MTArchiveDateHeader. The tag only works within an MTArchiveList container tag, and if you try and use it elsewhere, you’ll receive an error.

If you use monthly archives, the contents of this container will only be printed when a new year starts.

If you use weekly archives, the contents of this container will only be printed when a new month starts.

If you use another sort of archive, the contents of this tag won’t be printed at all.

Here’s an example:

<MTArchiveList archive_type="Monthly">
<MTArchiveDateHeader>
<p><b><MTArchiveDate format="%Y"></b></p>
</MTArchiveDateHeader>
<a href="<$MTArchiveLink$>"><MTArchiveDate format="%B"></a> 
</MTArchiveList>

License

Like our other freeware, this plugin is released under the open-source MIT License. In plain English, that means you can do whatever you want with the software, including modifying it, selling it, or eating it, but we’re not responsible for anything that goes wrong.

Revision History

1.0 - August 4, 2002 Initial release.

Rob Novak
August 22, 2003 8:01 AM

If you want to handle Daily archives with per-month headers as well, the following if..elsif..else statement will do it nicely:

if ($at eq “Monthly”) { $thisdate = substr $ts, 0, 4; } elsif ($at eq “Weekly”){ $thisdate = substr $ts, 4, 2; } elsif ($at eq “Daily”){ $this_date = substr $ts, 4, 2; } else { return ”; }

Peter
September 4, 2003 8:27 AM

Forgot to thank you so.. Thanks :)

dvd
November 18, 2003 2:02 PM

To generate nested lists of archives you can use this plugin together with Brad Choate’s MTPerlScript plugin, with your template something like this:

<ul> <MTArchiveList archive_type=”Monthly”>

<MTArchiveDateHeader> <li><$MTArchiveDate format=”%Y”$> <ul> </MTArchiveDateHeader>

<li><$MTArchiveDate format=”%B”$></li>

<MTPerlScript> $a = ‘<MTArchivePrevious><$MTArchiveDate format=”%Y”></MTArchivePrevious$>’; $b = ‘<$MTArchiveDate format=”%Y”$>’; if ($a ne $b) {print “</ul></li>”}; </MTPerlScript>

</MTArchiveList>

</ul>

Example of output:

<ul> <li>2003 <ul> <li>February</li> <li>January</li> </ul> </li> <li>2002 <ul> <li>December</li> <li>November</li> <li>October</li> </ul> </li> </ul>

Trackback from BLOG:RED BICYCLE RECORDS
September 17, 2004 11:30 PM

月別アーカイヴを手短に

Excerpt: しました。 Archive Date Header Pluginを入れて。 ソースも書いてあるので、そちらを参考に。...

Trackback from BnKB
February 16, 2005 11:50 PM

Archive Date Header Plugin

Excerpt: In the Movable Type support forums I’ve seen requests for the ability to group archives by date. Most of the time, people want to have an archive index. There have been a few people that have posted solutions using PHP...

These are the last 15 comments. Read all 19 comments here.

This discussion has been closed.

Follow me on Twitter

Lijit Search

Best Of

  • Comment Spam Manifesto Spammers are hereby put on notice. Your comments are not welcome. If the purpose behind your comment is to advertise yourself, your Web site, or a product that you are affiliated with, that comment is spam and will not be tolerated. We will hit you where it hurts by attacking your source of income.
  • Best of Newly Digital There have been dozens of Newly Digital entries from all over the world. Here are some of the best.
  • Let it go Netscape 4 is six years old.
  • The importance of being good Starbucks is pulling CD burning stations from their stores. That says something interesting about their brand.
  • Google on the desktop Google picks up Picasa, giving them an important foothold on people's PCs.
  • More of the best »

Recently Read

Get More

Subscribe | Archives

9

Recently

invisible Fence (Mar 22)
The New York Times has a paywall now. Sorta. If you don't choose to ignore it.
Black status icon for Chrometa (Mar 17)
Replacing the status icon of Chrometa
Using Google Voice as your voicemail on AT&T (Oct 26)
How I set up my iPhone to use Google Voice as it's voicemail system.
Don Mattingly forced to make coaching change (Sep 17)
New LA Dodgers coach starts to wonder if he knows the rules of baseball at all.
In which Vonage pretends their prices haven't changed (Apr 12)
Translating what Vonage marketing says about their price increase into plain English.
Twitter app competition (Apr 12)
Life as a Twitter app developer is far from over.
Twitter app competition (Apr 12)
Life as a Twitter app developer is far from over.
The rest of the world is not like you (Apr 5)
Normal people are different. Keep that in mind when creating or marketing a product.

Subscribe to this site's feed.

Elsewhere

IMified
Build instant messaging applications. (My company)
SacStarts
The Sacramento technology startup community.
Pinewood Freak
Pinewood Derby tips and tricks

Contact

Adam Kalsey

Mobile: 916.600.2497

Email: adam AT kalsey.com

AIM or Skype: akalsey

Resume

PGP Key

©1999-2012 Adam Kalsey.
Content management by Movable Type.