Introducing Leaf Error Middleware

Written by Tim on Sunday, October 1, 2017

Leaf Error Middleware

One of the more interesting things to add to your website is a custom error page and 404 page. A clever and unique 404 page not only serves to help your users find their way back to your site, but can also distinguish your site from the standard '404 Not Found' page. Really good 404 pages can even lead to more traffic to your site!

The SteamPress Example site has had this functionality for some time now but I saw more and more questions about how people could change the 404 page or the error view on their site so I decided to do it properly!

A few commits, many proper tests and several builds later and Leaf Error Middleware was born! You can add it to your site simply by adding the dependency and then adding it to your middleware. Then you provide the 404 and error pages and it all just works!

The code can be found here and is deployed on the SteamPress site, this site and the main Broken Hands and seems to be working well. It works especially well with the 0.15.0 release of SteamPress that adds search! If someone finds a link that doesn't exist, offering them a search form to try and find what they were actually looking for is an awesome user experience!