Skip to content

fix/breadcrumbs: Link only segments that have a page, label them with the page title - #2004

Draft
marcleblanc2 wants to merge 1 commit into
mainfrom
marc/fix/breadcrumb-links
Draft

marcleblanc2 wants to merge 1 commit into
mainfrom
marc/fix/breadcrumb-links

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

Problem

src/components/Breadcrumbs.tsx linked every URL prefix and showed raw slugs. On /code-search/working/saved-searches it rendered code-search > working > saved-searches and linked /code-search/working, a 404 (the directory has no index page). Same for /cody/enterprise/..., /admin/config/..., and others.

Fix

  • Look each prefix up in allPosts: link it only when a page exists there, label it with that page's first heading, render the current page as text with aria-current="page".
  • The component becomes a server component. The client-side /v/<version> handling is dropped: src/proxy.ts redirects every versioned URL off this site before anything renders, so it was dead code.

Now renders Docs > Code Search > working > Saved Searches with only Docs and Code Search linked.

Verification

npx tsc --noEmit, pnpm run lint, prettier clean. Checked with pnpm run dev on /code-search/working/saved-searches, /cody/enterprise/completions-configuration, /admin/config/site-config (HTML and screenshot).

Note: #1995 (merged) changed the breadcrumb colour classes; this branch is rebased on top of it.

Found by the docs site audit in this Amp thread; rebuilt locally in this one.

… the page title

Breadcrumbs linked every URL prefix and showed raw slugs, so pages such
as /code-search/working/saved-searches offered links to
/code-search/working (a 404: the directory has no index page) and read
"code-search > working > saved-searches".

Look each prefix up in allPosts: link it only when a page exists, label
it with that page's first heading, render the current page as text with
aria-current=page. The component becomes a server component; the
client-side /v/<version> handling is dropped because src/proxy.ts
redirects every versioned URL off this site before it renders.

Found by the docs site audit in
https://ampcode.com/threads/T-01a0ae50-f7f0-779c-aa66-3887c9953e33

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a0aed2-5fbe-7768-85ea-1378bf98f9ff
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sourcegraph-docs Ready Ready Preview Sep 17, 2026 10:43am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Spell check found 1 issue(s) in this PR

Only findings on lines added by this PR, and in its title and description, are shown.

Pull request description

  • line 13, column 45
    • colourcolor

Please correct the spelling, or add words which are correct to cspell-allow-list.txt.

Run npx cspell@10 --no-progress --dot '**/*' locally to check the full repository.

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