Skip to content
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

Requests to /examples/[...] not being redirected correctly #1129

Open
tomoam opened this issue Jan 28, 2025 · 1 comment · May be fixed by #1130
Open

Requests to /examples/[...] not being redirected correctly #1129

tomoam opened this issue Jan 28, 2025 · 1 comment · May be fixed by #1130

Comments

@tomoam
Copy link

tomoam commented Jan 28, 2025

It seems that requests to /examples/[...] are not being redirected properly.

https://svelte.dev/examples/hello-world

This might be related to #1056.

@tomoam
Copy link
Author

tomoam commented Jan 29, 2025

This issue is caused by routes/examples/[...path]/+page.server.ts not working properly, similar to #1056. I have investigated this further. The root cause is that the entire application is set to be prerenderable in routes/+layout.server.ts, so routes/examples/[...path]/+page.server.ts becomes prerenderable. There is a link to /examples in content/blog/2022-01-13-accelerating-sveltes-development.md, and only a static redirect from /examples to /playground is generated.

As for the fix, there are two approaches: setting the redirect in hooks, similar to #1089, or adding export const prerender = false; to routes/examples/[...path]/+page.server.ts. The former provides consistency across the entire application. However, since svelte.dev is also intended to be referenced as an example project, it is acceptable to have both methods for redirects: using hooks and using +page.server.ts. Therefore, I will create a PR using the latter approach.

@tomoam tomoam linked a pull request Jan 29, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant