zotan.pw-web/Pages/blog/BlogPost.cshtml

26 lines
678 B
Plaintext

@page "/blog/{post}"
@using zotanpw.Backend
@{
if (string.IsNullOrWhiteSpace((string)RouteData.Values["post"]!)) {
return;
}
var post = BlogModel.Posts.FirstOrDefault(p => p.Shorthand == (string)RouteData.Values["post"]!);
if (post == null) {
Response.Redirect("/Error");
return;
}
ViewData["title"] = "blog";
ViewData["subtitle"] = post.Shorthand;
ViewData["desc"] = post.Title;
#if (DEBUG)
post.UpdateContentAndMetadata();
#endif
}
<b>@post.PublishedOn.ToString("yyyy-MM-dd")</b> - @Utils.a_an(post.ReadTimeMinutes) @post.ReadTimeMinutes minute read (150 wpm)
<h1 id="post">@post.Title</h1>
<div style="text-align: justify">
@Html.Raw(post.Content)
</div>