How to choose which templates to load app.html.eex

Hello.
I built a phoenix server and I am having a problem. In app.html.eex I am generating navigation bar.
All I need is: several templates to be generated without the navigation bar. I couldn’t manage to do it.
The code I use for rendering templates under app.html is:
Just above the </body> tag.

<%= render @view_module, @view_template, assigns %>

The question is: What do I have to change in order to complete what I ask for?

One solution is to have a separate layout for those templates that do not need the navigation bar. You can specify which layout to use in the controller using a plug:

plug(:put_layout, {YourApp.LayoutView, "layout_file_name.html"})
1 Like

I believe you can do it without the plug too: https://hexdocs.pm/phoenix/Phoenix.Controller.html#put_layout/2

3 Likes