-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Improve docs navbar items error messages #8696
Comments
how should the error message look like ? |
I'd like to work on this |
Thanks @KhalfounMehdi , go ahead and submit a PR, we'll discuss the exact wording on the PR directly
I don't know the exact wording we should use but it should help user figure out that the problem is in the Docusaurus config file, in one of the Considering the error message is thrown in a quite generic hook (used in multiple places), there are a few options we could use to improve the DX:
Using error cause can probably be done this way inside DocNavbarItem: function useNavbarItemDoc(docId, docsPluginId) {
try {
return useLayoutDoc(docId, docsPluginId);
} catch (e) {
throw new Error(
"There's a problem in a navbar item blabla, your Docusaurus config themeConfig.navbar.items is probably wrong blabla...",
{ cause: e }
);
}
} Note: other navbar items might be affected by similarly unclear error messages as well: let's fix them all if possible! |
👋 @slorber I've started tinkering on this locally based on your notes above, I see @KhalfounMehdi has first dibs but if there isn't a PR submitted in the next few days I'm happy to submit one! |
@tannerdolby feel free to work on it.
The first to open a draft PR showing they are actually working on this will be assigned the issue. |
Just figured out we already have a Improving the error messages remain a thing we should do, so another PR focusing on that is welcome. |
Okay sounds good! Thanks for the heads up. I will submit a PR that focuses on improving the error messages. |
Have you read the Contributing Guidelines on issues?
Motivation
The navbar error messages are not so great and some new users get confused when they encounter an error trying to modify a newly initialized Docusaurus project.
I think we should improve these error messages so that users understand what to do:
cf #8692
Also we could introduce a new
docSidebar
navbar item that links to a given sidebar. This is less likely to lead users to encounter errors when trying Docusaurus for the first time because they are less likely to delete/rename a sidebar IMHO.The init template has an
tutorialSidebar
autogenerated sidebar: https://github.com/facebook/docusaurus/blob/main/examples/classic/sidebars.jsI suggest moving the init template from:
to
Good first issue for an external contributor that feels comfortable taking this task.
You can claim the issue here, but please submit a first draft PR within 24h.
Otherwise, someone else can claim it again and submit a new PR.
Self-service
The text was updated successfully, but these errors were encountered: