-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the problem
Imagine a typical social media platform, where unauthenticated users are greeted with a marketing site with signup/login on the root path /
.
After the user has logged in, the root path typically shows the feed.
If you want to implement this behavior in sveltekit, at the moment your only option is to use if blocks in the /
+page.svelte
to conditionally show the marketing signup/login page or the authenticated social feed. With this approach you basically mingle two pages into one file and loose the ability to have different layouts or load functions.
Describe the proposed solution
It would be a lot cleaner if these two pages would have separate +page.svelte
files.
With the file based routing one of the two pages would have to be declared as a subpath for example the feed page would be located in a /feed/+page.svelte
Now we'd need some kind of server hook similar to the existing reroute
to tell the sveltekit router that the feed page is not to be shown as /feed
in the url bar but as /
based on the user session state.
If you use goto('/feed')
this should also trigger the hook and show the feed under the root path.
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response