Full Speed

[ August 14, 2003 ]

Calendar Fix

I’m not a big fan of Movable Type’s default calendar setup. With individual archiving enabled, the links for each day on the calendar take you to the last entry from that day. I think that it makes much more sense for that link to send you to a daily archive for that day. So now my calendar does just that.

Here’s how it works. First, I installed Brad Choate’s MT Regex Plugin. Next, I added a regex line at the top of my main index template:

<MTRegexDefine>s|^(.*/)[^/]*$|$1|</MTRegexDefine>

This regular expression removes everything after the final slash in the url for the calendar links. This works for my site’s setup because my daily archive is the index for the directory that contains that day’s articles. Different configurations might need some tweaking. For reference, here’s how I have my archiving configured:

Individual<$MTArchiveDate format="%Y/%m/%d/"$><$MTEntryTitle dirify="1"$>.fs
Daily<$MTArchiveDate format="%Y/%m/%d/"$>index.fs
Monthly<$MTArchiveDate format="%Y/%m/index.fs"$>
Category<$MTArchiveCategory dirify="1"$>/index.fs

I apply the regular expression to the calendar links by changing the MTEntryLink tag in the calendar to the following:

<$MTEntryLink regex="1"$>

Save, rebuild, and you now have a calendar that links to daily archives.

Possibly Related:

© 2014 Scott Johnson
• •