4. Schedule grouped by day
Use the Days group Bevel builds from each session's start time to render a schedule page.
On this page
@* Days is a group Bevel built from Session.Start. Each group has Text, Count, and the Items in it. *@
@foreach (var day in Data.Sessions.Days.OrderBy(d => d.Value))
{
<section class="day">
<h2>@day.Text</h2>
@foreach (var session in day.Items)
{
<SessionCard Session="session"/>
}
</section>
}
You never wrote code to split sessions by day. The [GroupByDate] attribute on Session.Start made Bevel build a Days group for you. This step shows it on a page.
Build a card
Create
Components/SessionCard.razor. One card shows one session. It takes aSessionas a parameter:Components/SessionCard.razorrazor <article class="session"> <p class="when">@Session.Start.ToString("HH:mm") – @Session.End.ToString("HH:mm") · @Session.Room</p> <h3>@Session.Title</h3> <p class="by">@Session.Speaker.Name</p> <p>@Session.Summary</p> </article> @code { [Parameter] [EditorRequired] public Session Session { get; set; } = default!; }You turn the title and the name into links in step 5.
Write the schedule page
Create
Pages/SchedulePage.razor:Pages/SchedulePage.razorrazor @layout MainLayout @inject ISiteData Data <SectionContent SectionName="head"> <title>Schedule — @Data.Site.Title</title> </SectionContent> <h1>Schedule</h1> @foreach (var day in Data.Sessions.Days.OrderBy(d => d.Value)) { <section class="day"> <h2>@day.Text</h2> @foreach (var session in day.Items) { <SessionCard Session="session"/> } </section> }Each group has
Text(the label, such as "Wednesday, May 12"),Value,CountandItems.Map it
Add one line to
Program.cs, after the home route:samples/Bevel.Conference/Program.cscsharp app.MapStatic<SchedulePage>("/schedule");Add a menu link
In
Components/MainLayout.razor, add a nav inside the header, after the brand link:razor <nav> <a href="@(Links.To<SchedulePage>())">Schedule</a> </nav>
Run it
Open /schedule. You should see two day headings, "Wednesday, May 12" and "Thursday, May 13", with session cards under each.

Try it: move one session to another date in its front matter. It jumps to the right day. Give a session a third date and a third day appears.