I have a mostly static site with regular Phoenix controllers and paths. But, I now have a page where I want to use LiveView. So, I have a new route setup, but I can’t seem to be able to link to it from my regular .eex
template.
Here is what it looks like:
route.ex:
scope "/", OystersWeb do
pipe_through [:browser, :require_authenticated_user]
get "/users/settings", UserSettingsController, :edit
put "/users/settings", UserSettingsController, :update
delete "/users/settings", UserSettingsController, :delete
post "/users/settings", UserSettingsController, :update
put "/users/settings/update_password", UserSettingsController, :update_password
get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email
get "/users/threads", ApplicationController, :threads
get "/users/saved", ApplicationController, :saved
live "/stories/new", StoryLive, :submit_story
end
header_links.html.eex:
<span class="headerlinks">
<a id="l_holder" style="background-color: #500000;" href="/" title="Oysters"></a>
<%= for %{ path: path, label: label, class: class } <- @header_links do %>
<%= link label, to: Routes.application_path(@conn, path), class: class %>
<% end %>
</span>
I don’t have access to any live navigation in the header link template. It’s apart of the root layout that is static. Is there a way to have a link route to a LiveView page? Or do I have to turn the whole app root layout into a LiveView? I have seen some people ask about route from LiveView to regular controller routes, but I want the opposite, route from a regular controller route to a LiveView.