diff --git a/zotan.pw-web/Pages/Shared/_Layout.cshtml b/zotan.pw-web/Pages/Shared/_Layout.cshtml
index 936151c..2e9bf28 100644
--- a/zotan.pw-web/Pages/Shared/_Layout.cshtml
+++ b/zotan.pw-web/Pages/Shared/_Layout.cshtml
@@ -13,6 +13,7 @@
zotan.pw >> @ViewData["title"]
}
+ @await RenderSectionAsync("head", false)
@@ -35,7 +36,7 @@
}
- @await RenderSectionAsync("head", false)
+ @await RenderSectionAsync("postheader", false)
diff --git a/zotan.pw-web/Pages/blog/Blog.cshtml b/zotan.pw-web/Pages/blog/Blog.cshtml
index f23a390..1a4acde 100644
--- a/zotan.pw-web/Pages/blog/Blog.cshtml
+++ b/zotan.pw-web/Pages/blog/Blog.cshtml
@@ -5,6 +5,10 @@
ViewData["desc"] = "Blog of a disabled neurodivergent queer person unhappy with the state of the world.";
}
+@section head {
+
+}
+
Hey there, welcome to the blog of a disabled neurodivergent queer person unhappy with the state of the world.
This is where I post about things that make it somewhat fun, things that help me with life in general or just things I felt like sharing.
Posts
diff --git a/zotan.pw-web/Pages/blog/JsonFeed.cs b/zotan.pw-web/Pages/blog/JsonFeed.cs
index 4ccad36..18941e6 100644
--- a/zotan.pw-web/Pages/blog/JsonFeed.cs
+++ b/zotan.pw-web/Pages/blog/JsonFeed.cs
@@ -1,10 +1,48 @@
+using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
using Microsoft.AspNetCore.Mvc;
-namespace zotanpw_web.Pages.blog;
+namespace zotanpw_web.Pages.blog;
+[ApiController, Route("/blog/feed.json")]
public class JsonFeed : Controller {
- // GET
- public IActionResult Index() {
- return View();
+ public static readonly JsonFeedObject Feedobj = new JsonFeedObject {
+ Items = BlogModel.Posts.Take(10).Select(post => new JsonFeedItem(post.Shorthand, $"https://zotan.pw/blog/{post.Shorthand}", post.Title, post.Content,
+ post.PublishedOn.ToDateTime(TimeOnly.MinValue).ToString("O")))
+ .ToList()
+ };
+
+ [HttpGet]
+ public JsonFeedObject Get() {
+ Response.ContentType = "application/json";
+ return Feedobj;
}
-}
\ No newline at end of file
+
+ public class JsonFeedObject {
+ [J("version")] public string Version => "https://jsonfeed.org/version/1.1";
+ [J("language")] public string Language => "en";
+ [J("title")] public string Title => "zotan.pw >> blog";
+ [J("description")] public string Description => "Blog of a disabled neurodivergent queer person unhappy with the state of the world";
+ [J("home_page_url")] public string HomeUrl => "https://zotan.pw/blog";
+ [J("feed_url")] public string FeedUrl => "https://zotan.pw/blog/feed.json";
+
+ // TODO: favicon/icon
+
+ [J("items")] public List Items { get; init; } = new();
+ }
+
+ public class JsonFeedItem {
+ public JsonFeedItem(string id, string url, string title, string contentHtml, string datePublished) {
+ _id = id;
+ _url = url;
+ _title = title;
+ _contentHtml = contentHtml;
+ _datePublished = datePublished;
+ }
+
+ [J("id")] public string _id { get; }
+ [J("url")] public string _url { get; }
+ [J("title")] public string _title { get; }
+ [J("content_html")] public string _contentHtml { get; }
+ [J("date_published")] public string _datePublished { get; }
+ }
+}