Replies: 1 comment
-
You'll want a file path such as If you want to prerender certain pages for your dynamic page but do not have the URLs discoverable in your app, you can specify them with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Context
I'm building an app that is served by a static web server and fetches data calling a backend api from the client. It's a sveltekit 2 app and I'm using
import adapter from '@sveltejs/adapter-static';
andexport const prerender = true;
This is a design goal, I want the full site to be created at build time and I want to be able to fully serve it without a node backend.Current state
In the app each user has a public profile page. To be able to render different data for each user, the route is as follows
/profile?username={some-username}
then in onMount I either get some profile data from a store or I call a backend endpoint to retrieve it.This works fine, you change the username in the queryparams and you get the same page with different user data.
What I want to achieve
I find using queryparams a bit ugly and I rather use
/profile/{username}
, so I would like to keep the current app behaviour but change how the url path looks. After several tries I'm unable to make it work.. so Im not sure if it's at all possible. In the docs it says:So I still have some hope, but after saying that it does not explain how to do it. I tired setting up a fallback page, but even with this when I go to
/profile/{some-username}
I get a 404.Note: loading the data using load() on build time is not an option as I don't have it all before hand.
Any guidance will be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions