Hi all
How to disable layout in the views?
Thanks
Hi all
How to disable layout in the views?
Thanks
set value to false as docs say
Thanks so much.
You can also do it on a the render call itself, like I only want it off for one specific render, so:
render(conn, :spa, layout: false)
The answer didn’t explain how to disable the layout in the view, does anyone know?
Either use render(conn, :index, layout: false) or conn|> put_layout(false) |> render(:index)
If you are running a LiveVeiw app, you’ll likely have a plug :put_root_layout, {MyAppWeb.LayoutView, :root} in your browser pipeline.
In which case put_layout(false) will only disable the app layout, so you’ll have to use conn |> put_root_layout(false) to disable root layout.
You are probably looking to disable both, so you’ll need:
conn
|> put_layout(false)
|> put_root_layout(false)
|> render(...)
or shorter:
conn
|> put_root_layout(false)
|> render(..., layout: false)