Is there a mechanism to construct a URL pathname from a routeId
and params?
#4568
Unanswered
georgecrawford
asked this question in
Q&A
Replies: 0 comments
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.
-
Given that we have
event.routeId
andpage.routeId
now (PR), I'm wondering what the most friendly and idiomatic way is to construct a URL path to point to a route with the correct params?Is there an easy way to take
const routeId = "blog/archive/[page=integer]"
andconst params = {page: 199}
to form the pathname/blog/archive/199
, for example?If not, this would be a lovely addition to SvelteKit for developer ergonomics. It'd also be nice to determine whether the current value of
$page.routeId
matches a link's href.What I guess I'm working towards is something like this:
... which internally would do:
interested in thoughts from @Rich-Harris and @Conduitry as contributors to the
routeId
PR. Thanks!Beta Was this translation helpful? Give feedback.
All reactions