fix/breadcrumbs: Link only segments that have a page, label them with the page title - #2004
Draft
marcleblanc2 wants to merge 1 commit into
Draft
marcleblanc2 wants to merge 1 commit into
marcleblanc2 wants to merge 1 commit into
Conversation
… 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Contributor
|
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.
Problem
src/components/Breadcrumbs.tsxlinked every URL prefix and showed raw slugs. On/code-search/working/saved-searchesit renderedcode-search > working > saved-searchesand linked/code-search/working, a 404 (the directory has no index page). Same for/cody/enterprise/...,/admin/config/..., and others.Fix
allPosts: link it only when a page exists there, label it with that page's first heading, render the current page as text witharia-current="page"./v/<version>handling is dropped:src/proxy.tsredirects every versioned URL off this site before anything renders, so it was dead code.Now renders
Docs > Code Search > working > Saved Searcheswith onlyDocsandCode Searchlinked.Verification
npx tsc --noEmit,pnpm run lint, prettier clean. Checked withpnpm run devon/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.