core
core copied to clipboard
Add client-side routing support for virtual directories
If Context.ApplicationPath is not "/", Sitelets runtime could add a <meta name="app-path" content="/virtualDir"> tag to head.
Client-side routing would read this once when initializing it, and automatically skip base path when parsing URLs, and add it when writing. This would make server/client routing work without changes automatically when deploying a WebSharper application under a virtual directory.
Or better, client-side routing should take into consideration the html base tag path when parsing, similar to https://fsbolero.io/docs/Routing
It would be a breaking change if WebSharper server-side would auto-add base to each page based on a template, so some explicit change would be required, for example adding<base href="${BasePath}"> to the template and filling it in server-side code with .BasePath(ctx.ApplicationPath).