It seems obvious but you really want to avoid a content change taking down your website.
No matter how well you code the site, null checking, version checking your items etc.. if a rouge item is published, or key data unpublished then your whole site could grind to a halt.
There are a few solutions to this such as:
- Workflow. - Of course put all/key content through an approval process. This can be a great solution.
- Staging publishing target. - This can work nicely alongside workflow, ensure all content is checked on a non public facing publishing target first.
Another option which can work standalone or alongside the ideas above and also helps mitigate human error, such as content just being approved without being checked is to run some UI tests on publish.
Tests on publish
So the idea is actually rather straightforward.
- Content editor publishes to stage.
- When the user wants to publish to live they see a status of the last test run which gives them confidence in the publish. If the test run failed, then don't publish.
How can I achieve this?
There are many ways to build this. In my prototype I combined a node API server with a small update to the publish dialog. I'm sure it can be improved upon but it works fairly nicely.
The node server
Once up and running exposes a number of endpoints to execute Cypress tests. If you don't know how to use Cypress it is great piece of software please try it out.
The publish script
Feel free to edit this code as you wish.