<mt:ArchiveList>

A container tag representing a list of all the archive pages of a certain type.

Attributes:

  • type or archive_type

    An optional attribute that specifies the type of archives to list. Recognized values are "Yearly", "Monthly", "Weekly", "Daily", "Individual", "Author", "Author-Yearly", "Author-Monthly", "Author-Weekly", "Author-Daily", "Category", "Category-Yearly", "Category-Monthly", "Category-Weekly" and "Category-Daily" (and perhaps others, if custom archive types are provided through third-party plugins). The default is to list the Preferred Archive Type specified in the blog settings.

  • lastn (optional)

    An optional attribute that can be used to limit the number of archives in the list.

  • sort_order (optional; default "descend")

    An optional attribute that specifies the sort order of the archives in the list. It is effective within any of the date-based and "Individual" archive types. Recognized values are "ascend" and "descend".

NOTE: You may produce an archive list of any supported archive type even if you are not publishing that archive type. However, the ArchiveLink tag will only work for archive types you are publishing.

Example:

    <mt:ArchiveList archive_type="Monthly">
        <a href="<$mt:ArchiveLink$>"><$mt:ArchiveTitle$></a>
    </mt:ArchiveList>

Here, we're combining two ArchiveList tags (the inner ArchiveList tag is bound to the date range of the year in context):

    <mt:ArchiveList type="Yearly" sort_order="ascend">
        <mt:ArchiveListHeader>
        <ul>
        </mt:ArchiveListHeader>
            <li><$mt:ArchiveDate format="%Y"$>
        <mt:ArchiveList type="Monthly" sort_order="ascend">
            <mt:ArchiveListHeader>
                <ul>
            </mt:ArchiveListHeader>
                    <li><$mt:ArchiveDate format="%b"$></li>
            <mt:ArchiveListFooter>
                </ul>
            </mt:ArchiveListFooter>
            </li>
        </mt:ArchiveList>
        <mt:ArchiveListFooter>
        </ul>
        </mt:ArchiveListFooter>
    </mt:ArchiveList>

to publish something like this:

    <ul>
        <li>2006
            <ul>
                <li>Mar</li>
                <li>Apr</li>
                <li>May</li>
            </ul>
        </li>
        <li>2007
            <ul>
                <li>Apr</li>
                <li>Jun</li>
                <li>Dec</li>
            </ul>
        </li>
    </ul>
This page was last updated on 2008-03-05, 16:33.

5 Notes

This:

An optional attribute that specifies the type of archives to list. Recognized values are "Monthly," "Weekly," "Daily," "Individual" and "Category.

Doesn't list "Category-Monthly" which is tremendously exciting.

glue=", " doesn't work?

Shouldn't this function essentially the same as it did with MTCategories? My impression is that this is now the "preferred" method of generting a list of archives.

The nested archive list example from above doesn't work in MT 4.33. If I pasted in the exact code from above, I get an output of the years, but no months are included.

This is the the exact structure I want for my monthly archives, but I can't seem to get it to work.

Quick update...

If you change "Yearly" to "Author" and "Monthly" to "Author-Monthly" the above code works just fine. So it appears that this only affects date based archives and not others.

I'm now using 4.35 and it's broken again. Using Author-Yearly and Author-Monthly, the Author-Monthly tag doesn't keep the Author-Yearly context - so, for each year, I get output of all the author's monthly archives for every year.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.