I’m trying to create a news archive in umbraco, where it would display a list of news pages organised by month. Each page would display a listing of the news items of that month.
I’ve followed the tutorial for creating news items, but I’m not sure how to create an archive. There doesn’t seem to be any references to do this online either. Surely it’s a common use case for the CMS.
Anyone have any ideas (preferably in razorscript if coding is required)?
I ended up using the datefolders package, which automatically sorts the news items into the correct year and month folder based on a predefined date field, much like @amelvin response. The benefit of datefolders is that it simplifies the user having to manually sort their articles into the right folder and maintain that organisation. They can just right click the news container item, create the article, set the date, and it’ll just appear in the right folder. Also, it changes the folder when the date is changed.
In terms of the display of the archives, I had the following razor code, where
NewsListingis the news items listing document type, andNewsItemis the news item document type:Archive listing in the sidebar
Month archive page