fix: highlight active toolkit in sidebar#895
Merged
teallarson merged 2 commits intomainfrom Mar 31, 2026
Merged
Conversation
Nextra's sidebar active-state detection only checks `item.route`, never `item.href`. Toolkit entries in the generated `_meta.tsx` files must use `href` (Nextra throws a validation error for keys with no matching page on disk), but that means `item.route` is never set and the sidebar never highlights the current toolkit. Post-process the page map after `getPageMap()` to copy `href` → `route` for any item that has `href` but no `route`, so Nextra's native active detection works without changing the generated files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
An item with both `href` (no `route`) and `children` would get its `route` set but its `children` would not be recursed into, silently skipping any nested items that also need patching. Apply the two operations independently so both always happen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

This nitty little thing was bugging me: toolkit pages weren't highlighted in the sidebar when active!
BEFORE:

AFTER:

Summary
item.route, neveritem.href_meta.tsxfiles must keephref(Nextra throws a validation error for keys with no matching page on disk), but this meansitem.routeis never set and the active highlight never firesapp/layout.tsxaftergetPageMap()to copyhref → routefor any item that hashrefbut noroute, so Nextra's native detection works without touching the generated filesTest plan
/en/resources/integrations/social/slack) — "Slack" entry is highlighted in the sidebar/en/resources/integrations/social/reddit) — "Reddit" is highlighted, others are notpnpm testpasses🤖 Generated with Claude Code
Note
Low Risk
Low risk: small, localized post-processing of the Nextra
pageMapto improve sidebar active-state highlighting, with minimal impact outside navigation rendering.Overview
Fixes missing active-state highlighting for toolkit sidebar entries by post-processing Nextra’s
getPageMap()output.app/layout.tsxnow recursively copieshreftoroutefor page map items that don’t have aroute, enabling Nextra’s built-in active detection for toolkit links without changing generated sidebar metadata.Written by Cursor Bugbot for commit 1b6ed5e. This will update automatically on new commits. Configure here.