-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rethinking rel=external
#3935
Comments
I'm -1 on changing this. If you don't like overloading and having to imply the other things that |
I think this change makes sense. @Conduitry what's the reason not to do it? I don't think it would even be a breaking change, unless we consider server-rendering 404s for broken links (instead of rendering them in the client) to be breaking. |
I'll withhold judgement until I read the proposal carefully again. I may have been having a negative knee-jerk reaction to what sounded like "let's throw away all the years of precedent for client-side routing so that we can do something that might be more helpful by default but which is harder to explain and to understand and to customize if you need to". |
re. harder on-ramping: right now understanding Everything else would work as usual, with the exception that 404s would be handled server-side instead of client-side. Since 404s are the exception, I believe that's an acceptable trade-off. |
Describe the problem
Right now, SvelteKit requires us to add a
rel="external"
attribute to links that should cause a regular browser navigation instead of being handled by the client-side router. This allows us to direct users to routes in the same domain that are handled outside SvelteKit.There are a few issues I can see:
rel="external"
is supposed to denote a link points to an external site. While different routes on a single domain being served by SvelteKit and other services could mean exactly that, they are orthogonal concepts—they could arguably be considered a single site. The impact is probably minor but unknown: search engines could use this unfavorably./external
link and it doesn't match a route, the expectation is that it exists as a standalone endpoint, static asset or separate service. If it was in fact a link to SvelteKit-handled route that should 404, it'd arguably be the exception.Describe the proposed solution
With that in mind, I propose that the client-side router should relegate links without a matching route to the browser for a full page navigation by default.
On cases where the link would match a SvelteKit route (eg.
/[...path].svelte
as a catch-all would mean any route would match), we'd still need an attribute to disable SvelteKit's client-side routing. We could keeprel="external"
or come up with a SvelteKit-specific attribute likesveltekit:noroute
(we have thesveltekit:noscroll
prior art, but it does sound odd 🐐).Alternatives considered
This change would mean the exceptional case (a non-route link should be handled by SvelteKit's client-side router) would require a round-trip. We could, instead, aim to minimize the amount of
sveltekit:noroute
links: instead of requiring it on static assets, standalone endpoints and external services, we could require it only on external services by either:Still, I don't think it'd be worth the hassle to add the attribute to all externally handled routes just to skip a navigation on 404s, as I'd rather strive to eliminate 404s instead.
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: