Navigation title "Navigation" in .navigation.md is silently dropped
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 746
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 3
Description
Environment
ERROR Cannot read properties of null (reading 'name')
Version
3.16.0
Reproduction
https://stackblitz.com/edit/github-xzzfd3yf
Description
I am writing the documentation for a gliding software with Nuxt Docus. One section covers the in-app navigation, so the menu item really needs to be called "Navigation". If I set exactly this title in the .navigation.md of that section, the menu item shows up without any label. Any other title, like "Navigation & Menu", works fine.
The cause is here: https://github.com/nuxt/content/blob/656a5ce1a8cb6af0b37dd577bf4e1522e03e3c11/src/runtime/internal/navigation.ts#L24-L25
A title that equals "navigation" (case insensitive) is replaced with an empty string, presumably to discard the auto generated title derived from the file name. This makes it impossible to explicitly use "Navigation" as a section title, and there is no warning that the title is being dropped.
Expected behavior
It should be possible to explicitly name a section "Navigation". Possible fixes:
- Only discard the title when it was not set explicitly in the frontmatter, instead of comparing the string value.
- Or set the title to
undefinedinstead of an empty string, so the title fromindex.mdor the generated directory title is used as a fallback.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/runtime/internal/navigation.ts at the linked title-handling logic, then use the StackBlitz reproduction to confirm the behavior for a frontmatter title of "Navigation". The change is done when an explicitly configured title remains visible while generated navigation titles and their fallbacks still behave as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100