@page "/tutorial/{**slug}"
@using Humanizer
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using OliverBooth.Data
@using OliverBooth.Data.Web
@using OliverBooth.Services
@inject ITutorialService TutorialService
@model Article
@if (Model.CurrentArticle is not { } article)
{
return;
}
@{
ViewData["Post"] = article;
ViewData["Title"] = article.Title;
DateTimeOffset published = article.Published;
}
Tutorials
@{
int? parentId = Model.CurrentArticle.Folder;
while (parentId is not null)
{
ITutorialFolder thisFolder = TutorialService.GetFolder(parentId.Value)!;
@thisFolder.Title
parentId = thisFolder.Parent;
}
}
@Model.CurrentArticle.Title
@article.Title
Published @published.Humanize()
@if (article.Updated is { } updated)
{
•
Updated @updated.Humanize()
}
@Html.Raw(TutorialService.RenderArticle(article))
@if (article.PreviousPart is { } previousPartId &&
TutorialService.TryGetArticle(previousPartId, out ITutorialArticle? previousPart) &&
previousPart.Visibility == Visibility.Published)
{
Previous Part
@previousPart.Title
}
@if (article.NextPart is { } nextPartId &&
TutorialService.TryGetArticle(nextPartId, out ITutorialArticle? nextPart) &&
nextPart.Visibility == Visibility.Published)
{
Next Part
@nextPart.Title
}