Skip to content

test: redirect check on a PR that breaks redirects - #1896

Closed
marcleblanc2 wants to merge 1 commit into
check-redirectsfrom
test-redirect-check-breaks
Closed

test: redirect check on a PR that breaks redirects#1896
marcleblanc2 wants to merge 1 commit into
check-redirectsfrom
test-redirect-check-breaks

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

Throwaway PR to exercise the Redirect check workflow from #1880. Do not merge.

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sourcegraph-docs Error Error Sep 10, 2026 6:28am UTC

Request Review

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

✅ The redirects an earlier revision of this PR broke are fixed

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

✅ The broken links an earlier revision of this PR introduced are fixed

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

❌ This PR breaks 8 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.

src/data/redirects.ts

Source overshadows a docs page that exists

Redirects 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.

  • line 25
    source: '/admin/tls_ssl',
    destination: '/self-hosted/http-https-configuration'

Source has a #fragment, so this redirect can never match

Use the page path alone as the source. #fragments are processed in the browser, so browsers never send them to web servers.

If the redirect destination has a #fragment, it takes precedence, otherwise if the customer clicked a link which has a #fragment, it'll be kept and tried on the destination page.

  • line 17
    source: '/old-ownership#anchor',
    destination: '/code-ownership'

Source or destination starts with /docs

Write 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/....

  • line 5
    source: '/docs/old-prefixed',
    destination: '/code-ownership'

Source already has an earlier entry, so this one is never used

Only the first entry for a source matches. Update that entry instead of adding another.

  • line 5914
    source: '/admin/http_https_configuration',
    destination: '/self-hosted/http-https-configuration'

Destination is another redirect

Chained 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.

  • line 9
    source: '/old-chain',
    destination: '/admin/http_https_configuration'
    final destination: /self-hosted/http-https-configuration

Destination page does not exist

Set 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.

  • line 13
    source: '/old-ownership',
    destination: '/code-ownershp'
  • line 715
    source: '/user/markdown',
    destination: '/admin/markdown'

Destination heading does not exist

Use the heading's correct anchor, or drop the #fragment to land the customer at the top of the page.

  • line 2646
    source: '/batch_changes/how-tos/server_side_file_mounts',
    destination: '/batch-changes/server-side#using-file-mounts-with-server-side-execution'

Reproduce locally with pnpm check-redirects (see dev/check-redirects.mjs)

…, duplicate, chain, missing page, missing heading)

Amp-Thread-ID: https://ampcode.com/threads/T-01a088d9-b8fd-76fd-ba93-3a416c5829a3
Co-authored-by: Amp <amp@ampcode.com>
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.

1 participant