Dear All,
I can’t make custom error page
I try follow tutorial in Custom Error Pages — Phoenix v1.7.14 but not works
I am using Windows 11, Elixir 1.17.3, Phoenix 1.7.14
I try to disable debug mode in dev.exs but when restarting it’s showing offline and not route to my custom error page 404.html.heex
You would have to provide more information for us to help you.
What is the error? What is the content of your router.ex
file?
How did you create / trigger error?
scope "/", MyAppWeb do
pipe_through :browser
get "/", HomeController, :home
get "/about", HomeController, :home_about
get "/feature", HomeController, :home_feature
get "/pricing", HomeController, :home_pricing
get "/product", HomeController, :home_product
get "/careers", HomeController, :home_careers
end
I only have the code like above, nothing i change, only follow the step in the official tutorial,
step i use
- disable debug mode in dev.exs
- make directory of error_html contain 1 file such as : 404.html.heex
- commenting the code in error.html.ex according the tutorial
- uncomment the embed_templates “error_html/*”
the code in error_html.ex like below :
defmodule MyAppWeb.ErrorHTML do
use MyAppWeb, :html
embed_templates "error_html/*"
end
When you visit a not found page, what you see?
Only offline, not showing the custom 404 page, i don’t know if those is bugs
Can you please share the screenshot of what you are seeing?
Sorry All,
I was misplaced the error_html folder that must be place into folder controller LOL