From becd70c8650a3d42988e2385a3ad490bdba705f9 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 11 Aug 2023 15:42:48 +0100 Subject: [PATCH] fix: use area "blog" for page link --- OliverBooth/Areas/Api/Controllers/BlogApiController.cs | 3 ++- OliverBooth/Areas/Blog/Pages/Index.cshtml.cs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OliverBooth/Areas/Api/Controllers/BlogApiController.cs b/OliverBooth/Areas/Api/Controllers/BlogApiController.cs index d16b396..14aed01 100644 --- a/OliverBooth/Areas/Api/Controllers/BlogApiController.cs +++ b/OliverBooth/Areas/Api/Controllers/BlogApiController.cs @@ -49,9 +49,10 @@ public sealed class BlogApiController : ControllerBase humanizedTimestamp = post.Updated?.Humanize() ?? post.Published.Humanize(), excerpt = _blogService.GetExcerpt(post, out bool trimmed), trimmed, - url = Url.Page("/Blog/Article", + url = Url.Page("/Article", new { + area = "blog", year = post.Published.ToString("yyyy"), month = post.Published.ToString("MM"), day = post.Published.ToString("dd"), diff --git a/OliverBooth/Areas/Blog/Pages/Index.cshtml.cs b/OliverBooth/Areas/Blog/Pages/Index.cshtml.cs index 45f8f06..05971d5 100644 --- a/OliverBooth/Areas/Blog/Pages/Index.cshtml.cs +++ b/OliverBooth/Areas/Blog/Pages/Index.cshtml.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using OliverBooth.Data.Blog; using OliverBooth.Services; @@ -40,11 +40,12 @@ public class Index : PageModel { var route = new { + area = "blog", year = post.Published.Year, month = post.Published.Month, day = post.Published.Day, slug = post.Slug }; - return Redirect(Url.Page("/Blog/Article", route)!); + return Redirect(Url.Page("/Article", route)!); } }