# Help with archive behavior(s)

**URL:** <https://www.ruby-forum.com/t/help-with-archive-behavior-s/99353>\
**Category:** Radiant CMS\
**Created:** [July 21, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/help-with-archive-behavior-s/99353 "2006-07-21T22:37:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Brooks](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@Chris\_Brooks](https://www.ruby-forum.com/u/Chris_Brooks)\
**Post date:** [July 21, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/help-with-archive-behavior-s/99353/1 "2006-07-21T22:37:45Z")

</div>

Hi folks,

I’m loving Radiant and so far have been able to answer all of my  
questions  
by reading the various articles out there plus the mailing list archive.  
I’m in the process of converting over my custom Rails-based website (  
[http://www.sunrivergames.com](http://www.sunrivergames.com)) to Radiant.

I’m struggling a bit with the archive behavior, which I’d like to use  
for  
the news portion of the site. I’m using the archive behavior at the  
child  
“News” page and it works great in terms of producing URL-rewritten  
date-based page URLs. I’m _not_ clear, however, on how to take  
advantage of  
the various index behaviors. Has anyone written anything up on these?  
I’d  
like to be able to keep a list monthly or yearly news archive pointers  
in  
the sidebar… I’m sure I can do it but I’m not sure how.

I’ll be happy to publish everything I learn in the Wiki if someone on  
the  
list can get me started in the right direction…

Cheers,

Chris Brooks

---

<div class="post-metadata">

**Author:** ![Chris\_Brooks](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@Chris\_Brooks](https://www.ruby-forum.com/u/Chris_Brooks)\
**Post date:** [July 22, 2006, 4:57am UTC](https://www.ruby-forum.com/t/help-with-archive-behavior-s/99353/2 "2006-07-22T04:57:35Z")

</div>

Chris Brooks wrote:

> I’m struggling a bit with the archive behavior, which I’d like to use for  
> the news portion of the site. I’m using the archive behavior at the child  
> “News” page and it works great in terms of producing URL-rewritten  
> date-based page URLs. I’m _not_ clear, however, on how to take  
> advantage of  
> the various index behaviors. Has anyone written anything up on these? I’d  
> like to be able to keep a list monthly or yearly news archive pointers in  
> the sidebar… I’m sure I can do it but I’m not sure how.

The Styled Blog template demonstrates how to do this. It’s the one that  
is used for the Radiant demo:

[http://radiantcms.org/demo](http://radiantcms.org/demo)

Basically you set up your archives like this:

Archive  
|  
± Archive Day Index  
|  
± Archive Month Index  
|  
± Archive Year Index  
|  
± Article 1  
|  
± Article 2  
|  
~  
~  
|  
± Article 99

Then on your archive index pages you iterate through the children for  
that day/year/month like this:

\<r:archive:children:each order=“desc”\>

### 
 Continue Reading… 

Posted by on

If you want to add a nice sidebar on the archives index you can do  
something like this:

### Archives By Month

- "\>

What the above does is cycle through all of the articles from first to  
last. The header tag is output only when it differs from the last time  
it was called. Essentially this means that you get a nice list of every  
month that you have articles in.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)
