by
KK » Fri Jun 21, 2013 9:30 pm
The menu on
http://www.tamarawobben.nl/ is something like this -
- Code: Select all
2005
February
May
November
December
2006
January
February
2007
April
...
where the menu consists of two levels - the first one shows only the years that have published pages and the second level shows the months in the parent year.
The months are linked to an archive showing the pages published in that period.
To create this kind of two-tiered menu, we can use the cms:archives tag twice - once to list the years and nested within the top tag we can use the cms:archives tag again to list the months falling in the parent year.
Following is a sample snippet (I've kept the markup simple purposefully. You can easily convert it into UL/LI list)
- Code: Select all
<cms:archives type='yearly' order='asc'>
<cms:date k_archive_date format='Y' /><br />
<cms:archives type='monthly' start_on=k_archive_date stop_before=k_next_archive_date order='asc'>
- <a href="<cms:show k_archive_link />"><cms:date k_archive_date format='F' /></a><br />
</cms:archives>
</cms:archives>
Please note how we use the k_archive_date and k_next_archive_date variables set by the parent 'year' archive to constrain the child archives tag to fetch only months belonging to that year.
A sample output of the code above -
- Code: Select all
2012
- June
2013
- February
- March
- April
Hope this helps.