Here’s the code I use to set the page title in my Layout template:
<title><%= @view_module.title(action_name(@conn), assigns) %></title>
Here’s a sample of what I have in one of my Views:
defmodule ZoinksWeb.TaskView do use ZoinksWeb, :view alias ZoinksWeb.TaskLive def title(_action, _assigns), do: "Tasks" end
However, now that I’m trying to implement Live View -
@view_module ends up being “Phoenix.LiveView.Controller” (rather than a user-defined view).
Is there something I can do with Live View that will work with regular Views that’s similar to my existing solution? Or should I just regress to setting an assign in the controller and/or live view?