feat: use aspnetcore route helper instead of hardcoding url
This commit is contained in:
parent
6d40452fb3
commit
7abc44a58c
@ -57,7 +57,14 @@ public class Index : PageModel
|
|||||||
|
|
||||||
if (post is not null)
|
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();
|
return NotFound();
|
||||||
|
Loading…
Reference in New Issue
Block a user