Added 404 status code to article view on not-found state, to inform search engines of deleted articles
This commit is contained in:
parent
4a265f30b7
commit
d28625c37b
|
@ -4,6 +4,7 @@
|
||||||
@using Wave.Data
|
@using Wave.Data
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@using System.Globalization
|
@using System.Globalization
|
||||||
|
@using System.Net
|
||||||
@using Microsoft.AspNetCore.Identity
|
@using Microsoft.AspNetCore.Identity
|
||||||
@using Microsoft.Extensions.Options
|
@using Microsoft.Extensions.Options
|
||||||
@using Wave.Services
|
@using Wave.Services
|
||||||
|
@ -181,6 +182,10 @@
|
||||||
a.PublishDate.Date == date.Date
|
a.PublishDate.Date == date.Date
|
||||||
&& (slug != null && a.Slug == slug || a.Title.ToLower() == title));
|
&& (slug != null && a.Slug == slug || a.Title.ToLower() == title));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Article is null) {
|
||||||
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync() {
|
protected override async Task OnInitializedAsync() {
|
||||||
|
|
Loading…
Reference in a new issue