feat: include hidden items in nav tree with hidden flag#1028
feat: include hidden items in nav tree with hidden flag#1028dslovinsky merged 2 commits intomainfrom
Conversation
🌿 Documentation Preview
|
There was a problem hiding this comment.
Pull request overview
Updates the content indexer to keep hidden pages/sections/API references in the generated nav tree by emitting nav items with hidden: true (while continuing to exclude hidden items from Algolia indexing).
Changes:
- Added
hidden?: booleanto the base navigation item type. - Updated visitors/processors to emit nav items for hidden content and mark them with
hidden: trueinstead of returningundefined. - Updated unit tests to assert hidden nav items are present and flagged.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/content-indexer/types/navigation.ts | Adds hidden?: boolean to nav item base type to support hidden flags. |
| src/content-indexer/visitors/visit-page.ts | Always returns a page nav item; marks it hidden and skips Algolia when hidden. |
| src/content-indexer/visitors/visit-section.ts | Keeps hidden sections in nav (with flag) unless there are no children. |
| src/content-indexer/visitors/processors/process-openapi.ts | Keeps hidden API nav (with flag) while skipping Algolia breadcrumbs/records. |
| src/content-indexer/visitors/processors/process-openrpc.ts | Keeps hidden RPC nav (with flag) while maintaining indexing behavior. |
| src/content-indexer/visitors/tests/visit-page.test.ts | Updates expectations for hidden pages to return hidden: true nav items. |
| src/content-indexer/visitors/tests/visit-section.test.ts | Updates expectations for hidden sections to return hidden: true nav items. |
| src/content-indexer/visitors/tests/visit-api-reference.test.ts | Updates expectations for hidden API refs to return hidden: true nav items. |
| src/content-indexer/visitors/processors/tests/process-openrpc.test.ts | Updates expectations for hidden OpenRPC to return hidden: true nav items. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| title: pageItem.page, | ||
| path: `/${finalPath}`, | ||
| type: "page", | ||
| description, |
There was a problem hiding this comment.
description is always emitted as a property even when it is undefined, which means navItem will contain description: undefined. This can break strict deep-equality expectations and produces noisier serialized output. Consider only including description when it’s defined (e.g., via conditional object spread), and update the related test expectations accordingly.
| description, | |
| ...(description !== undefined ? { description } : {}), |
|
|
||
| // Only include section in nav if it has children and is not hidden | ||
| if (children.length === 0 || sectionItem.hidden) { | ||
| // Skip section from nav if it has no visible children |
There was a problem hiding this comment.
The comment says “no visible children”, but children is only filtered for undefined (not for hidden), so this condition is actually “no children”. Update the comment to match the actual behavior (e.g., “no children”) to avoid confusion.
| // Skip section from nav if it has no visible children | |
| // Skip section from nav if it has no children |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2807f76a0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Only include section in nav if it has children and is not hidden | ||
| if (children.length === 0 || sectionItem.hidden) { | ||
| // Skip section from nav if it has no visible children | ||
| if (children.length === 0) { |
There was a problem hiding this comment.
Exclude sections whose children are all hidden
Now that hidden pages/API items are emitted with hidden: true, children can be non-empty even when every child is hidden. This guard only checks children.length === 0, so a non-hidden section with only hidden descendants is still emitted as visible, which can surface empty section headers once consumers filter hidden items. The section-visibility check should consider whether any child is actually visible (or mark the section hidden when all descendants are hidden).
Useful? React with 👍 / 👎.
Previously, hidden pages/sections/APIs were excluded from the navigation tree stored in Redis. Now they are included with `hidden: true` so the docs-site can conditionally show them when the user is browsing a hidden page. Algolia records are still skipped for hidden items. Co-Authored-By: Claude <noreply@anthropic.com>
Prevents empty section headers from appearing when consumers filter
hidden items. Also fixes misleading comment ("no visible children"
→ "no children").
Co-Authored-By: Claude <noreply@anthropic.com>
d67eb70 to
ba9bfca
Compare
|
@claude @codex Ready for review. This PR changes the content indexer to emit hidden pages/sections/APIs with |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Summary
hidden: trueinstead of being omitted from the Redis nav treeWhat changed
types/navigation.ts— Addedhidden?: booleantoBaseNavItemvisit-page.ts— Always emits nav item; addshidden: truewhen page is hiddenvisit-section.ts— Emits section withhidden: trueinstead of returningundefinedprocess-openapi.ts— Removed early return for hidden; marks nav items withhidden: trueprocess-openrpc.ts— Same as OpenAPIhidden: truenav items instead ofundefinedTest plan
hidden: true