fix(packages/core): nav links point to content pages instead of landing pages#60
Conversation
…ng pages Update auto-nav resolution to prefer known entry-page slugs (overview, introduction, index, readme) among section children before falling back to the section's landing page URL. Also update the explicit nav config in zpress.config.ts to link to actual content pages. Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 10b3a74 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughPrefer entry-child pages (introduction/intro/overview/index/readme) when resolving sidebar links by adding entry-slug utilities and a helper to pick direct entry-page child links; integrate ranking into sorting logic and update top-level nav links in config to point to specific nested document routes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Move duplicated entry-page slug lists into a shared constant and helpers in resolve/path.ts. Both sort.ts (pinned-first comparator) and sidebar/index.ts (auto-nav entry page detection) now use the same ENTRY_SLUGS, entrySlugRank, and isEntrySlug utilities. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/core/src/sync/sidebar/index.ts`:
- Around line 171-181: The function findEntryPageLink currently considers all
ResolvedEntry children when building candidate links; update it to exclude
entries with hidden === true before mapping to childLinks so hidden pages cannot
be selected as entry pages. Locate findEntryPageLink and change the initial
candidate collection to filter items by !c.hidden (or c.hidden !== true) prior
to map, then keep the rest of the reduce logic intact so only visible children
are checked against ENTRY_PAGE_SLUGS.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9b84110d-f301-4e41-ba9b-54da03098917
📒 Files selected for processing (2)
packages/core/src/sync/sidebar/index.tszpress.config.ts
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/core/src/sync/resolve/path.ts`:
- Line 1: Remove the unused import 'basename' from the import statement in this
module: edit the import line that currently reads "import { basename, dirname,
extname } from 'node:path'" and delete the 'basename' specifier so it becomes
"import { dirname, extname } from 'node:path'"; ensure no other references to
basename exist in functions or identifiers (e.g., any usages related to
resolve/path.ts) before committing.
- Around line 27-37: The JSDoc for entrySlugRank claims lower indices mean
overview > introduction > intro > index > readme, but the actual ENTRY_SLUGS
array orders 'introduction' and 'intro' before 'overview', so the docs are
wrong; fix by making the implementation and documentation consistent — either
reorder ENTRY_SLUGS to match the stated priority (put 'overview' before
'introduction'/'intro') or update the JSDoc priority list to reflect the actual
array order; locate ENTRY_SLUGS and the entrySlugRank function to apply the
change and ensure the JSDoc wording matches the exact order in ENTRY_SLUGS.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 079117bd-4c14-4309-aa64-63dd16c4c15e
📒 Files selected for processing (4)
.changeset/fix-nav-entry-links.mdpackages/core/src/sync/resolve/path.tspackages/core/src/sync/resolve/sort.tspackages/core/src/sync/sidebar/index.ts
✅ Files skipped from review due to trivial changes (1)
- .changeset/fix-nav-entry-links.md
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/core/src/sync/sidebar/index.ts
- Remove unused `basename` import from resolve/path.ts (CI lint failure) - Fix JSDoc priority order to match actual ENTRY_SLUGS array order - Filter hidden children in findEntryPageLink to prevent nav resolving to a hidden page Co-Authored-By: Claude <noreply@anthropic.com>
Summary
overview,introduction,index,readme) among section children before falling back to the landing pagezpress.config.tsto point to actual content pages (e.g./getting-started/introductioninstead of/getting-started)Changes
packages/core/src/sync/sidebar/index.ts— AddedENTRY_PAGE_SLUGSconstant,findEntryPageLink()helper, and updatedresolveLink()to prefer entry pages for sections with childrenzpress.config.ts— Updated all 5 nav links to point to first content page in each sectionTesting
pnpm typecheckpasses (all 16 tasks)Summary by CodeRabbit
Improvements
Chores