Skip to content

generated-index page shows parent category items when linked from another category #11612

@Chesars

Description

@Chesars

Description

When a type: "link" inside a sidebar category points to the same URL as a generated-index page in another category, Docusaurus renders the page with items from the link's parent category instead of the generated-index's actual items.

Example

 // sidebars.js
  {
    type: "category",
    label: "Category A",
    items: [
      { type: "doc", id: "doc1" },
      { type: "doc", id: "doc2" },
      {
        type: "link",
        label: "Go to Category B →",
        href: "https://github.com/docs/category-b",  // URL of the generated-index page
      },
    ],
  },
  {
    type: "category",
    label: "Category B",
    link: {
      type: "generated-index",
      slug: "https://github.com/category-b",
    },
    items: ["item1", "item2", "item3"],
},

/docs/category-b shows cards for item1, item2, item3

But shows cards for doc1, doc2 (items from Category A)

Breadcrumb shows: Category A > Go to Category B

Note

There is no warning in the official documentation about this behavior. The docs for generated-index and type: "link" don't mention this limitation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions