archive pages by date.

Topics: Administration, General
Dec 11, 2013 at 10:02 AM
Hi!
I have created a new content type which allows me to input race details i.e.
Name of Race, date of race, link to race website. It outputs a page with all the races I've posted.

http://runningbeside.me/races

What I would like to do is organise them by date / year so that it's a bit easier to look at. e.g. I would have a list of years, then within that page I would have a list of months.

2013
-Jan
-Feb
-March
...
2012
-Jan
-Feb
...

Then within the months I could click on a race title.

How easy is this to implement when I already have pages created?

Thanks,
Dec 13, 2013 at 1:33 PM
Hi,
Thought there may have been an easy way to do this but since I've had no replies I guess not.

Can anyone help?

Thanks,
Owain.
Developer
Dec 13, 2013 at 2:11 PM
One relatively easy way to do this is by using the Shape layout (which you can choose when you add a Layout to your Query), for which you would provide a Razor view, in which you do this rendering yourself.
Your Razor view's model would contain a property that I believe is called "ContentItems", which is a list of all yielded content items. Each content item has access to the date of the race, so you can use LINQ to first group by year. You would start iterating over the years, and for each item of the current year you would group by month and render those. Then you render each content item link for the month.
Dec 13, 2013 at 2:30 PM
Thanks! Can all this be done via the admin dashboard?

I've found the 'Edit shape layour' screen which seems to be the place you are talking about but after that, I'm lost!