From 12be7b7d6c38d57a69a7818b85c2a3781675b4b6 Mon Sep 17 00:00:00 2001 From: barckcode Date: Mon, 12 Oct 2026 19:02:03 +0200 Subject: [PATCH 1/2] feat(docs): nest a guide under another in the sidebar; PR gatekeeper under Automations Adds an optional `parent` frontmatter field (the parent's entry id). A page with a parent is rendered as an indented sub-item right under it, in the parent's group, never twice. The parent shows an active trail while the child is open, the breadcrumb includes the parent, and prev/next follow the sidebar's visual order. - docsNav: groupDocsNav nests children (cycle/orphan safe), flattenDocsNav, isActiveDocTrail, docsNavAncestors, shared docsNavItemFromEntry - DocsSidebarNav + recursive DocsNavList components, nested list markup - pr-gatekeeper: parent automations, order 21 (webhooks 22), EN and ES - fix: /es/docs no longer highlights as active on every Spanish page - tests: unit nesting specs, Container API render test (EN/ES), frontmatter guards for `parent`; vitest split into unit and render projects Co-Authored-By: Claude Opus 5.5 --- ARCHITECTURE.md | 2 + src/components/docs/DocsNavList.astro | 45 +++++ src/components/docs/DocsSidebarNav.astro | 27 +++ src/content.config.ts | 11 ++ src/content/docs-es/pr-gatekeeper.mdx | 3 +- src/content/docs-es/webhooks.mdx | 2 +- src/content/docs/pr-gatekeeper.mdx | 3 +- src/content/docs/webhooks.mdx | 2 +- src/layouts/Docs.astro | 60 +++---- src/lib/docsNav.test.ts | 157 ++++++++++++++++++ src/lib/docsNav.ts | 123 ++++++++++++-- src/styles/docs-shell.css | 27 +++ src/tests/layouts/DocsShell.test.ts | 33 ++++ src/tests/layouts/automationsDocs.test.ts | 4 +- src/tests/layouts/docsI18n.test.ts | 4 +- .../layouts/docsNavNesting.render.test.ts | 112 +++++++++++++ src/tests/layouts/prGatekeeperDocs.test.ts | 16 +- vitest.config.ts | 24 ++- vitest.render.config.ts | 20 +++ 19 files changed, 615 insertions(+), 60 deletions(-) create mode 100644 src/components/docs/DocsNavList.astro create mode 100644 src/components/docs/DocsSidebarNav.astro create mode 100644 src/tests/layouts/docsNavNesting.render.test.ts create mode 100644 vitest.render.config.ts diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index f77b43d3..46ca43fc 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -128,6 +128,8 @@ The community-tier signup page (`/community`) reuses `LanguageSwitcher.astro` an | `/docs/examples` | Code snippets (Python, Node.js, curl) | | `/docs/api` | OpenAI-compatible API reference (endpoints, auth, rate limits) | +Sidebar navigation comes from each guide's frontmatter (`src/content.config.ts`): `group` picks the section, `order` the position, and an optional `parent` (the entry id of another guide, identical in EN and ES) lists the page as an indented sub-item right under that guide, in the parent's group. URLs stay flat (`/docs/`); the breadcrumb and prev/next follow the sidebar's visual order. Logic and tests: `src/lib/docsNav.ts`; markup: `src/components/docs/DocsSidebarNav.astro` + `DocsNavList.astro` (rendered in tests with the Astro Container API, `*.render.test.ts`, see `vitest.render.config.ts`). + ### API Endpoints #### `POST /api/waitlist` diff --git a/src/components/docs/DocsNavList.astro b/src/components/docs/DocsNavList.astro new file mode 100644 index 00000000..27e2854c --- /dev/null +++ b/src/components/docs/DocsNavList.astro @@ -0,0 +1,45 @@ +--- +/** + * One level of the docs sidebar: a list of pages, each with the pages nested + * under it (frontmatter `parent`) rendered as an indented sub-list right below. + * + * It recurses through Astro.self, so nesting depth is whatever the data says. + * Sub-items are always shown, not behind a toggle: with a handful of children + * a disclosure button would add a click and a focus stop for no gain, and a + * plain nested