Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(navigation): prevent duplicate nodes #2959

Open
wants to merge 3 commits into
base: v3
Choose a base branch
from
Open

Conversation

farnabaz
Copy link
Member

@farnabaz farnabaz commented Jan 9, 2025

πŸ”— Linked issue

resolves #2958

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Index files should be merged with duplicate siblings

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@farnabaz farnabaz changed the title Fix/navigations index fix(navigation): prevent duplicate nodes Jan 9, 2025
Copy link

pkg-pr-new bot commented Jan 9, 2025

npm i https://pkg.pr.new/@nuxt/content@2959

commit: 5c4a795

@maximepvrt
Copy link
Contributor

@farnabaz I believe there's an issue with how the stem field is handled for parent items when they have children.

For example, currently:

{
  "title": "index",
  "path": "/devenir-benevole",
  "stem": "devenir-benevole/index",
  "children": [
    {
      "title": "bourg-en-bresse",
      "path": "/devenir-benevole/bourg-en-bresse",
      "stem": "devenir-benevole/bourg-en-bresse"
    },
    {
      "title": "index",
      "path": "/devenir-benevole",
      "stem": "devenir-benevole/index"
    }
  ]
}

I think the stem for the parent should instead represent the folder itself when it has children, as it acts as a directory rather than just the file. This would make it more consistent.

Proposed output:

{
  "title": "index",
  "path": "/devenir-benevole",
  "stem": "devenir-benevole",
  "children": [
    {
      "title": "bourg-en-bresse",
      "path": "/devenir-benevole/bourg-en-bresse",
      "stem": "devenir-benevole/bourg-en-bresse"
    },
    {
      "title": "index",
      "path": "/devenir-benevole",
      "stem": "devenir-benevole/index"
    }
  ]
}

Copy link

cloudflare-workers-and-pages bot commented Jan 10, 2025

Deploying nuxt-content with Β Cloudflare Pages Β Cloudflare Pages

Latest commit: 5c4a795
Status:🚫  Build failed.

View logs

Copy link
Member Author

@maximepvrt should be good now :)

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.

[v3] Issue with Navigation API Response
2 participants