2023-08-08 21:01:13 +01:00
|
|
|
@page
|
2023-08-08 01:30:32 +01:00
|
|
|
@using Humanizer
|
2023-08-06 15:57:23 +01:00
|
|
|
@using OliverBooth.Data.Blog
|
2023-08-08 01:30:32 +01:00
|
|
|
@using OliverBooth.Services
|
2023-08-06 15:57:23 +01:00
|
|
|
@model OliverBooth.Pages.Blog.Index
|
2023-08-08 01:30:32 +01:00
|
|
|
@inject BlogService BlogService
|
2023-08-06 15:57:23 +01:00
|
|
|
|
2023-08-08 01:30:32 +01:00
|
|
|
@foreach (BlogPost post in BlogService.AllPosts)
|
2023-08-06 15:57:23 +01:00
|
|
|
{
|
2023-08-08 11:34:41 +01:00
|
|
|
BlogService.TryGetAuthor(post, out Author? author);
|
2023-08-08 01:30:32 +01:00
|
|
|
DateTimeOffset published = post.Published;
|
2023-08-08 02:06:38 +01:00
|
|
|
DateTimeOffset timestamp = post.Updated ?? published;
|
|
|
|
bool isUpdated = post.Updated.HasValue;
|
2023-08-08 01:30:32 +01:00
|
|
|
var year = published.ToString("yyyy");
|
|
|
|
var month = published.ToString("MM");
|
|
|
|
var day = published.ToString("dd");
|
|
|
|
|
|
|
|
<div class="card blog-card" style="margin-bottom: 50px;">
|
|
|
|
<div class="card-body">
|
|
|
|
<h2>
|
|
|
|
<a asp-page="/blog/article"
|
|
|
|
asp-route-year="@year"
|
|
|
|
asp-route-month="@month"
|
|
|
|
asp-route-day="@day"
|
|
|
|
asp-route-slug="@post.Slug">
|
|
|
|
@post.Title
|
|
|
|
</a>
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
<p class="text-muted">
|
2023-08-08 21:01:13 +01:00
|
|
|
<img class="blog-author-icon" src="https://gravatar.com/avatar/@author?.AvatarHash?s=28" alt="@author?.Name">
|
|
|
|
@author?.Name •
|
|
|
|
|
2023-08-08 02:06:38 +01:00
|
|
|
<abbr data-bs-toggle="tooltip" data-bs-title="@timestamp.ToString("f")">
|
|
|
|
@(isUpdated ? "Updated" : "Published") @timestamp.Humanize()
|
2023-08-08 01:30:32 +01:00
|
|
|
</abbr>
|
2023-08-08 21:01:13 +01:00
|
|
|
|
2023-08-08 01:30:32 +01:00
|
|
|
@if (post.EnableComments)
|
|
|
|
{
|
2023-08-08 21:01:13 +01:00
|
|
|
<span> •</span>
|
2023-08-08 01:30:32 +01:00
|
|
|
<a asp-page="/blog/article"
|
2023-08-08 21:01:13 +01:00
|
|
|
asp-fragment="disqus_thread"
|
2023-08-08 01:30:32 +01:00
|
|
|
asp-route-year="@year"
|
|
|
|
asp-route-month="@month"
|
|
|
|
asp-route-day="@day"
|
|
|
|
asp-route-slug="@post.Slug"
|
2023-08-08 21:01:13 +01:00
|
|
|
data-disqus-identifier="@post.GetDisqusIdentifier()">
|
2023-08-08 01:30:32 +01:00
|
|
|
0 Comments
|
|
|
|
</a>
|
|
|
|
}
|
|
|
|
</p>
|
|
|
|
|
2023-08-08 12:46:24 +01:00
|
|
|
<p>@Html.Raw(BlogService.GetExcerpt(post, out bool trimmed))</p>
|
2023-08-08 01:30:32 +01:00
|
|
|
|
|
|
|
<article>
|
|
|
|
@if (trimmed)
|
|
|
|
{
|
|
|
|
<p>
|
|
|
|
<a asp-page="/blog/article"
|
|
|
|
asp-route-year="@year"
|
|
|
|
asp-route-month="@month"
|
|
|
|
asp-route-day="@day"
|
|
|
|
asp-route-slug="@post.Slug">
|
|
|
|
Read more...
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
}
|
|
|
|
</article>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script id="dsq-count-scr" src="https://oliverbooth-dev.disqus.com/count.js" async></script>
|
2023-08-06 15:57:23 +01:00
|
|
|
}
|