feat: retain path and query when linking to other instance
1 file changed, 7 insertions(+), 1 deletion(-)
changed files
M internal/components/page.go → internal/components/page.go
@@ -116,7 +116,7 @@ }), g.Iff(tdata.OtherInstance != nil, func() g.Node { return A( Class("other-instance"), - Href(tdata.OtherInstance.URL.String()), + Href(switchHost(tdata.CurrentURL, tdata.OtherInstance.URL.Host).String()), g.Textf("⇄ %s", tdata.OtherInstance.Name), ) }),@@ -190,3 +190,9 @@ } return path + "?query=" + url.QueryEscape(query) } + +func switchHost(source url.URL, newHost string) *url.URL { + source.Host = newHost + + return &source +}