-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
site: quicker redirects to appease the SEO deities #9116
Conversation
|
@@ -0,0 +1,2 @@ | |||
export const prerender = true; | |||
export { GET } from '../docs/+server.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should make docs.html
return anything. It returns "500 | not found" right now, which is really weird, but we should just fix that to return 404
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to get it to output the same prerendered files as it did before, not sure why it's a 500/404 currently because there is a docs.html in the prerendered output. Some manifest thing maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably sveltejs/kit#10565 will fix the 500/404 thing
https://svelte.dev/docs.html doesn't currently return anything, but would with this PR, so this isn't really making it equivalent to what it was before
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Dominik G. <[email protected]>
What's the status on this? Good to merge? |
What's the argument for changing this? Is this really quicker for SEO reasons? Right now we're loading the page and its JS and then redirecting which is quick. With this we're loading one page and then doing a full page redirect somewhere else. Not sure which is really faster. |
Client side redirects that only happen after a large amount of resoursces are downloaded (hydration, module preloads yada yada) so crawler wasn't picking up redirects from old links, or at least that was the hypothesis. I don't have a link handy now but I read somewhere in Google's docs that they do process some amount of client side redirects. The payload for the first request is a lot smaller with the PR because for example, it doesn't have the nav bar data embedded into the HTML. The cumulative time for both requests should be equivalent for human visitors with the PR but the first one needs to be fast enough for the bots to even consider the redirect. |
Makes sense, thanks! Anything you'd like to change in this PR still (specifically your conversation with Ben above) or are we basically good to merge? |
I was concerned that this will make |
Does that cause any problems other than it not being exactly equivalent to what it was before? We'd need to implement a way to tell SK "treat this endpoint result as a page response" to get the prerendering behaviour like before. |
What exactly do you mean by "return something"? Visually they're the same between this PR and main |
https://svelte.dev/docs.html is a 404 now (well 500, just needs a Kit bump hopefully) which would change with this PR |
I wonder if the better approach might be to replace the client-side redirects with server-side redirects. There are some without |
That will still require logic on the client, which as it seems will sometimes be too slow for redirects to be noticed |
The client-side logic would only be needed by users in that case, so it would be fine if it's too slow for Google to notice. For Google the only thing we need is to get it to the correct page. Google doesn't need the anchor part of the link as it will index and rank the whole page and not just that section |
closing as stale; pretty sure this doesn't apply to the new site (where |
pls work
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint