feat: use aspnetcore route helper instead of hardcoding url

This commit is contained in:
Oliver Booth 2023-08-08 02:06:58 +01:00
parent 6d40452fb3
commit 7abc44a58c
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61

View File

@ -57,7 +57,14 @@ public class Index : PageModel
if (post is not null)
{
return Redirect($"/blog/{post.Published:yyyy/MM/dd}/{post.Slug}");
var route = new
{
year = post.Published.Year,
month = post.Published.Month,
day = post.Published.Day,
slug = post.Slug
};
return Redirect(Url.Page("/Blog/Article", route)!);
}
return NotFound();