test: Example PR that fails the redirect check (do not merge) - #1965
marcleblanc2 wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
❌ This PR breaks 4 redirect(s)Redirects are used so inbound traffic from external sources (links inside old versions of our product, bookmarks, search results, etc.) to old doc pages still reaches a relevant page. A correct entry maps the old page path, exactly as the browser requests it, straight to a page that exists today, with an optional #heading that exists on the destination page: {
source: '/old/section/page',
destination: '/new/section/page#heading-slug'
},Each section below explains how to fix the entries listed under it. Do not use redirects for broken internal links, internal links must be fixed properly to tame the tech debt snowball no one wants to deal with; the "Check links" PR check comment lists the links this PR broke, if any. Source overshadows a docs page that existsRedirects take precedence over pages, so visitors to that page's URL are redirected away from it. Update or remove the redirect or the page to remove the conflict.
Source or destination starts with /docsWrite paths without the /docs prefix. The site removes /docs from the requested URL before matching sources, and adds it back in front of the destination, so a /docs/... source never matches and a /docs/... destination lands on /docs/docs/....
Destination is another redirectChained redirects cost the customer's browser a round trip, slow down their page load time, and frustrate them. They also make the redirects file impossible to maintain, and make it too easy to create redirect loops. Change the rule's destination to the final destination.
Destination page does not existSet the redirect destination to the page that replaced it, or remove the rule if there is no replacement page; visitors then get our fancy 404 page, with links they can click to find where they're trying to go, and the search bar.
Reproduce locally with |
dev/check-redirects.mjs checks every entry in src/data/redirects.ts: source shadows a page, source has a #fragment, duplicate source, /docs prefix, chained redirect, missing destination page or heading. The workflow compares against the merge base, so only redirects a PR breaks are reported, grouped by problem with the fix explained under each heading, and posts one suggested change per fixable entry the PR added (deleted again once the finding is gone). Not part of `npm run check`: main has hundreds of pre-existing findings. Squash of the check-redirects branch rebased onto main; the check-links commits it carried are already on main. Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp <amp@ampcode.com>
…ady names Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp <amp@ampcode.com>
…h (from the check-links PR) Amp-Thread-ID: https://ampcode.com/threads/T-01a08fee-74b4-76dc-aaf9-d1245d68fdc9 Co-authored-by: Amp <amp@ampcode.com>
3ff054c to
651bccf
Compare
| { | ||
| source: '/docs/ownership', | ||
| destination: '/code-ownership' | ||
| }, |
There was a problem hiding this comment.
Problem: Source or destination starts with /docs
Fix: change the source to /ownership
| { | |
| source: '/docs/ownership', | |
| destination: '/code-ownership' | |
| }, | |
| { | |
| source: '/ownership', | |
| destination: '/code-ownership' | |
| }, |
| { | ||
| source: '/ownership/tls', | ||
| destination: '/admin/tls_ssl' | ||
| }, |
There was a problem hiding this comment.
Problem: Destination is another redirect
Fix: change the destination to /self-hosted/http-https-configuration
| { | |
| source: '/ownership/tls', | |
| destination: '/admin/tls_ssl' | |
| }, | |
| { | |
| source: '/ownership/tls', | |
| destination: '/self-hosted/http-https-configuration' | |
| }, |
Adds four redirects, each breaking one rule: shadows an existing page, /docs prefix, redirect to a redirect, destination page missing. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a0a6dc-7fb8-766d-8e8d-c2fda22ee1ce
651bccf to
b8981c5
Compare
Example for the docs-maintainer announcement: one PR, one failing check. Do not merge.
Adds four entries to
src/data/redirects.ts, each breaking one rule: the source shadows a page that exists, a/docsprefix, a redirect whose destination is another redirect, and a destination page that does not exist. The Check redirects workflow should comment a report and suggest fixes for the two it can fix.Built on
mainplus #1935 (marc/check-redirects, rebased) because the check is not onmainyet, so the diff also shows the check's own files. The last commit is the example; once #1935 merges, only that commit remains.Siblings: #1963 spell check and #1964 link check. Replaces the all-in-one #1948 for the announcement.