mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 02:08:55 +02:00
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:
parent
6e75d035bb
commit
3e5944ef1f
5 changed files with 73 additions and 9 deletions
|
@ -9,6 +9,9 @@
|
|||
{
|
||||
"type": "category",
|
||||
"label": "Slugs",
|
||||
"link": {
|
||||
"type": "generated-index"
|
||||
},
|
||||
"items": [
|
||||
"rootAbsoluteSlug",
|
||||
"rootRelativeSlug",
|
||||
|
|
|
@ -23,6 +23,9 @@ Object {
|
|||
"rootTryToEscapeSlug",
|
||||
],
|
||||
"label": "Slugs",
|
||||
"link": Object {
|
||||
"type": "generated-index",
|
||||
},
|
||||
"type": "category",
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -46,8 +46,8 @@ Object {
|
|||
"lastUpdatedAt": undefined,
|
||||
"lastUpdatedBy": undefined,
|
||||
"next": Object {
|
||||
"permalink": "/docs/rootAbsoluteSlug",
|
||||
"title": "rootAbsoluteSlug",
|
||||
"permalink": "/docs/category/slugs",
|
||||
"title": "Slugs",
|
||||
},
|
||||
"permalink": "/docs/foo/bazSlug.html",
|
||||
"previous": Object {
|
||||
|
@ -196,7 +196,11 @@ Object {
|
|||
},
|
||||
],
|
||||
"label": "Slugs",
|
||||
"link": undefined,
|
||||
"link": Object {
|
||||
"permalink": "/docs/category/slugs",
|
||||
"slug": "/category/slugs",
|
||||
"type": "generated-index",
|
||||
},
|
||||
"type": "category",
|
||||
},
|
||||
Object {
|
||||
|
@ -317,6 +321,11 @@ Object {
|
|||
"path": "/docs/tryToEscapeSlug",
|
||||
"sidebar": undefined,
|
||||
},
|
||||
Object {
|
||||
"id": "/category/slugs",
|
||||
"path": "/docs/category/slugs",
|
||||
"sidebar": "docs",
|
||||
},
|
||||
],
|
||||
"isLast": true,
|
||||
"label": "Next",
|
||||
|
@ -340,6 +349,21 @@ Object {
|
|||
|
||||
exports[`simple website content: data 1`] = `
|
||||
Object {
|
||||
"category-docs-docs-category-slugs-0fe.json": "{
|
||||
\\"title\\": \\"Slugs\\",
|
||||
\\"slug\\": \\"/category/slugs\\",
|
||||
\\"permalink\\": \\"/docs/category/slugs\\",
|
||||
\\"navigation\\": {
|
||||
\\"previous\\": {
|
||||
\\"title\\": \\"baz pagination_label\\",
|
||||
\\"permalink\\": \\"/docs/foo/bazSlug.html\\"
|
||||
},
|
||||
\\"next\\": {
|
||||
\\"title\\": \\"rootAbsoluteSlug\\",
|
||||
\\"permalink\\": \\"/docs/rootAbsoluteSlug\\"
|
||||
}
|
||||
}
|
||||
}",
|
||||
"site-docs-doc-with-space-md-e90.json": "{
|
||||
\\"unversionedId\\": \\"doc with space\\",
|
||||
\\"id\\": \\"doc with space\\",
|
||||
|
@ -413,8 +437,8 @@ Object {
|
|||
\\"permalink\\": \\"/docs/foo/bar\\"
|
||||
},
|
||||
\\"next\\": {
|
||||
\\"title\\": \\"rootAbsoluteSlug\\",
|
||||
\\"permalink\\": \\"/docs/rootAbsoluteSlug\\"
|
||||
\\"title\\": \\"Slugs\\",
|
||||
\\"permalink\\": \\"/docs/category/slugs\\"
|
||||
}
|
||||
}",
|
||||
"site-docs-heading-as-title-md-c6d.json": "{
|
||||
|
@ -800,7 +824,8 @@ Object {
|
|||
}
|
||||
],
|
||||
\\"collapsible\\": true,
|
||||
\\"collapsed\\": true
|
||||
\\"collapsed\\": true,
|
||||
\\"href\\": \\"/docs/category/slugs\\"
|
||||
},
|
||||
{
|
||||
\\"type\\": \\"link\\",
|
||||
|
@ -1009,6 +1034,11 @@ Object {
|
|||
"path": "/docs/tryToEscapeSlug",
|
||||
"sidebar": undefined,
|
||||
},
|
||||
Object {
|
||||
"id": "/category/slugs",
|
||||
"path": "/docs/category/slugs",
|
||||
"sidebar": "docs",
|
||||
},
|
||||
],
|
||||
"isLast": true,
|
||||
"label": "Next",
|
||||
|
@ -1090,6 +1120,15 @@ Array [
|
|||
},
|
||||
"path": "/docs/absoluteSlug",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocCategoryGeneratedIndexPage",
|
||||
"exact": true,
|
||||
"modules": Object {
|
||||
"categoryGeneratedIndex": "~docs/category-docs-docs-category-slugs-0fe.json",
|
||||
},
|
||||
"path": "/docs/category/slugs",
|
||||
"sidebar": "docs",
|
||||
},
|
||||
Object {
|
||||
"component": "@theme/DocItem",
|
||||
"exact": true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue