Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Article status for maintenance mode, returns HTTP status
I am sure this has been asked before, but my search fu is not strong this evening. I had a client ask me about this today and I’ve told her I’ll check what’s viable.
Consider a site where one or more articles need maintenance, to the extent that an alternative page should be shown in place of regular content.
Example: a website has an article that has incorrect advice on a subject, and the article needs to be pulled offline immediately (for moral / legal / ethical reasons), and a holding page (with appropriate HTTP status) is used to indicate that the article is down for maintenance, but will return. An audit can take place, the preview functionality still works behind the scenes, and the article can be republished post-audit. The holding page is removed, all is well.
I know a lot of stuff in articles is sacred, especially with backward compatibility concerns, but a user-friendly way to make one or more articles ‘currently unavailable’ – for want of a better term – would be valuable.
(Explaining it like this is useful to me because it dawned on me that this might already be doable with an alternate article form…but could an article form trigger an HTTP header?)
Usual caveat: could be plugin territory, of course.
Last edited by gaekwad (2021-12-24 16:45:41)
Offline
Re: Article status for maintenance mode, returns HTTP status
Long shot: set the expiry date/time. Then in your template use the <txp:if_status>
to check for 410: Gone and render something else temporarily. Then remove the expiry time to reinstate it.
Alternatively, make an error_410 template and render that instead. You could perhaps use a custom field to hold the message you want to display.
Does that give you any avenue for thought?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Article status for maintenance mode, returns HTTP status
Bloke wrote #332296:
Does that give you any avenue for thought?
Thanks, Stef. I was thinking to 503 it so it’s seen to be ‘back soon’, so perhaps the article form route will be the way forward, and there’s less mess with expiry date + human error. Choose the article form from a dropdown instead of changing publication dates, and so on.
Are there any limitations on where header
can be called from? Specifically, if an article fires a header with status 503 (or whatever), does that then kick off a second pass?
Offline
Re: Article status for maintenance mode, returns HTTP status
Hmmm. The thing is, 503 is usually a site wide header. I’ve never seen it used on a per article basis so I’m not entirely sure what search engines will make of its use.
Form override would work though. Hadn’t thought of that.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Article status for maintenance mode, returns HTTP status
Bloke wrote #332299:
The thing is, 503 is usually a site wide header. I’ve never seen it used on a per article basis so I’m not entirely sure what search engines will make of its use.
Yes, you’re right – I had considered this. I’m pondering pros and cons. I was using this as a guide, but as you rightly say – that’s a whole website.
I am brave enough to suck it and see, at least on a test site. I can grep the logs to see if there’s a trigger for the rate of 503s before a search engine bounces away.
Offline
Re: Article status for maintenance mode, returns HTTP status
I have done the way suggested by Stef: error_410
with the addition of a <txp:if_article_id …/>
containing a special message, because the form was already used for things that were really gone.
Bit of sledgehammer approach and some manual work in multiple panels but that was otherwise a relatively “easy” way.
Ideally I would have used a temporary redirect header (307) but could not get it to work. That kind of stuff seems difficult on per article basis in TXP.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Article status for maintenance mode, returns HTTP status
phiw13 wrote #332303:
I have done the way suggested by Stef:
error_410
with the addition of a<txp:if_article_id …/>
containing a special message, because the form was already used for things that were really gone.
This is interesting. The 410 approach – to me at least – implies content is gone and isn’t coming back…which is not what I want. MDN says:
The HyperText Transfer Protocol (HTTP) 410 Gone client error response code indicates that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent.
…but throwing a 404 feels wrong. Sure, it can be styled, but it could feel a bit fatal from the client point of view.
Ideally I would have used a temporary redirect header (307) but could not get it to work. That kind of stuff seems difficult on per article basis in TXP.
Also interesting – I had considered 3** responses, but a 307 implies a redirect target is involved, and if there’s >1 articles going to a generic “be right back” page, that could be a mess to untangle. I suppose if it’s temporary then any sensible crawler would know this and stop back later, especially if I set a header to check back at a given time.
Lots to think about. I will ponder this over the holidays.
Thank you, both – I very much appreciate your input.
Offline
Re: Article status for maintenance mode, returns HTTP status
Yeah, 410 is a bit sledgehammerish.
Is there no http status code for “be right back”? Cos if there is, Txp can throw it via Form override or (probably) in the page template if the page layout is refactored slightly so the header
tag can be sent early.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Offline
Offline
Re: Article status for maintenance mode, returns HTTP status
Bloke wrote #332305:
Is there no http status code for “be right back”? Cos if there is, Txp can throw it via Form override or (probably) in the page template if the page layout is refactored slightly so the
header
tag can be sent early.
Another (expensive) way around it would be to have an article tag in head
that spits out a status code, and any other conditional stuff it’s not a normal, live article.
Offline
Offline