Original File computed-grouped-archive.cshtml
ArchiveSources: posts/*
ArchiveKey: => GetDateTime("PostDate").ToString("MMMM")
---
<p>
This groups the archive using a computed value to get the "PostDate" month. Note how if <code>GroupKey</code> is defined for the document
we can assume it's the index for a given color, but if it's not then it's the index for all colors.
</p>
@if (Model.ContainsKey(Keys.GroupKey))
{
// An individual month
<h3>@Model.GetString(Keys.GroupKey)</h3>
@foreach (IDocument document in Model.GetChildren())
{
<h5>@Html.DocumentLink(document)</h5>
<p><b>Post Date:</b> @document.GetString("PostDate")</p>
@Html.Raw(document.GetString(Keys.Excerpt))
}
}
else
{
// The main month index
<h3>All Months</h3>
@foreach (IDocument document in Model.GetChildren())
{
<h5>@Html.DocumentLink(document)</h5>
}
}
This groups the archive using a computed value to get the "PostDate" month. Note how if GroupKey
is defined for the document
we can assume it's the index for a given color, but if it's not then it's the index for all colors.
May
Pear
Post Date: 5/1/2018
Pears are fruits produced and consumed around the world, growing on a tree and harvested in late Summer into October. The pear tree and shrub are a species of genus Pyrus /ˈpaɪrəs/, in the family Rosaceae, bearing the pomaceous fruit of the same name. Several species of pears are valued for their edible fruit and juices, while others are cultivated as trees.
Cherry
Post Date: 5/2/2018
A cherry is the fruit of many plants of the genus Prunus, and is a fleshy drupe (stone fruit).
Blueberry
Post Date: 5/2/2018
Blueberries are perennial flowering plants with blue or purple berries. They are classified in the section Cyanococcus within the genus Vaccinium. Vaccinium also includes cranberries, bilberries, huckleberries and Madeira blueberries.[1] Commercial blueberries—both wild (lowbush) and cultivated (highbush)—are all native to North America. The highbush varieties were introduced into Europe during the 1930s.[2]