4

I want to have one template handle all of my error pages (instead of creating 404.html, 500.html, &c.).

| improve this question | | | | |
4

A big thanks to Michael Rog (@rog) for the answer on Slack. You can create a catch-all error template with the name error (using whatever file ext works for you). That template also has access to a variable called code that tells you what kind of error it is. In my case, I'm using it to display HTTP Cats.

| improve this answer | | | | |
  • (p.s. You can customize the location for your error templates by changing the errorTemplatePrefix setting in the Craft General Config.) – Michael Rog Mar 27 '16 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.