0

Is it possible to have the same route be on different layout groups in SvelteKit. I want to have two different layout groups "/(private)/(app)" and "/(public)/(landing)" that define the routes for my authenticated and not authenticated pages. Normally I can do this in NGINX by making an auth subrequest. But in SvelteKit I get the following error:

The "/(private)/(app)" and "/(public)/(landing)" routes conflict with each other

Can we define this in the hooks.server.ts file or maybe the root layout.server.ts?

1 Answer 1

1

I do not think this is currently possible.

Recently an issue has been opened about a similar problem. As noted there, this would be a use case for the reroute hook, but it currently has a cacheability requirement (which will not work if the deciding factor is the authentication status of the user).

With reroute, you can keep the URL as is but return a specific route, so you could turn the groups into regular path segments which will not be visible but help disambiguate the routing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.