In the Phoenix Framework is there a common technique for setting a page title based on a route/path. Or is this just a matter of calling assign(:page_title, "fred")
at the right point inside my routed function?
Update
I ended up implementing a variation of @michalmuskala's solution. I pass up the action name instead of @view_template
:
<title><%= @view_module.title(action_name(@conn), assigns) %></title>
Then in the view module the code looks like this:
def title(:show, assigns), do: assigns.user.name <> " (@" <> assigns.user.user_name <> ")"
def title(:edit, _assigns), do: "Edit Profile"
def title(_action, _assigns), do: "User related page"
The last statement in the above code is an optional "catch all" for the module (and is something I'll probably only do while transitioning)