+ + Read more... + +
+ } +diff --git a/OliverBooth/Pages/Blog/Index.cshtml b/OliverBooth/Pages/Blog/Index.cshtml index b17bfed..565a365 100644 --- a/OliverBooth/Pages/Blog/Index.cshtml +++ b/OliverBooth/Pages/Blog/Index.cshtml @@ -1,16 +1,73 @@ @page +@using Humanizer @using OliverBooth.Data.Blog +@using OliverBooth.Services @model OliverBooth.Pages.Blog.Index +@inject BlogService BlogService -@foreach (BlogPost post in Model.BlogPosts) +@foreach (BlogPost post in BlogService.AllPosts) { -
@post.Published.ToString("MMMM dd, yyyy") • @Model.GetAuthor(post)?.Name
-@Html.Raw(Model.SanitizeContent(Model.TrimContent(post.Body, out bool trimmed)))
- if (trimmed) - { - - } + Author? author = Model.GetAuthor(post); + DateTimeOffset published = post.Published; + 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 + • + + @post.Published.Humanize() + + @if (post.EnableComments) + { + • + + 0 Comments + + } +
+ +@Html.Raw(Model.SanitizeContent(Model.TrimContent(post.Body, out bool trimmed)))
+ ++ + Read more... + +
+ } +