@page @using Humanizer @using OliverBooth.Data.Blog @using OliverBooth.Services @model OliverBooth.Pages.Blog.Index @inject BlogService BlogService @foreach (BlogPost post in BlogService.AllPosts) { BlogService.TryGetAuthor(post, out Author? author); DateTimeOffset published = post.Published; DateTimeOffset timestamp = post.Updated ?? published; bool isUpdated = post.Updated.HasValue; var year = published.ToString("yyyy"); var month = published.ToString("MM"); var day = published.ToString("dd"); bool isLegacyPost = post.WordPressId is not null; string disqusDomain = isLegacyPost ? "https://blog.oliverbooth.dev" : "https://oliverbooth.dev/blog"; string disqusId = isLegacyPost ? $"{post.WordPressId} {disqusDomain}/?p={post.WordPressId}" : post.Id.ToString();
@author?.Name • @(isUpdated ? "Updated" : "Published") @timestamp.Humanize() @if (post.EnableComments) { • 0 Comments }
@Html.Raw(Model.SanitizeContent(Model.TrimContent(post.Body, out bool trimmed)))