Closed roydukkey closed 3 years ago
Make sense, all docusaurus pages should have a convenient way to target them with custom CSS.
In general, we should have:
Each theme page should rather always have 2 classes, like blog-wrapper blog-list-page
For retrocompatibility we'd rather avoid refactoring existing classes
I'd also like to have all those classnames being migrated to the theme-common
package under a constant file like ThemeClassnames.ts
, so that it's more explicit that those classnames should remain stable over time or we'd break user's custom CSS
Assigning this task to MLH fellows.
FYI there's also a need to be able to target with CSS a specific doc/version/blog/page: https://github.com/facebook/docusaurus/issues/4280
Ie we probably want a classname like docs-wrapper doc-item-page version-1.0.0 docId
?
@ShinteiMai to work on this.
🚀 Feature
Add class names to individuate blog theme components.
Have you read the Contributing Guidelines on issues?
Yes
Motivation
Having a class name to differentiate blog list pages from post pages would allow styling the pages using the global style methodology.
Pitch
Currently, global styling is not possible since there is not variancy between the structures of
BlogListPage
andBlogPostPage
. Adding another class name (e.g.blog-list-page
,blog-post-page
), alongside theblog-wrapper
class name, would allow for global styling.Furthermore, there doesn't seem to be another way to inject additional class names into these components except to wrap them. I don't feel wrapping the components is a good flow, just to add classes to target for styling, since a global styling methodology often tries to lessen its dependency on structure.
For the
docusaurus-theme-classic
, these are the proposed changes to the blog components:blog-list-page
class name to theLayout
component forBlogListPage
blog-post-page
class name to theLayout
component forBlogPostPage
blog-tags-list-page
class name to theLayout
component forBlogTagsListPage
blog-tags-post-page
class name to theLayout
component forBlogTagsPostsPage