Make SubNavigation locale-aware for prefixed routes - #254
Merged
mathewjordan merged 1 commit intoJul 20, 2026
Merged
Conversation
mathewjordan
self-requested a review
July 20, 2026 14:25
mathewjordan
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SubNavigationbuilt its sidebar tree by rooting at the first path segment of the current page (segments[0]). For locale-prefixed content (e.g.content/fr/...) that first segment is the locale, not the section, so the sidebar for a page like/fr/a-propos/guidewas rooted at/frand listed every page under that locale (including unrelated sections like/fr/chronologie) instead of just the current section.isLocaleSegment/rootDepthForSegments/rootSegmentForSegmentshelpers (using the existingcanonicalizeLocaleCode) that root at<locale>/<section>(depth 2) when the first segment is a configured locale, else<section>(depth 1).<locale>/<section>nodes as navigation roots — previously only depth-1 nodes could ever become roots.buildNavigationForFileandgetPageInfoto use the locale-aware root segment.EXCLUDED_ROOTS(works/search) are now matched against the section name, so they stay excluded under a locale prefix (fr/works) too.