In the template:
<title><%= title(assigns) %></title>
In the view module of the template:
def title(assigns) do
module = Phoenix.Controller.view_module(assigns.conn)
template = Phoenix.Controller.view_template(assigns.conn)
module.title(template, assigns)
end
There’s no need to keep all that logic in the template itself.