refactor: move blog to new asp area

This commit is contained in:
Oliver Booth 2023-08-11 14:08:14 +01:00
parent 3c6a2209c2
commit c2deccafae
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61
8 changed files with 10 additions and 9 deletions

View File

@ -1,8 +1,8 @@
@page "/blog/{year:int}/{month:int}/{day:int}/{slug}"
@page "/blog/{year:int}/{month:int}/{day:int}/{slug}"
@using Humanizer
@using OliverBooth.Data.Blog
@using OliverBooth.Services
@model OliverBooth.Pages.Blog.Article
@model OliverBooth.Areas.Blog.Pages.Article
@inject BlogService BlogService
@if (Model.Post is not { } post)

View File

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using OliverBooth.Data.Blog;
using OliverBooth.Services;
namespace OliverBooth.Pages.Blog;
namespace OliverBooth.Areas.Blog.Pages;
/// <summary>
/// Represents the page model for the <c>Article</c> page.

View File

@ -1,5 +1,5 @@
@page
@model OliverBooth.Pages.Blog.Index
@model OliverBooth.Areas.Blog.Pages.Index
@{
ViewData["Title"] = "Blog";

View File

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using OliverBooth.Data.Blog;
using OliverBooth.Services;
namespace OliverBooth.Pages.Blog;
namespace OliverBooth.Areas.Blog.Pages;
public class Index : PageModel
{

View File

@ -1,2 +1,2 @@
@page "/blog/{year:int}/{month:int}/{day:int}/{slug}/raw"
@model OliverBooth.Pages.Blog.RawArticle
@model OliverBooth.Areas.Blog.Pages.RawArticle

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using OliverBooth.Data.Blog;
using OliverBooth.Services;
namespace OliverBooth.Pages.Blog;
namespace OliverBooth.Areas.Blog.Pages;
/// <summary>
/// Represents the page model for the <c>RawArticle</c> page.

View File

@ -39,7 +39,7 @@
<a asp-page="/index">About</a>
</li>
<li>
<a asp-page="/blog/index">Blog</a>
<a asp-area="Blog" asp-page="/index">Blog</a>
</li>
<li>
<a asp-page="/tutorials/index">Tutorials</a>

View File

@ -80,6 +80,7 @@ app.UseRouting();
app.UseAuthorization();
app.MapControllers();
app.MapControllerRoute("scoped", "{area:exists}/{controller=Home}/{action=Index}/{id?}");
app.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
app.MapRazorPages();
app.MapRssFeed("/blog/feed");