Commit 298b4b8
fix: highlight active toolkit in sidebar (#895)
* fix: highlight active toolkit in sidebar
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>
* fix: recurse into children when copying href to route
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>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 597a93c commit 298b4b8
1 file changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
27 | 47 | | |
28 | 48 | | |
29 | 49 | | |
| |||
88 | 108 | | |
89 | 109 | | |
90 | 110 | | |
91 | | - | |
| 111 | + | |
| 112 | + | |
92 | 113 | | |
93 | 114 | | |
94 | 115 | | |
| |||
0 commit comments