How to send a 410 response code instead of 404 for unpublished entries based on secondary condition? #5113
Unanswered
jensolafkoch
asked this question in
Q&A
Replies: 2 comments
-
A couple of ways to approach it, I think:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi Erin, thanks! As far as I can see I cannot use a tag in the layout because Statamic checked before that the entry is unpublished and diverts to the 404 error page. It would only work if an entry is set to published (I already had that kind of tag) but it should not. I guess I'll try the Middleware approach. LATER ... The middleware approach it was ... :-) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We work with a collection of blog articles imported from a WordPress site (some 1450 posts). Now we want to exclude a subset of these posts by setting some of them to unpublished – but want to not send a 404 response code but a "410 Gone", based on an additional toggle field.
As far as I understand, Statamic sends a 404 if such a post is unpublished so we have to hook into the process before
But how (and when and where) can we intercept or change the native Statamic behavior so that we can send a 410 instead of a 404 if conditions apply (that is: if the additional toggle to send a 410 instead is set to true).
Any hints or help appreciated! Thanks!!
Beta Was this translation helpful? Give feedback.
All reactions