Custom error pages for Indie Web Server
I just released Indie Web Server version 6.3.0 with new default 404 and 500 error pages and support for custom ones.
To create a custom error page for your static site, just create a folder at
/500 in your web content and add, at a minimum, an
index.html file in it.
Any assets you put in those folders can be addressed using standard relative links from the
On your custom 404 error page, you can use the template variable
THE_PATH to include the missing path that the person tried to access and on your custom 500 error page, you can use the template variable
THE_ERROR to include the body of the error message.
For example, here’s an excerpt from the sample custom 404 error page that is used in the unit tests1:
<h1>Hmm…</h1> <img src="hmm-monster.svg" alt="Green monster, thinking."> <p><strong>Sorry, I can’t find</strong> THE_PATH</p>
Your error pages will be served at the URL of the error itself and using the correct error codes (not, for example, using redirects).
New default error pages
I also added a tiny bit of life to the default error pages.
Hope you enjoy them! :)
You can find both of the sample custom error pages pictured here in the test/site directory used by the unit tests. ↩︎