The relevant config.exs
section looks like this:
render_errors: [
formats: [html: MyAppWeb.ErrorHTML, json: MyAppWeb.ErrorJSON],
layout: false
],
Nothing I do in that config setting seems to have any effect on the layout situation for the 404 page. I have a 404.html.heex
file at lib/my_app_web/controllers/error_html/404.html.heex
, and error_html.ex
looks like this:
defmodule MyAppWeb.ErrorHTML do
use MyAppWeb, :html
embed_templates "error_html/*"
def render(template, _assigns) do
Phoenix.Controller.status_message_from_template(template)
end
end
My understanding is that best practice is for error templates to be entirely independent and render with no layout at all, but I can’t get it to use no layout or to use both root
and app
, which seems absolutely bizarre, because I can’t think of any context in which you’d want just app
without root
around it. I feel like I must be missing something obvious. I’m running Phoenix 1.7.2 if it matters.