docs: support multiple sidebars in a project (#11768)
* changed to new sidebar across projects except resources * finalize multi sidebar support * clean up * remove redundant property * small changes * fixes * generate * fix error * fix initial open
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { MetadataRoute } from "next"
|
||||
|
||||
import { docsConfig } from "@/config/docs"
|
||||
import { sidebars } from "@/config/sidebar"
|
||||
import { absoluteUrl } from "@/lib/absolute-url"
|
||||
import { SidebarItem } from "types"
|
||||
import { Sidebar } from "types"
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const now = new Date()
|
||||
@@ -12,7 +12,7 @@ export default function sitemap(): MetadataRoute.Sitemap {
|
||||
lastModified?: string | Date
|
||||
}> = []
|
||||
|
||||
function pushItems(newItems: SidebarItem[]) {
|
||||
function pushItems(newItems: Sidebar.SidebarItem[]) {
|
||||
newItems.forEach((item) => {
|
||||
if (item.type !== "link") {
|
||||
return
|
||||
@@ -29,7 +29,7 @@ export default function sitemap(): MetadataRoute.Sitemap {
|
||||
})
|
||||
}
|
||||
|
||||
pushItems(docsConfig.sidebar.default)
|
||||
sidebars.forEach((sidebar) => pushItems(sidebar.items))
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
@@ -60,14 +60,7 @@ export default function RootLayout({
|
||||
htmlClassName={clsx(inter.variable, robotoMono.variable)}
|
||||
gaId={process.env.NEXT_PUBLIC_GA_ID}
|
||||
>
|
||||
<TightLayout
|
||||
sidebarProps={{
|
||||
expandItems: true,
|
||||
}}
|
||||
ProvidersComponent={Providers}
|
||||
>
|
||||
{children}
|
||||
</TightLayout>
|
||||
<TightLayout ProvidersComponent={Providers}>{children}</TightLayout>
|
||||
</BareboneLayout>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user