You are likely going to need to do it with a render controller and custom model.
To get you started :
Model
public class NewsListingModel : IPublishedContent
{
public IEnumerable<string> Categories { get; set; }
public IEnumerable<YearArchive> Years { get; set; }
public class YearArchive
{
public int Year { get; set; }
public IEnumerable<int> Months { get; set; }
}
}
Controller
public class NewsListingController : RenderMvcController
{
public ActionResult NewsListing(BlogListingModel model)
{
model.Years = model.Content.Children.Select(x => x.CreateDate).GroupBy(d => d.Year).Select(y => y.FirstOrDefault()).Select(y =>
new NewsListingModel.YearArchive
{
Year = y.Year,
Months = model.Content.Children.Where(
x => x.CreateDate.Year == y.Year).Select(
x => x.CreateDate.Month
).GroupBy(mg => mg).Select(m=>m.FirstOrDefault())
});
return CurrentTemplate(model);
}
}
You could then then making an archive content type which takes a int month and int year parameter to a controller to filter the children of the node you are after?
Or you could extend the model further so it all happens on the same page?
News Archive
I want to create news archive in umbraco website like this img
You are likely going to need to do it with a render controller and custom model.
To get you started :
Model
Controller
You could then then making an archive content type which takes a int month and int year parameter to a controller to filter the children of the node you are after?
Or you could extend the model further so it all happens on the same page?
Thanks
is working on a reply...