-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support trailing slash behavior customization #588
Comments
Any updates on this @bitspittle? |
I'll be honest, it hasn't been on my radar and might not be for a while. Note that you have access to registering a route interceptor: kobweb/frontend/kobweb-core/src/jsMain/kotlin/com/varabyte/kobweb/navigation/Router.kt Line 294 in 33838f5
And also the client side navigation logic will try to add a slash if kobweb/frontend/kobweb-core/src/jsMain/kotlin/com/varabyte/kobweb/navigation/Router.kt Line 377 in 33838f5
@shubhamsinghshubham777 Can you share a specific use case would you like to support? |
@bitspittle My case is similar, but for
but not this:
Let me know if this should be filed under its own issue. |
Ah sure, let's file a new issue for that! Because we could fix it without adding a trailing slash config parameter. I will need to double check the code, but that probably should have worked and it's just an oversight with my logic. |
No issues at all, I'll file another issue to keep things clean ✅ |
See also: https://nextjs.org/docs/pages/api-reference/next-config-js/trailingSlash
And see also:
kobweb/frontend/kobweb-core/src/jsMain/kotlin/com/varabyte/kobweb/navigation/Router.kt
Line 376 in f74a1b9
Up until now, we've sidestepped this by being pretty loose with trailing slashes in Kobweb.
In other words, if a user registers "/example-route", then that route will be visited (of course) if typed in directly or if
/example-route/
was typed in (at which point it would be redirected).Some users want the reverse -- they want the trailing-slash version to be the canonical URL, so even if they define a
@Page
(or markdown file) atExampleRoute.kt
, it should generate/example-route/
The one tricky thing with Kobweb is we let users break their code up into separate modules (and libraries), but for consistency, this is probably something we only want to let the app decide on the final behavior, and not have to specify in every module.
So we'd probably need a way to take a route registered at "/a/b/c" and retroactively treat it as "/a/b/c/" (unless of course "/a/b/c/" was separately registered explicilty.
The text was updated successfully, but these errors were encountered: