Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs are a bit messy about how app.html.heex becomes the default controller layout. #6078

Closed
DN4Davi opened this issue Feb 10, 2025 · 2 comments · Fixed by #6090
Closed

Docs are a bit messy about how app.html.heex becomes the default controller layout. #6078

DN4Davi opened this issue Feb 10, 2025 · 2 comments · Fixed by #6090

Comments

@DN4Davi
Copy link

DN4Davi commented Feb 10, 2025

I'm learning Phoenix by reading the documentation, and I found that the explanation of how app.html.heex becomes the default controller layout is a bit messy.

In the Routing section, the documentation explains how root.html.heex becomes the default router layout in the browser pipeline—nice. Then, we realize that even though app.html.heex isn't invoked in root.html.heex, it is included in all final HTMLs that don't explicitly reject it. Naturally, we assume this should be explained in the Controllers section—but it's not even mentioned there.

Next, we check Phoenix.Controller, but we don't have much luck, except for a contextless mention. Eventually, we find a comment in layouts.ex that states: "The 'app' layout is set as the default layout on both use HelloWeb, :controller {...}." Then, we look at :controller, only to find that it merely defines where controllers should look for HTML layouts—without explaining that the default behavior is to use app.html.heex for a given module.

@josevalim
Copy link
Member

We will look into this but I just want to thank you for posting feedback on the docs. ❤️

@SteffenDE
Copy link
Contributor

We added some clarifications to the docs and also changed the defaults to be more explicit. See #6090. If you have any more suggestions, please let us know! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants