nuxt / nuxt/content

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

Open Beginner friendly
#3,850 1 comment 0 reactions 0 assignees View on GitHub

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 undefined instead of an empty string, so the title from index.md or the generated directory title is used as a fallback.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.