Add .md URL stripping redirects for legacy links#140
Conversation
Deploying openshock-wiki with
|
| Latest commit: |
934a33f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://629d4cb8.openshock-wiki.pages.dev |
| Branch Preview URL: | https://codex-add-redirect-for--md-l.openshock-wiki.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 934a33fe2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,2 +1,4 @@ | |||
| /legal/*.md /home/legal/:splat 301 | |||
| /*.md /:splat 301 | |||
There was a problem hiding this comment.
* Exclude llms markdown endpoints from .md redirect
The new catch-all rule /*.md -> /:splat also matches internal markdown endpoints such as /llms.mdx/docs/.../content.md, which are intentionally generated by getPageMarkdownUrl and exported from src/app/llms.mdx/docs/[[...slug]]/route.ts using generateStaticParams. Redirecting those requests to /.../content strips the required .md segment, so production static exports no longer have a matching file at the redirected path, causing markdown-view/copy links to fail with 404s.
Useful? React with 👍 / 👎.
Motivation
.mdto the same path without the extension so old links keep working.Description
next.config.mjsthat permanently maps/:path*.mdto/:path*so local/dev server behavior matches production.public/_redirectsto strip.mdon Cloudflare Pages and include a specific/legal/*.mdmapping to/home/legal/:splatwhile keeping existing root/legal rules.Testing
pnpm lintwhich passed with no warnings or errors.pnpm buildwhich completed successfully and generated the static pages without errors.Codex Task