Repository navigation
fix(redirects): Apply redirects to .md export URLs - #20336
Merged
BYK merged 4 commits intoNov 6, 2026
Merged
Conversation
Redirects only matched the HTML URL, so the .md export of a moved page fell through to the Markdown soft-404 (HTTP 200 "Page Not Found"). - middleware: look up the HTML path for .md requests and redirect to the destination's .md export (external destinations unchanged). - redirects.js: derive a .md twin for every non-wildcard redirect and drop the 8 hand-written twins it now covers. Refs MAR-1919 Co-Authored-By: Shannon Anahata <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Generating a separate .md rule per redirect pushed next.config redirects from 741 to 1,193, past Next's 1,000-route performance warning. Match both URLs with one rule instead: the source ends in :mdSuffix(/|\.md) and the destination reuses :mdSuffix, so /old/ goes to /new/ and /old.md to /new.md. path-to-regexp rejects a param directly after another param, so the 12 rules whose path ends in a param still get a separate .md rule. Total: 745 rules. Refs MAR-1919 Co-Authored-By: Shannon Anahata <[email protected]>
sfanahata
marked this pull request as ready for review
November 5, 2026 21:50
Contributor
|
Getting ready to monitor this change · Rollout details
|
Contributor
Author
|
getsentry/toolkit#2051 depends on this PR. It makes the Sentry MCP's |
This was referenced Nov 6, 2026
BYK
approved these changes
Nov 6, 2026
BYK
deleted the
shannonanahata/mar-1919-redirects-not-applied-to-md-doc-urls
branch
November 6, 2026 19:23
BYK
added a commit
that referenced
this pull request
Nov 6, 2026
…20608) ## DESCRIBE YOUR PR This revives most of #18953 by @sergical, which the stale bot closed. It's rebased on current `master`, and @sergical is credited as co-author on the commit. When an agent requests a `.md` page that has no export, the response now explains why: - **`/platform-redirect.md`** (the most-missed path) now serves guidance from `md-overrides/platform-redirect.mdx` on building `/platforms/<platform>/<page>.md` URLs directly. `/platform-redirect/` is a dynamic route with no static HTML, so the override was never emitted in #18953 (Bugbot's finding). A new `standalone: true` override frontmatter flag lets `generate-md-exports` emit an override without a matching HTML page. Overrides without the flag still get the "did not match any HTML file" warning, so typos are still caught. - **Pages that exist but whose export is missing** get a "Markdown Export Unavailable" body that links to the HTML page and the page's children, with a 60s cache. Synthetic doctree nodes (`missing: true`) only fill gaps in the hierarchy, so they keep the generic "Page Not Found" response. This fixes Bugbot's second finding. - `docs.md_export.not_found` gains an `outcome` attribute (`page_exists` | `unknown_path`). **Dropped:** the "Page Moved" response for redirected paths, together with its `middleware.ts` exports and redirect-table lookup. #20336 already makes `.md` requests for moved pages follow the redirect map with a 308, for example `/ai/mcp.md` → mcp.sentry.dev. Two different answers for the same request would conflict. The response keeps its 200 status, the `X-Sentry-Docs-Not-Found: 1` header and noindex. getsentry/toolkit#2051 relies on that header to detect these misses. I updated the route tests: I removed the redirect cases and added one for synthetic nodes. `vitest` passes (527 tests), and ESLint and Prettier are clean on the changed files. `generate-md-exports.mjs` runs on import, so the standalone branch has no unit test. Checking `/platform-redirect.md` on the Vercel preview will verify it. ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD - [ ] Other deadline: YYYY-MM-DD - [x] No deadline: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A2b57bf9a8da1beded651ceb5801db51f --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A2b57bf9a8da1beded651ceb5801db51f) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A2b57bf9a8da1beded651ceb5801db51f/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Burak Yigit Kaya <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DESCRIBE YOUR PR
Fixes MAR-1919. Moved documentation pages redirected at their HTML URLs, but their
.mdexports could fall through to the Markdown soft-404 and return HTTP 200 "Page Not Found". Agents using cached URLs such as/product/sentry-mcp.md,/ai/mcp.md,/product/sentry-basics/sampling.mdand/product/alerts.mdwould get stuck there.middleware.ts: resolve.mdrequests through the existing HTML redirect map, including:guideplaceholders, then redirect to the destination's.mdexport. External URLs and destinations with query strings stay unchanged; fragments are preserved.redirects.js: fold HTML and.mdmatches into each eligible page rule using:mdSuffix. Destinations that cannot share a rule, such as the root or a path ending in a parameter, get a separate.mdrule immediately after the original. Wildcards with fixed internal destinations get a Markdown-specific rule before the catch-all, so/product/insights/http.mdredirects to/product/dashboards/sentry-dashboards.md. More-specific redirects keep their precedence:/product/insights/mcp.mdstill reaches/product/mcp-servers.md. The generated user-docs rules total 829, below Next.js's 1,000-route warning..mdredirects now covered by the generated rules. The transformation runs inredirects(); the exported redirect arrays remain untransformed for the redirect-chain lint and rename check.Wildcards forwarding
:path*already carry the requested extension and stay unchanged. External URLs, destinations with query strings, and the/platform-redirect/platform picker also stay unchanged.The Markdown soft-404 still returns 200 on purpose, as explained in
app/md-exports/[...path]/route.ts.IS YOUR CHANGE URGENT?
PRE-MERGE CHECKLIST
via shannon.anahata.
--
View Junior Session [Sentry]