Help with archive behavior(s)

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) 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

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

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