Repository navigation
Supporting .md extensions in routes - #85
StevenClontz wants to merge 8 commits into
Conversation
Deploying with
|
| Latest commit: |
93d6ed8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://47ea82bb.topology.pages.dev |
| Branch Preview URL: | https://support-md-urls.topology.pages.dev |
|
Adds support for the following URLs:
Particular use-case: copy-pasting Markdown filepaths from Shortcoming: I'd prefer these all redirect to the canonical URL https://support-md-urls.topology.pages.dev/spaces/S000001 Thoughts @jamesdabbs? |
.md extensions in routes
| import type { ParamMatcher } from '@sveltejs/kit' | ||
|
|
||
| export const match: ParamMatcher = param => { | ||
| return /^\w?(\d+)(.md)?$/.test(param) |
There was a problem hiding this comment.
Is there a reason you want to allow things that don't start with an expected letter prefix here?
There was a problem hiding this comment.
Ah, I got it ... because you want spaces/1 to Just Work. I think that's fine in this case, but does complicate the case of spaces/1/properties/1 if you want to rewrite it. In that case, you can't just rewrite the given id string, and instead have to deeply understand the position in the routes.
There was a problem hiding this comment.
I'm okay with requiring prefix; at least, supporting non-prefixed IDs when known in context can come later.
|
#105 is a PR off of this branch that should handle the redirection (but it does not handle un-prefixed ids, for the reason above). |
|
Closing in lieu of #105 |
No description provided.