Skip to content

fix(packages/core): nav links point to content pages instead of landing pages#60

Merged
zrosenbauer merged 5 commits intomainfrom
fix/nav-links-point-to-content-pages
Mar 23, 2026
Merged

fix(packages/core): nav links point to content pages instead of landing pages#60
zrosenbauer merged 5 commits intomainfrom
fix/nav-links-point-to-content-pages

Conversation

@zrosenbauer
Copy link
Copy Markdown
Member

@zrosenbauer zrosenbauer commented Mar 23, 2026

Summary

  • Update auto-nav link resolution to prefer known entry-page slugs (overview, introduction, index, readme) among section children before falling back to the landing page
  • Update explicit nav links in zpress.config.ts to point to actual content pages (e.g. /getting-started/introduction instead of /getting-started)

Changes

  • packages/core/src/sync/sidebar/index.ts — Added ENTRY_PAGE_SLUGS constant, findEntryPageLink() helper, and updated resolveLink() to prefer entry pages for sections with children
  • zpress.config.ts — Updated all 5 nav links to point to first content page in each section

Testing

  • pnpm typecheck passes (all 16 tasks)
  • Verify nav links navigate to content pages, not landing pages

Summary by CodeRabbit

  • Improvements

    • Smarter sidebar link resolution now prioritizes entry/overview pages so users land on the most relevant docs pages.
    • Top-level navigation links updated to point directly to specific section landing pages (e.g., Getting Started, Concepts, Guides, Framework, Reference) for a more streamlined browsing experience.
    • Updated sorting/pinning so canonical entry pages (introduction/overview/readme) appear first in lists and sidebars.
  • Chores

    • Added a changeset to publish this navigation/behavior update.

…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-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 23, 2026

🦋 Changeset detected

Latest commit: 10b3a74

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@zpress/core Patch
@zpress/cli Patch
@zpress/ui Patch
@zpress/kit Patch

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

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
oss-zpress Ready Ready Preview, Comment Mar 23, 2026 6:36pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d4de4a1-fc40-4614-9301-65dcfc15e561

📥 Commits

Reviewing files that changed from the base of the PR and between 2358700 and 10b3a74.

📒 Files selected for processing (2)
  • packages/core/src/sync/resolve/path.ts
  • packages/core/src/sync/sidebar/index.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/core/src/sync/sidebar/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/sync/resolve/path.ts

📝 Walkthrough

Walkthrough

Prefer 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

Cohort / File(s) Summary
Sidebar link resolution
packages/core/src/sync/sidebar/index.ts
Added findEntryPageLink(items) to select direct non-hidden children whose link matches entry slugs; updated resolveLink() to prefer that child link, then entry.link, then first link; imports isEntrySlug.
Entry-slug utilities & sorting
packages/core/src/sync/resolve/path.ts, packages/core/src/sync/resolve/sort.ts
Exported ENTRY_SLUGS, isEntrySlug(link) and entrySlugRank(slug); switched to named path imports (dirname, extname) and changed pinned-item determination in sort to use entrySlugRank (ranking-based matching).
Config & release note
zpress.config.ts, .changeset/fix-nav-entry-links.md
Updated top-level nav entries to point to specific nested doc routes; added a changeset summarizing nav/link behavior change for a patch release.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇
I nibble at links where bright pages hide,
sniffing "intro", "readme", and the guide.
I hop to the first child that starts the tale,
and lead the reader down the correct trail.
📚✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: navigation links are being updated to point to actual content pages instead of landing pages, which aligns directly with the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nav-links-point-to-content-pages

Comment @coderabbitai help to get the list of available commands and usage tips.

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>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5e503e4 and 8c357a1.

📒 Files selected for processing (2)
  • packages/core/src/sync/sidebar/index.ts
  • zpress.config.ts

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8c357a1 and 2358700.

📒 Files selected for processing (4)
  • .changeset/fix-nav-entry-links.md
  • packages/core/src/sync/resolve/path.ts
  • packages/core/src/sync/resolve/sort.ts
  • packages/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

zrosenbauer and others added 2 commits March 23, 2026 14:34
- 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>
@zrosenbauer zrosenbauer merged commit 4179cee into main Mar 23, 2026
5 checks passed
@zrosenbauer zrosenbauer deleted the fix/nav-links-point-to-content-pages branch March 23, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant