You would like to use a custom 404 Error page.


You can set a custom 404 page by using the errorHandler function in the instance of the App inside the Foundation.hs file.

errorHandler NotFound = fmap toTypedContent $ defaultLayout $ do
      setTitleI MsgTitleNotFound
      $(widgetFile "error/404")


In this special case we match the errorHandler function on the NotFound type. As well we just assumed that the template error/404 already exists. Before using the code you will need to create the folder error in the templates folder with the file 404.hamlet inside. If you defined any custom layouts before, you can as well replace defaultLayout in the function to have a different layout for your custom 404 page.