Skip to content

Include sidebar_class_name in category index metadata #10095

@wyoungtarget

Description

@wyoungtarget

Have you read the Contributing Guidelines on issues?

Description

When I am using a folder for asset collection (ref) e.g.

some-doc
├── index.md
├── img1.png
└── img2.png

I want the sidebar_class_name frontmatter to be included in the generated sidebar item -- the same as if I had not used a subfolder for asset collection.

For clarity, I am not asking this be placed in the category metadata, which would apply to all child items of that category.

Has this been requested on Canny?

No

Motivation

I have a docusaurs site that utilizes sidebar_class_name for unique visual treatment (in this case, ADR statuses: draft, proposed, accepted, rejected, deprecated, ...). This works fine, until you have a document you place in a folder. Then sidebar_class_name is not passed. The same problem exists when I tried _category_ .yml or .json with className

I found past issues that reference this same challenge:

--

I debated if this was a bug or feature request, the documentation does state:

If the link is explicitly specified, Docusaurus will not apply any default conventions.

However, "Default Conventions" appears to only apply to how an index page for a category is identified. Not having anything to do with its metadata.

API design

No response

Have you tried building it?

No, primarily as I cannot determine if it's a feature gap or a bug. #6254 gives me the closest lead, but the resolution is not immediately clear to me.

Self-service

  • I'd be willing to contribute this feature to Docusaurus myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions