Skip to content

fix(navigation): keep explicit "Navigation" title in .navigation files - #3879

Closed
farnabaz wants to merge 1 commit into
mainfrom
pr-pov/keep-explicit-navigation-title-in-naviga-2bbe
Closed

farnabaz wants to merge 1 commit into
mainfrom
pr-pov/keep-explicit-navigation-title-in-naviga-2bbe

Conversation

@farnabaz

Copy link
Copy Markdown
Member

Closes #3850

The path-meta transformer gave every file a fallback title taken from its basename, so .navigation files got "Navigation". To undo that, generateNavigationTree cleared any .navigation title equal to "navigation" (case-insensitive). That also cleared titles users had set to "Navigation" on purpose.

Changes:

  • path-meta: added a generateTitleFromBasename() helper. It never generates a title for .navigation files (Markdown and YAML both reach the transformer with basename .navigation).
  • navigation: removed the string comparison. An empty title is now deleted from the directory config, so it can't overwrite the index page's title or the generated directory title. Explicit titles are kept as they are.

Content that deliberately sets title: Navigation in a .navigation file will now show that title in the navigation tree. This is intended.

Tests:

  • Navigation tree: an explicit "Navigation" title is kept, and an empty title falls back to the index page's title or the generated one.
  • path-meta: .navigation.md / .navigation.yml get no generated title, and the generateTitleFromBasename helper is covered.

Closes #3850

The `path-meta` transformer gave every file a fallback title taken from its basename, so `.navigation` files got "Navigation". To undo that, `generateNavigationTree` cleared any `.navigation` title equal to "navigation" (case-insensitive). That also cleared titles users had set to "Navigation" on purpose.

Changes:
- `path-meta`: added a `generateTitleFromBasename()` helper. It never generates a title for `.navigation` files (Markdown and YAML both reach the transformer with basename `.navigation`).
- `navigation`: removed the string comparison. An empty title is now deleted from the directory config, so it can't overwrite the index page's title or the generated directory title. Explicit titles are kept as they are.

Content that deliberately sets `title: Navigation` in a `.navigation` file will now show that title in the navigation tree. This is intended.

Tests:
- Navigation tree: an explicit "Navigation" title is kept, and an empty title falls back to the index page's title or the generated one.
- path-meta: `.navigation.md` / `.navigation.yml` get no generated title, and the `generateTitleFromBasename` helper is covered.
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
content Ready Ready Preview Oct 12, 2026 2:30pm UTC

Request Review

@farnabaz
farnabaz marked this pull request as ready for review October 12, 2026 14:23
@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/content@3879

commit: d806941

@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3a5ac79b-dbe0-475d-a88e-d850440c2062

📥 Commits

Reviewing files that changed from the base of the PR and between 9fae87e and d806941.


📒 Files selected for processing (4)
  • src/runtime/internal/navigation.ts
  • src/utils/content/transformers/path-meta.ts
  • test/unit/generateNavigationTree.test.ts
  • test/unit/parseContent.path-meta.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

Path metadata now generates fallback titles through generateTitleFromBasename, which returns an empty title for .navigation and index. Navigation-tree merging removes falsy titles while preserving an explicit Navigation title. Tests cover generated and index-title fallbacks for navigation entries.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Low


Merge Risk: ⚪ Minimal · up to d8069

The reported empty nested-title behavior is unchanged from the base revision, so no current-PR regression remains identified.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: preserving an explicit "Navigation" title in .navigation files.
Description check Passed The description accurately explains the .navigation title-generation and navigation-tree changes, including fallback behavior and test coverage.
Linked Issues check Passed Issue #3850 requires an explicit Navigation title in .navigation.md to remain visible. generateTitleFromBasename returns no fallback title for .navigation, and generateNavigationTree no long…
Out of Scope Changes check Passed The changes stay within issue #3850. The path-meta helper prevents the reported basename fallback, navigation processing preserves explicit titles and handles empty-title fallback, and the added tests…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/runtime/internal/navigation.ts

Parsing error: Unexpected token {


src/utils/content/transformers/path-meta.ts

Parsing error: Unexpected token {


test/unit/generateNavigationTree.test.ts

Parsing error: Unexpected token {


  • 1 others


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@farnabaz

Copy link
Copy Markdown
Member Author

close in favor of #3878

@farnabaz farnabaz closed this Oct 12, 2026

This branch was successfully deployed

1 active deployment
Preview — d806941c Deployed Oct 12, 2026 by vercel[bot]
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.

Navigation title "Navigation" in .navigation.md is silently dropped

1 participant