Fix sidebar generation and display logic #490
Merged
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.
This change fixes two issues that prevented auto-generated sidebar entries from appearing as highlighted in the sidebar when a user visits them:
The sidebar generator assumes that the table of contents page for a subsection can either be at the same level as its corresponding subdirectory or within that subdirectory. Currently, placing a page at both locations causes an unexpected reuslt. This change throws an error if a page exists at both locations.
The navigation component currently assumes that a docs page's slug begins with the slug of its parent menu page. However, this is not true if the menu page is within its corresponding directory. E.g., the sidebar generator treats
docs/pages/directory/directory/
as a valid slug for the menu page ofdocs/pages/directory/
, but the navigation component would not showdocs/pages/directory/page1
as highlighted in that case.This change resolves this issue by recursively descending through an entry to determine whether one of its entries is highlighted, rather than using the URL path alone.