# Nested archives

**URL:** <https://www.ruby-forum.com/t/nested-archives/106016>\
**Category:** Radiant CMS\
**Created:** [June 5, 2007, 6:19pm UTC](https://www.ruby-forum.com/t/nested-archives/106016 "2007-06-05T18:19:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Earl\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3be4f8/32.png) [@Earl\_C](https://www.ruby-forum.com/u/Earl_C)\
**Post date:** [June 5, 2007, 6:19pm UTC](https://www.ruby-forum.com/t/nested-archives/106016/1 "2007-06-05T18:19:59Z")

</div>

I’d like to create a what might be called a nested archive:

- Server Maintenance   
++ Web Server   
++++ Post 1.1  
++++ Post 1.2  
++ Email Server   
+++ Post 2.1  
+++ Post 2.2

Browsing to “Server Maintenance” would show me the latest articles in  
all  
the subtrees (say Post 1.1 and Post 2.1).

Browsing to “Email Server” would only show me those articles collected  
therein.

I get a little strangeness, and probably more to come, implementing as  
shown.

In particular, I wonder what r:children in “Server Maintenance” will do  
when  
confronted with each of the sub-archives (ie “Web Server” and “Email  
Server”).

Am I better off implementing as:

- Server Maintenance   
++ \<r:aggregate “Web Server” “Email Server”\>
- Web Server   
++ Post 1.1  
++ Post 1.2
- Email Server 
- Post 2.1
- Post 2.2

Earl

* * *

Moody friends. Drama queens. Your life? Nope! - their life, your story.  
Play Sims Stories at Yahoo! Games.

---

<div class="post-metadata">

**Author:** ![Earl\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3be4f8/32.png) [@Earl\_C](https://www.ruby-forum.com/u/Earl_C)\
**Post date:** [June 8, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/nested-archives/106016/2 "2007-06-08T22:34:21Z")

</div>

Earl,

Sorry I didn’t get to your message sooner. Figures that the week John  
goes without email, we get flooded with messages to the list!

The default behavior of the Archive page is to organize its child pages  
in a date-based URL fashion. It seems from your setup that the publish  
date of the Web Server and Email Server pages is not significant, but  
the publish date of their children are. Since you’re already using the  
aggregation extension, you’d want a setup like this:

- Server Maintenance (do your r:aggregate tag in this page)  
++ Web Server   
+++ Post 1.1  
+++ Post 1.2  
++ Email Server   
+++ Post 2.1  
+++ Post 2.2

The key to showing all the latest articles of all the subtrees is to  
order the aggregated children in descending order by publish date:

\<r:children:each order=“desc” by=“published\_at” limit=“10”\>…

I do that on my weblog: [http://seancribbs.com/weblog](http://seancribbs.com/weblog) . Here’s the code I  
use:

\<r:aggregate urls=“/tech; /music; /philosophy”\>  
\<r:children:each order=“desc” limit=“6”\>

# 

Posted in | Continue reading...

Notice that /weblog is not even the parent of the primary sections;  
r:aggregate makes no such requirement.

Cheers,

Sean
