oliverbooth.dev/OliverBooth/Pages/Blog/Index.cshtml
Oliver Booth bd999f0ed8
feat: add preliminary /blog routes
This change also introduces toml file config
2023-08-06 15:57:44 +01:00

16 lines
748 B
Plaintext

@page
@using OliverBooth.Data.Blog
@model OliverBooth.Pages.Blog.Index
@foreach (BlogPost post in Model.BlogPosts)
{
<h2>
<a asp-page="/blog/article" asp-route-year="@post.Published.Year" asp-route-month="@post.Published.Month.ToString().PadLeft(2, '0')" asp-route-slug="@post.Slug">@post.Title</a>
</h2>
<p class="text-muted">@post.Published.ToString("MMMM dd, yyyy") &bull; @Model.GetAuthor(post)?.Name</p>
<p>@Html.Raw(Model.SanitizeContent(Model.TrimContent(post.Body, out bool trimmed)))</p>
if (trimmed)
{
<p><a asp-page="/blog/article" asp-route-year="@post.Published.Year" asp-route-month="@post.Published.Month.ToString().PadLeft(2, '0')" asp-route-slug="@post.Slug">Read more...</a></p>
}
}