Your sites Log in Sign up Menu

How to set a custom 404 error message?

I would like to check if we can set custom 404 messages? Thank you.


a year ago, 6 replies   developers   404   Improve this question

You should be able to edit the content of your template's error.html page in your template, which is the page displayed for 404s on your site.

Answered a year ago · Improve this answer

It seems the error.html page renders the error message from{{error.message}}, and I'am looking for the way to customize that variable

Answered a year ago · Improve this answer

Just replace {{error.message}} with whatever you'd like to see, e.g. 'This page is missing'. You don't need to customize the variable to achieve the result you're after.

Answered a year ago · Improve this answer

Can {{error.message}} be used for another error? Or is it just used for 404 errors?

Answered a year ago · Improve this answer

There are other types of error (e.g. 500) which affect the value of {{error.message}} but they do not vary greatly. You can review the source code for the error handling middleware.

My recommendation again is to just replace {{error.message}} with whatever you'd like to see.

Answered a year ago · Improve this answer

Thanks for the suggestion :)

Answered a year ago · Improve this answer