Skip to content

sidebar_class_name in docs front matter not applied on non-category index pages #11258

@MisterFISHUP

Description

@MisterFISHUP

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

For a non-category doc page, the front matter sidebar_class_name doesn't work if the file is organized as xxx/index.md[x], while it works as expected when the doc is xxx.md[x].

Related issue: #10864

Reproducible demo

https://codesandbox.io/p/devbox/sleepy-bird-zcj5wl

Steps to reproduce

The first four steps are implemented in the provided CodeSandbox.

  1. Create a new docusaurus project.
  2. Go to docs/tutorial-basics/create-a-document.md, add sidebar_class_name: this-works and see it works.
  3. Add a new file docs/foo/index.md with sidebar_class_name: abcde and see it doesn't apply.
  4. Add a new file docs/tutorial-basics/bar/index.md with sidebar_class_name: abcde and see it doesn't apply either.

sidebar_class_name does work on "category" index pages:

  1. Go to docs/tutorial-basics/_category_.json, remove the "link" entry. Add a new file docs/tutorial-basics/index.md with sidebar_class_name: this-works-too and see it works.

Expected behavior

sidebar_class_name ("abcde") applied to the sidebar items.

Actual behavior

sidebar_class_name doesn't apply.

Your environment

  • Docusaurus version used: 3.8.0/3.8.1

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions