diff --git a/.gitignore b/.gitignore index 625eb62..d292e20 100644 --- a/.gitignore +++ b/.gitignore @@ -186,4 +186,4 @@ Temporary Items database.db .bearer_token -Pages/blog/posts/drafts +Posts/drafts diff --git a/Controllers/AtomFeed.cs b/Controllers/AtomFeed.cs index 88759cb..be7aa49 100644 --- a/Controllers/AtomFeed.cs +++ b/Controllers/AtomFeed.cs @@ -1,7 +1,7 @@ using System.ServiceModel.Syndication; using Microsoft.AspNetCore.Mvc; using zotanpw.Backend; -using zotanpw.Pages.blog; +using zotanpw.Pages; namespace zotanpw.Controllers; diff --git a/Controllers/JsonFeed.cs b/Controllers/JsonFeed.cs index a8adfd5..b42ff74 100644 --- a/Controllers/JsonFeed.cs +++ b/Controllers/JsonFeed.cs @@ -1,5 +1,5 @@ using Microsoft.AspNetCore.Mvc; -using zotanpw.Pages.blog; +using zotanpw.Pages; using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; namespace zotanpw.Controllers; diff --git a/Pages/blog/Blog.cshtml b/Pages/Blog.cshtml similarity index 100% rename from Pages/blog/Blog.cshtml rename to Pages/Blog.cshtml diff --git a/Pages/blog/Blog.cshtml.cs b/Pages/Blog.cshtml.cs similarity index 92% rename from Pages/blog/Blog.cshtml.cs rename to Pages/Blog.cshtml.cs index 713e4c8..6a59a8f 100644 --- a/Pages/blog/Blog.cshtml.cs +++ b/Pages/Blog.cshtml.cs @@ -8,13 +8,13 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; -namespace zotanpw.Pages.blog; +namespace zotanpw.Pages; public class BlogModel : PageModel { public static readonly List Posts = new(); static BlogModel() { - foreach (var file in Directory.EnumerateFiles("Pages/blog/posts")) + foreach (var file in Directory.EnumerateFiles("Posts")) if (file.EndsWith(".md")) Posts.Add(new BlogPost(Path.GetFileNameWithoutExtension(file))); @@ -37,7 +37,7 @@ public class BlogModel : PageModel { } public void UpdateContentAndMetadata() { - var markdownText = System.IO.File.ReadAllText($"Pages/blog/posts/{Shorthand}.md"); + var markdownText = System.IO.File.ReadAllText($"Posts/{Shorthand}.md"); var parsed = ParseBlogPost(markdownText); Title = parsed.metadata.Title!; diff --git a/Pages/blog/BlogPost.cshtml b/Pages/BlogPost.cshtml similarity index 100% rename from Pages/blog/BlogPost.cshtml rename to Pages/BlogPost.cshtml index 1be7361..64c0581 100644 --- a/Pages/blog/BlogPost.cshtml +++ b/Pages/BlogPost.cshtml @@ -1,6 +1,6 @@ @page "/blog/{post}" -@model BlogPostModel @using zotanpw.Backend +@model BlogPostModel @{ if (Model.Post == null) diff --git a/Pages/blog/BlogPost.cshtml.cs b/Pages/BlogPost.cshtml.cs similarity index 86% rename from Pages/blog/BlogPost.cshtml.cs rename to Pages/BlogPost.cshtml.cs index 82b82fa..da788f3 100644 --- a/Pages/blog/BlogPost.cshtml.cs +++ b/Pages/BlogPost.cshtml.cs @@ -1,20 +1,18 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -namespace zotanpw.Pages.blog; +namespace zotanpw.Pages; public class BlogPostModel : PageModel { public BlogModel.BlogPost? Post; public IActionResult OnGet() { - if (string.IsNullOrWhiteSpace((string)RouteData.Values["post"]!)) { + if (string.IsNullOrWhiteSpace((string)RouteData.Values["post"]!)) return NotFound(); - } Post = BlogModel.Posts.FirstOrDefault(p => p.Shorthand == (string)RouteData.Values["post"]!); - if (Post == null) { + if (Post == null) return NotFound(); - } return Page(); } diff --git a/Pages/blog/posts/adhd-and-notes.md b/Posts/adhd-and-notes.md similarity index 100% rename from Pages/blog/posts/adhd-and-notes.md rename to Posts/adhd-and-notes.md diff --git a/Pages/blog/posts/ipv6-networking.md b/Posts/ipv6-networking.md similarity index 100% rename from Pages/blog/posts/ipv6-networking.md rename to Posts/ipv6-networking.md diff --git a/Pages/blog/posts/site-update-2022.md b/Posts/site-update-2022.md similarity index 100% rename from Pages/blog/posts/site-update-2022.md rename to Posts/site-update-2022.md diff --git a/Pages/blog/posts/tdor-2022.md b/Posts/tdor-2022.md similarity index 100% rename from Pages/blog/posts/tdor-2022.md rename to Posts/tdor-2022.md