You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Utility function to build a URL from route.id + params #9934
I'm setting up redirects for a route directory with multiple params (/blog/[slug], /blog/[slug]/[part], /blog/[slug]/[...rest], etc.) and want to build the new URL by replacing just one of them ([slug]).
I ended up doing this naive regex replacement on route.id which doesn't account for all the possible variations of route params in SvelteKit (matchers, optionals, templates etc.):
Expose SvelteKit's internal resolve_entry function as buildRouteURL in the $app/navigation module, which parses a given route id and builds a URL string with the given params.
Now implementing my LayoutLoad function is as easy as this:
Activity
darrylyeo commentedon May 19, 2023
🎉
brianmontanamvmnt commentedon May 25, 2023
Damn that was fast, I was just looking for this type of utility 🙏