I’m trying to wrap my head around how to best do nested layouting using SolidStart’s file based routing. I have an old app with a “route alias” from “/” to “/some/nested/page/with/layouts”. I’m trying to translate a SvelteKit middleware alias like this one:
import type { Reroute } from '@sveltejs/kit';
const translated: Record<string, string> = {
'/': '/some/nested/page/with/layouts'
};
export const reroute: Reroute = ({ url }) => {
if (url.pathname in translated) {
return translated[url.pathname];
}
};
In particular, I need the layouting to be intact and I’m not sure how to do this. If I simply add another route to solid-router pointing out the leaf component:
<FileRoutes />
<Route path="/" component={nested} />
the intermediate layout naturally is missing. Compare “/” and “/nested” here, the layout missing from the former:
Is there a middleware I should use instead? Or can I add another “path” to the FileRoute on the fly somehow?
I need this to be an alias, not a redirect.