Skip to content

Supporting .md extensions in routes - #85

Closed
StevenClontz wants to merge 8 commits into
mainfrom
support-md-urls
Closed

StevenClontz wants to merge 8 commits into
mainfrom
support-md-urls

Conversation

@StevenClontz

Copy link
Copy Markdown
Member

No description provided.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 25, 2023 •

Copy link
Copy Markdown

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 93d6ed8
Status: ✅  Deploy successful!
Preview URL: https://47ea82bb.topology.pages.dev
Branch Preview URL: https://support-md-urls.topology.pages.dev

View logs

@StevenClontz
StevenClontz marked this pull request as ready for review November 25, 2023 17:27
@StevenClontz

Copy link
Copy Markdown
Member Author

@StevenClontz StevenClontz changed the title advanced routing attempt Supporting .md extensions in routes Nov 25, 2023
import type { ParamMatcher } from '@sveltejs/kit'

export const match: ParamMatcher = param => {
return /^\w?(\d+)(.md)?$/.test(param)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you want to allow things that don't start with an expected letter prefix here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with requiring prefix; at least, supporting non-prefixed IDs when known in context can come later.

@jamesdabbs

Copy link
Copy Markdown
Member

#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).

@StevenClontz

Copy link
Copy Markdown
Member Author

Closing in lieu of #105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants