-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
fix(v2): Added back support for optional logo field in theme-classic navbarConfig #3611
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can make the logo object optional in the validation scheme?
docusaurus/packages/docusaurus-theme-classic/src/validateThemeConfig.js
Lines 245 to 251 in 2e7aef4
logo: Joi.object({ | |
alt: Joi.string().allow(''), | |
src: Joi.string().required(), | |
srcDark: Joi.string(), | |
href: Joi.string(), | |
target: Joi.string(), | |
}), |
Deploy preview for docusaurus-2 ready! Built without sensitive environment variables with commit bf593e0 |
@lex111 Oh I see your point. I have moved the default value to the config validation code. |
Reverted to the old |
Hmm, wouldn't the
|
I think optional is already the default, so adding optional doesn't help at all. |
My mistake, didn't see this code could fail. @SamChou19815 the idea of the PR was to remove all the default values from the theme, so I'd rather avoid reintroducing "logo = {}" in the theme. The following does not work?
Afaik the default value is not run against the validators by Joi |
@slorber I tried this approach in the first few commits, but it failed tests. Currently, the docusaurus/packages/docusaurus-theme-classic/src/validateThemeConfig.js Lines 245 to 251 in 2e7aef4
If we want to add |
Ok so let's merge it this way for now, and we'll figure out how to refactor this useLogo hook later |
Motivation
Fix #3610.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Comment out the
logo
field in docusaurus website's docusaurus.config.js, like:Without this change, site will crash:
With this change, site will load as usual, without the logo:
Related PRs
N/A