I have a router definition that looks like this:
scope "/page" do
live "/" FooLive, :index
live "/:page" FooLive, :index
end
/
goes to the main page, and /bar
goes to a named page /bar
. The main page also has a name, but I only know the name after loading.
I want to now add links to different pages and my links look like:
<.link patch={@link}>
where link is in the form: bar#subtitle
.
If I’m currently on the page “/page/main” then the link will point to: /page/bar#subtitle
, but if I’m on /page
then the link will point to: /bar#subtitle
and I want it to also point to /page/bar#subtitle
.
Is the best way to solve this to do a push_patch
when I’m on /page
? or is there some other solution?