fix(v2): show doc sidebar on pages with case-sensitive paths #2235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Since the router configures with case-insensitive paths (by default), we will display the page correctly if the path is written in a different case (
creating-Pages
->creating-pages
(proper path), and vice versa). Although my personal opinion is that in this case you need to display a 404 error, because this is technically the wrong address, it means that we need to work it out correctly.However, changing current behavior will result in breaking changes, which is best avoided, so let's leave it as it is. But as noted in issue #2190, in such cases the doc sidebar is not shown. This PR fixes this.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Make the appropriate changes also in sidebar.js file.
docs/docusaurus-core
(page with wrong path that we will handle) anddocs/Docusaurus-Core
(new correct path) - the result should be the same.Note that, only when going to the wrong page (
docs/docusaurus-core
) for a second or so will content of 404 page be displayed (which should be)