Home > Movable Type month-by-year archive template

Movable Type month-by-year archive template

July 21, 2009Mike2 comments

On the Movable Type forums, someone asked at one point how to create an archive template which breaks down the monthly archives by year. I thought it was an interesting and novel experiment, so I modified my archives template to do that.

Just download the file linked below, and merge it into your archive template if you want to do that. All of the content inside the alpha-inner <div> tag is for handling that use case. The only other thing that needs to be done is to publish yearly archives. Go to your monthly listing archives, in the template manager, and add a new mapping to them for yearly archives and save that change.

month-by-year-archives.tmpl.txt
Categories: Tags: , , ,
  1. July 30, 2009 at 09:25 | #1

    Mike-
    This is great, thanks! Is there a way to also list the actual post titles under the month? For example:

    Annual Archives for 2009
    July 09
    27 This would be a title
    21 This is another title

    June 09
    10 Yet another title
    02 Another title with no meaning

    If you could point me in a direction that allows that, my boss' prayers would be answered.

    TIA!

  2. July 30, 2009 at 09:42 | #1

    Yes. Take a look at the way that I nested the monthly archive listing inside of the yearly archive listing, and add another level of nesting inside the template (specifically, inside the monthly listing) for individual archives. You can base it directly on the monthly listing markup, just adjusting the tags to specify Individual instead of monthly.

    The caveat to this is that publishing this archive will be very expensive in CPU time and memory if you have a lot of posts. If you have more than a few hundred posts that it will have to list, then I would have to emphatically recommend that you configure the publish queue (documentation is on MT.org or easily found by doing a Google search) and set this archive template to be published by the publish queue rather than published statically.