Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I customize blog styles? #2353

Closed
liushooter opened this issue Mar 4, 2020 · 7 comments
Closed

How do I customize blog styles? #2353

liushooter opened this issue Mar 4, 2020 · 7 comments
Labels
closed: question This issue is a user error/misunderstanding. status: needs triage This issue has not been triaged by maintainers

Comments

@liushooter
Copy link

I want to change docusaurus-v2 blog title style,
find this information in @docusaurus/theme-classic/src/theme/BlogPostItem/styles.module.css :

.blogPostTitle {
  font-size: 3rem;
}

I change src/css/custom.css following,no effect :

.blogPostTitle {
  font-size: 1rem;
}

Help me,How do I customize blog styles?

@liushooter liushooter added status: needs triage This issue has not been triaged by maintainers closed: question This issue is a user error/misunderstanding. labels Mar 4, 2020
@liushooter
Copy link
Author

liushooter commented Mar 6, 2020

yeah, i find this https://stackoverflow.com/a/58519684

yarn swizzle @docusaurus/theme-classic BlogListPage
yarn swizzle @docusaurus/theme-classic BlogPostItem
yarn swizzle @docusaurus/theme-classic BlogPostPage
yarn swizzle @docusaurus/theme-classic BlogTagsListPage
yarn swizzle @docusaurus/theme-classic BlogTagsPostsPage

yarn swizzle @docusaurus/theme-classic CodeBlock

@fakela
Copy link
Contributor

fakela commented Mar 12, 2020

@liushooter I had similar issue too, this does not have any effect because it's not properly referenced. It's actually best to style the blog using the styles.module.css and use this src/css/custom.css for styles you want to be available globally. This is what I figured out when trying to style my blog

@yangshun should be able to give a more detailed explanation

@kohheepeace
Copy link
Contributor

@fakela

  1. Run the below command in terminal to swizzle default theme
yarn swizzle @docusaurus/theme-classic BlogPostItem

It generates src/theme/BlogPostItem in your website.

You can overwrite your custom style in src/theme/BlogPostItem/styles.module.css

Sorry if this is different answer what you want!

@fakela
Copy link
Contributor

fakela commented Mar 12, 2020

@kohheepeace thank you alot for this
I used a different approach
I had to copy the files and paste them in my website

This is a lot easier . Thanks

@rafaelrdealmeida
Copy link

rafaelrdealmeida commented Nov 3, 2020

Hi,

I'm trying to change the blog layout. But I am not finding the place to customize the layout. Can you indicate that?

the current layout is this:


Captura de tela de 2020-11-03 16-49-51

I'm trying to alteral to:


Captura de tela de 2020-11-03 17-02-30

@slorber
Copy link
Collaborator

slorber commented Nov 4, 2020

hi @rafaelrdealmeida , all the blog components are in the classic theme

image

The one displayed in your screenshot looks like the BlogPostList component, that you can swizzle

@zRains
Copy link

zRains commented Dec 15, 2020

npm version:

npm run swizzle @docusaurus/theme-classic [component] -- --danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: question This issue is a user error/misunderstanding. status: needs triage This issue has not been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

7 participants