Enable error pages (404.html and 500.html)

by adding a 404.html to your project root, or _layouts, that file will be rendered in any "page not found" situation. It's like any other template, so has full access to the template system, etc.

For other errors, 500.html works similarly.