-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Have you read the Contributing Guidelines on issues?
- I have 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:
- sidebar_class_name not applied for index pages #6232 - this is the most direct writeup of the issue. However, the workaround described in the issue (using category.json
classNamedoes not work today) - Autogenerated category with doc link: use doc frontmatter for category metadata #6254 - this appears to make the change to support sidebar Title and Label, but at the time did not address className (or sidebar_class_name)
--
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.