fix: highlight appropriate navItem based on active sidebar item (#6310)

* fix: highlight appropriate navItem based on active sidebar item

* fix: try using location.pathname

* fix: remote console.log

* fix: include category generated indices in globalData

* Add test

* fix snap

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Tapan Chudasama 2022-01-16 11:11:40 +05:30 committed by GitHub
parent 6e75d035bb
commit 3e5944ef1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 9 deletions

View file

@ -20,10 +20,12 @@ export async function createCategoryGeneratedIndexRoutes({
version,
actions,
docCategoryGeneratedIndexComponent,
aliasedSource,
}: {
version: LoadedVersion;
actions: PluginContentLoadedActions;
docCategoryGeneratedIndexComponent: string;
aliasedSource: (str: string) => string;
}): Promise<RouteConfig[]> {
const slugs = createSlugger();
@ -69,7 +71,7 @@ export async function createCategoryGeneratedIndexRoutes({
component: docCategoryGeneratedIndexComponent,
exact: true,
modules: {
categoryGeneratedIndex: propData,
categoryGeneratedIndex: aliasedSource(propData),
},
// Same as doc, this sidebar route attribute permits to associate this subpage to the given sidebar
...(sidebar && {sidebar}),
@ -149,6 +151,7 @@ export async function createVersionRoutes({
version,
actions,
docCategoryGeneratedIndexComponent,
aliasedSource,
}),
]);