How to add layout to 404 page in phoenix?

config :demo, DemoWeb.Endpoint, 
  render_errors: [
    view: DemoWeb.ErrorView, 
    accepts: ~w(json),
    root_layout: false,
    layout: false
  ]

Phoenix.Endpoint has an option called render_errors, you can set root_layout or layout in config.

3 Likes