- @await Html.PartialAsync("_LoadingSpinner")
+ @foreach (IBlogPost post in BlogPostService.GetBlogPosts(0))
+ {
+ @await Html.PartialAsync("Partials/_BlogCard", post)
+ }
-
\ No newline at end of file
+@await Html.PartialAsync("Partials/_PageTabs", new ViewDataDictionary(ViewData)
+{
+ ["UrlRoot"] = "/blog",
+ ["Page"] = 0,
+ ["PageCount"] = BlogPostService.GetPageCount(visibility: Visibility.Published)
+})
\ No newline at end of file
diff --git a/OliverBooth/Pages/Blog/Index.cshtml.cs b/OliverBooth/Pages/Blog/Index.cshtml.cs
index 5fa0b34..378ceb2 100644
--- a/OliverBooth/Pages/Blog/Index.cshtml.cs
+++ b/OliverBooth/Pages/Blog/Index.cshtml.cs
@@ -36,7 +36,7 @@ public class Index : PageModel
return _blogPostService.TryGetPost(wpPostId, out IBlogPost? post) ? RedirectToPost(post) : NotFound();
}
- private IActionResult RedirectToPost(IBlogPost post)
+ private RedirectResult RedirectToPost(IBlogPost post)
{
var route = new
{
diff --git a/OliverBooth/Pages/Blog/List.cshtml b/OliverBooth/Pages/Blog/List.cshtml
new file mode 100644
index 0000000..61fb3d8
--- /dev/null
+++ b/OliverBooth/Pages/Blog/List.cshtml
@@ -0,0 +1,23 @@
+@page "/blog/page/{pageNumber:int}"
+@model List
+@using OliverBooth.Common.Data
+@using OliverBooth.Common.Data.Blog
+@using OliverBooth.Common.Services
+
+@inject IBlogPostService BlogPostService
+
+@await Html.PartialAsync("Partials/_MastodonStatus")
+
+
+ @foreach (IBlogPost post in BlogPostService.GetBlogPosts(Model.PageNumber))
+ {
+ @await Html.PartialAsync("Partials/_BlogCard", post)
+ }
+
+
+@await Html.PartialAsync("Partials/_PageTabs", new ViewDataDictionary(ViewData)
+{
+ ["UrlRoot"] = "/blog",
+ ["Page"] = Model.PageNumber,
+ ["PageCount"] = BlogPostService.GetPageCount(visibility: Visibility.Published)
+})
\ No newline at end of file
diff --git a/OliverBooth/Pages/Blog/List.cshtml.cs b/OliverBooth/Pages/Blog/List.cshtml.cs
new file mode 100644
index 0000000..f0aa6dd
--- /dev/null
+++ b/OliverBooth/Pages/Blog/List.cshtml.cs
@@ -0,0 +1,32 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+namespace OliverBooth.Pages.Blog;
+
+///
+
+
+
+
+ @author.DisplayName
+ •
+ @verb @time.Humanize()
+
+
+
+ @Html.Raw(BlogPostService.RenderExcerpt(Model, out bool trimmed))
+
+
+ @if (trimmed || Model.Excerpt is not null)
+ {
+
+
+ Read more...
+
+
+ }
+
+
+
+ @foreach (string tag in Model.Tags)
+ {
+
@tag
+ }
+
\ No newline at end of file
diff --git a/OliverBooth/Pages/Shared/Partials/_PageTabs.cshtml b/OliverBooth/Pages/Shared/Partials/_PageTabs.cshtml
new file mode 100644
index 0000000..6293a4f
--- /dev/null
+++ b/OliverBooth/Pages/Shared/Partials/_PageTabs.cshtml
@@ -0,0 +1,21 @@
+@{
+ var urlRoot = ViewData["UrlRoot"]?.ToString() ?? string.Empty;
+ var page = (int)(ViewData["Page"] ?? 1);
+ var pageCount = (int)(ViewData["PageCount"] ?? 1);
+
+ var utility = new PageTabsUtility
+ {
+ CurrentPage = page,
+ PageCount = pageCount,
+ UrlRoot = urlRoot
+ };
+}
+