@model Orchard.Blogs.ViewModels.BlogPostArchiveViewModel
@using Orchard.Blogs.Extensions;
@{
Style.Require("BlogsArchives");
Script.Require("BlogsArchives");
}
@T("Archives")
@if (Model.Archives.Count() > 20) {
@{
int lastYear = Model.Archives.First().Key.Year;
int firstYear = Model.Archives.Last().Key.Year;
}
@for (int year = lastYear; year >= firstYear; year--) {
var yearMonths = Model.Archives.Where(m => m.Key.Year == year);
if (year == lastYear) {
-
@year
}
if (year != lastYear) {
-
@year (@yearMonths.Sum(ym => ym.Value))
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
}
}
}
else if (Model.Archives.Count() > 0) {
@Html.UnorderedList(Model.Archives, (t, i) => Html.Link(string.Format("{0:MMMM yyyy} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
}
else {
@T("None found")
}