@page "/blog/{year:int}/{month:int}/{day:int}/{slug}"
@using Humanizer
@using OliverBooth.Common.Data.Blog
@using OliverBooth.Common.Services
@inject IBlogPostService BlogPostService
@model Article
@if (Model.ShowPasswordPrompt)
{
This post is private and can only be viewed by those with the password.
return;
}
@if (Model.Post is not { } post)
{
return;
}
@{
ViewData["Post"] = post;
ViewData["Title"] = post.Title;
IAuthor author = post.Author;
DateTimeOffset published = post.Published;
}
@switch (post.Visibility)
{
case BlogPostVisibility.Private:
This post is private and can only be viewed by those with the password.
break;
case BlogPostVisibility.Unlisted:
This post is unlisted and can only be viewed by those with the link.
break;
}
@post.Title
@author.DisplayName •
Published @published.Humanize()
@if (post.Updated is { } updated)
{
•
Updated @updated.Humanize()
}
@if (post.EnableComments)
{
•
0 Comments
}
@foreach (string tag in post.Tags)
{
@tag
}
@Html.Raw(BlogPostService.RenderPost(post))
@if (BlogPostService.GetPreviousPost(post) is { } previousPost)
{
Previous Post
@previousPost.Title
}
@if (BlogPostService.GetNextPost(post) is { } nextPost)
{
Next Post
@nextPost.Title
}
@if (post.EnableComments)
{
}
else
{
Comments are not enabled for this post.
}