Skip to content

Move findPageBreadcrumb utility from @nuxt/ui-pro to @nuxt/content and add findPageChildren / findPageSiblings #3313

Open
@maximepvrt

Description

@maximepvrt

I’d like to propose moving the [findPageBreadcrumb](https://ui.nuxt.com/getting-started/content#findpagebreadcrumb) function, currently implemented in @nuxt/ui-pro to the @nuxt/content module. Since it relies solely on content data, it could be useful beyond Nuxt UI and benefit a broader range of projects using Nuxt Content.

Following a conversation with @atinux in DMs, he mentioned this move could indeed make sense and be worth considering within the scope of @nuxt/content.

In addition, I’d like to propose the creation of two complementary utilities:

  • findPageChildren
  • findPageSiblings

🧠 Proposal

1. Generic utilities

All three functions (findPageBreadcrumb, findPageChildren, and findPageSiblings) could:

  • Accept a route string (e.g. /foo/bar) rather than a full page object.
  • Support an optional strategy parameter to control how index.md files are interpreted.
findPageBreadcrumb(navigation?: ContentNavigationItem[], route?: string, options?: {current: boolean, strategy?: 'index-as-root' | 'index-as-child'})

findPageChildren(navigation?: ContentNavigationItem[], route?: string, options?: {strategy?: 'index-as-root' | 'index-as-child'})

findPageSiblings(navigation?: ContentNavigationItem[], route?: string, options?: {strategy?: 'index-as-root' | 'index-as-child'})

2. Strategy behavior

The strategy option would define whether an index.md file should be:

  • considered a child page within its directory (index-as-child, current behavior)
  • considered the root page of its directory (index-as-root)

It would also be convenient to define this behavior globally through the module configuration, e.g.:

export default defineNuxtConfig({
  content: {
    navigation: {
      strategy: 'index-as-root' // or 'index-as-child'
    }
  }
})

📎 Context

Related PRs in @nuxt/ui-pro:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions