docs: improvement to sidebar (#11810)
* docs: improvement to sidebar * fix sidebar
This commit is contained in:
@@ -1148,18 +1148,17 @@ export const generatedSidebars = [
|
||||
"type": "link",
|
||||
"path": "/learn/build",
|
||||
"title": "Build",
|
||||
"chapterTitle": "8. Production",
|
||||
"children": [],
|
||||
"chapterTitle": "8.1. Build",
|
||||
"number": "8.1."
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "link",
|
||||
"path": "/learn/deployment",
|
||||
"title": "Deployment Overview",
|
||||
"children": [
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "link",
|
||||
"path": "/learn/deployment",
|
||||
"title": "Deployment Overview",
|
||||
"children": [],
|
||||
"chapterTitle": "8.1. Deployment Overview",
|
||||
"number": "8.1."
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
@@ -1167,13 +1166,16 @@ export const generatedSidebars = [
|
||||
"path": "/learn/deployment/general",
|
||||
"title": "General Deployment",
|
||||
"children": [],
|
||||
"chapterTitle": "8.2. General Deployment",
|
||||
"number": "8.2."
|
||||
"chapterTitle": "8.2.1. General Deployment",
|
||||
"number": "8.2.1."
|
||||
}
|
||||
],
|
||||
"number": "8."
|
||||
"chapterTitle": "8.2. Deployment Overview",
|
||||
"number": "8.2."
|
||||
}
|
||||
]
|
||||
],
|
||||
"chapterTitle": "8. Production",
|
||||
"number": "8."
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
|
||||
@@ -597,20 +597,25 @@ export const sidebars = [
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
path: "/learn/build",
|
||||
title: "Build",
|
||||
chapterTitle: "Production",
|
||||
type: "category",
|
||||
title: "Production",
|
||||
children: [
|
||||
{
|
||||
type: "link",
|
||||
path: "/learn/build",
|
||||
title: "Build",
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
path: "/learn/deployment",
|
||||
title: "Deployment Overview",
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
path: "/learn/deployment/general",
|
||||
title: "General Deployment",
|
||||
children: [
|
||||
{
|
||||
type: "link",
|
||||
path: "/learn/deployment/general",
|
||||
title: "General Deployment",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -301,7 +301,7 @@ export const SidebarProvider = ({
|
||||
}, [scrollableElement, isBrowser])
|
||||
|
||||
const activeMainSidebar = useMemo(() => {
|
||||
if (!activePath) {
|
||||
if (!activePath || sidebars.length === 1) {
|
||||
// set first sidebar as active
|
||||
return sidebars[0]
|
||||
}
|
||||
@@ -357,7 +357,7 @@ export const SidebarProvider = ({
|
||||
|
||||
const shownSidebar = useMemo(() => {
|
||||
if (!sidebarHistory.length) {
|
||||
return
|
||||
return sidebars.length === 1 ? sidebars[0] : undefined
|
||||
}
|
||||
|
||||
return getSidebar(sidebarHistory[sidebarHistory.length - 1])
|
||||
|
||||
Reference in New Issue
Block a user