<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>
Skot Nelson
September 2, 2007 12:02 PM | Reply
This:
Doesn't list "Category-Monthly" which is tremendously exciting.
Skot Nelson
September 2, 2007 6:00 PM | Reply
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.
Jerame
January 24, 2010 11:58 AM | Reply
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.
Jerame
replied to comment from Jerame
January 24, 2010 12:41 PM | Reply
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.
Jerame
replied to comment from Jerame
February 21, 2011 10:31 AM | Reply
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.