In an layout I have this standard line:
<%= @inner_content %>
For some controllers and actions I want to be able to render a custom template instead of the default one, if a custom template exists. For instance, if
template/article/custom.index.html.eex exists for the route
/articles/, the layout should load the
custom.index.html.eex instead. Otherwise, load the default one -
Note that in each Controller and each action the Elixir code should remain unchanged, preferably:
render(conn, "<index, edit, show, etc...>.html")
Namely, I want to program that on the level of the layout.
How to do it?
I figure it’d be similar to
<%= render_existing(@view_module, "footer." <> @view_template, assigns) %>
but for the main content