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.
February
Strawberry
Post Date: 2/14/2018
The garden strawberry (or simply strawberry; Fragaria × ananassa)[1] is a widely grown hybrid species of the genus Fragaria, collectively known as the strawberries, which are cultivated worldwide for their fruit. The fruit is widely appreciated for its characteristic aroma, bright red color, juicy texture, and sweetness. It is consumed in large quantities, either fresh or in such prepared foods as jam, juice, pies, ice cream, milkshakes, and chocolates. Artificial strawberry flavorings and aromas are also widely used in products such as candy, soap, lip gloss, perfume, and many others.
Pepper
Post Date: 2/10/2018
The bell pepper (also known as sweet pepper, pepper or capsicum /ˈkæpsɪkəm/)[1] is the fruit of plants in the Grossum cultivar group of the species Capsicum annuum.[2][3] Cultivars of the plant produce fruits in different colours, including red, yellow, orange, green, white, and purple. Bell peppers are sometimes grouped with less pungent pepper varieties as "sweet peppers". While they are fruits—botanically classified as berries—they are commonly used as a vegetable ingredient or side dish.
Banana
Post Date: 2/9/2018
A banana is an elongated, edible fruit – botanically a berry[1][2] – produced by several kinds of large herbaceous flowering plants in the genus Musa.[3] In some countries, bananas used for cooking may be called "plantains", distinguishing them from dessert bananas. The fruit is variable in size, color, and firmness, but is usually elongated and curved, with soft flesh rich in starch covered with a rind, which may be green, yellow, red, purple, or brown when ripe. The fruits grow in clusters hanging from the top of the plant. Almost all modern edible seedless (parthenocarp) bananas come from two wild species – Musa acuminata and Musa balbisiana. The scientific names of most cultivated bananas are Musa acuminata, Musa balbisiana, and Musa × paradisiaca for the hybrid Musa acuminata × M. balbisiana, depending on their genomic constitution. The old scientific name for this hybrid, Musa sapientum, is no longer used.