Skip to content

Commit 4c6ecbb

Browse files
authored
docs: simplify cookbook navigation (CopilotKit#5166)
## Problem The cookbook sidebar reused the docs framework picker and showed extra grouping chrome even though Daytona is the only cookbook page. ## Why The cookbook routes render through the shared docs page view, which always injected the framework selector into the sidebar and included the cookbook overview/section header from `meta.json`. ## Fix - Let cookbook pages explicitly suppress the shared sidebar selector. - Redirect `/cookbook` to `/cookbook/daytona`. - Keep the cookbook sidebar to the single Daytona page link. Validation: - `npm run lint` in `showcase/shell-docs` passes with existing warnings. - `npm run build` in `showcase/shell-docs` passes with existing Next/Turbopack warnings. - Repo pre-commit package checks passed on both commits. - `npm run typecheck` currently fails on existing `SignupLink` test prop errors unrelated to this change.
2 parents 3486944 + 9ef184e commit 4c6ecbb

4 files changed

Lines changed: 22 additions & 18 deletions

File tree

showcase/shell-docs/src/app/cookbook/[...slug]/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ export default async function CookbookSlugPage({
4141
const slugPath = `cookbook/${slug.join("/")}`;
4242
const navTree = buildNavTree(path.join(CONTENT_DIR, "cookbook"), "cookbook");
4343
return (
44-
<DocsPageView slugPath={slugPath} slugHrefPrefix="" navTree={navTree} />
44+
<DocsPageView
45+
slugPath={slugPath}
46+
slugHrefPrefix=""
47+
navTree={navTree}
48+
sidebarBannerSlot={null}
49+
/>
4550
);
4651
}
Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
// /cookbook — the cookbook landing page.
2-
//
3-
// Mirrors how /reference works today: a dedicated route with a sidebar
4-
// scoped to its own meta.json tree, so opening the cookbook shows only
5-
// the recipes — not the full Documentation tree.
6-
7-
import path from "path";
81
import type { Metadata } from "next";
9-
import { DocsPageView } from "@/components/docs-page-view";
10-
import { CONTENT_DIR, buildNavTree, loadDoc } from "@/lib/docs-render";
2+
import { redirect } from "next/navigation";
3+
import { loadDoc } from "@/lib/docs-render";
114
import { buildDocMetadata } from "@/lib/seo-metadata";
125

136
export const dynamic = "force-dynamic";
@@ -23,9 +16,5 @@ export async function generateMetadata(): Promise<Metadata> {
2316
}
2417

2518
export default function CookbookLandingPage() {
26-
// Scope the sidebar to the cookbook subtree only.
27-
const navTree = buildNavTree(path.join(CONTENT_DIR, "cookbook"), "cookbook");
28-
return (
29-
<DocsPageView slugPath="cookbook" slugHrefPrefix="" navTree={navTree} />
30-
);
19+
redirect("/cookbook/daytona");
3120
}

showcase/shell-docs/src/components/docs-page-view.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ export interface DocsPageViewProps {
105105
navTree?: NavNode[];
106106
/** Banner slot rendered above the main content column. */
107107
bannerSlot?: React.ReactNode;
108+
/** Banner slot rendered at the top of the sidebar. */
109+
sidebarBannerSlot?: React.ReactNode;
108110
/** When set, hide the main MDX body (used by pivot-only pages). */
109111
hideBody?: boolean;
110112
/**
@@ -142,6 +144,7 @@ export async function DocsPageView({
142144
frameworkOverride,
143145
navTree,
144146
bannerSlot,
147+
sidebarBannerSlot,
145148
hideBody = false,
146149
ContentWrapper,
147150
}: DocsPageViewProps) {
@@ -199,7 +202,16 @@ export async function DocsPageView({
199202
const fumadocsToc = tocHeadingsToFumadocs(tocHeadings);
200203

201204
return (
202-
<ShellDocsLayout tree={pageTree} banner={<SidebarFrameworkSelector />}>
205+
<ShellDocsLayout
206+
tree={pageTree}
207+
banner={
208+
sidebarBannerSlot === undefined ? (
209+
<SidebarFrameworkSelector />
210+
) : (
211+
sidebarBannerSlot
212+
)
213+
}
214+
>
203215
<DocsPage
204216
toc={fumadocsToc}
205217
breadcrumb={{ enabled: false }}

showcase/shell-docs/src/content/docs/cookbook/meta.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"title": "Cookbook",
33
"root": true,
44
"pages": [
5-
"index",
6-
"---Recipes---",
75
"daytona"
86
]
97
}

0 commit comments

Comments
 (0)