|
| 1 | +# Multi-Page Studio — every section is its own indexable URL |
| 2 | + |
| 3 | +> Builds on the deploy-unify work (PR #5): `StudioShell.astro` + standalone mode |
| 4 | +> already exist and `/deploy` already renders a single section in the shell. |
| 5 | +> This generalizes that pattern to the WHOLE site: each Explorer "table" becomes |
| 6 | +> its own real, indexable page; the Explorer left-menu navigates by URL; the |
| 7 | +> homepage `#hash` in-page swap is removed. Smooth client-side transitions via |
| 8 | +> Astro View Transitions. |
| 9 | +
|
| 10 | +## Decisions (locked with user, 2026-06-23) |
| 11 | +- **Homepage model A**: `/` = home/hero only. Every other section is its own page. |
| 12 | + No single-scroll landing. |
| 13 | +- Explorer left-menu links are **real URLs** (`/features`, `/`, `/deploy`), not |
| 14 | + `/#id`. Clicking navigates (with View Transitions for SPA-like smoothness). |
| 15 | +- **In-page hash swap is removed entirely** (simpler `studio.ts`). |
| 16 | +- **`/docker-compose-example` joins the studio** as the 9th Explorer table and a |
| 17 | + real studio page (user: "this is important — it must be in the left menu too"). |
| 18 | +- **View Transitions** (`astro:transitions` `<ClientRouter/>`) added for smooth |
| 19 | + navigation; chrome persists, the result pane animates. |
| 20 | +- Out of scope (stay standalone, NOT Explorer tables): `/privacy-policy`, `404`. |
| 21 | + They keep Header/Footer for now. |
| 22 | + |
| 23 | +## 1. Routing & slugs |
| 24 | +| URL | Page source | Active section | |
| 25 | +|---|---|---| |
| 26 | +| `/` | `index.astro` | home (hero) | |
| 27 | +| `/features` | `[section].astro` | features | |
| 28 | +| `/databases` | `[section].astro` | databases | |
| 29 | +| `/compare` | `[section].astro` | compare | |
| 30 | +| `/tech-stack` | `[section].astro` | tech_stack | |
| 31 | +| `/get-started` | `[section].astro` | get_started | |
| 32 | +| `/faq` | `[section].astro` | faq | |
| 33 | +| `/deploy` | `[section].astro` | deploy | |
| 34 | +| `/docker-compose-example` | `[section].astro` | docker_compose | |
| 35 | + |
| 36 | +- **One dynamic route** `src/pages/[section].astro` with `getStaticPaths()` |
| 37 | + emitting the 8 non-home slugs; it maps slug→Section component and renders |
| 38 | + `<StudioShell standalone active={id}>` + `<SectionShell section><Comp/></SectionShell>`. |
| 39 | +- `index.astro` keeps `/` (home). `deploy.astro` and `docker-compose-example.astro` |
| 40 | + are **deleted** (replaced by the dynamic route + section components). |
| 41 | +- **Slug field** added to `SectionMeta`: `slug` (home→`''`→`/`; underscores→hyphens; |
| 42 | + docker_compose→`docker-compose-example` to preserve the indexed URL). |
| 43 | +- `getStaticPaths` returns `sections.filter(s => s.id !== 'home').map(s => ({ params: { section: s.slug }, props: { id: s.id } }))`. |
| 44 | + |
| 45 | +## 2. The 9-table Explorer manifest (`src/data/sections.ts`) |
| 46 | +Existing 8 entries gain `slug`, `pageTitle`, `pageDescription`. A 9th entry is added: |
| 47 | +``` |
| 48 | +docker_compose: |
| 49 | + table: 'docker_compose' slug: 'docker-compose-example' |
| 50 | + query: 'SELECT variable, default, description FROM env_vars;' |
| 51 | + columns: [variable VARCHAR, default VARCHAR, description TEXT] rows: 21 cols: 3 execMs: 6 |
| 52 | + explain: 'A copy-paste docker-compose.yml: pulls the published image, with every |
| 53 | + env var (auth, OIDC SSO, storage, AI/LLM, seed) — self-host in one command.' |
| 54 | + pageTitle: 'LibreDB Studio Docker Compose Example — Self-Host in Minutes' |
| 55 | + pageDescription: (existing description, verbatim) |
| 56 | +``` |
| 57 | +(Per-section `pageTitle`/`pageDescription` drive each page's `<title>`/meta. Home's |
| 58 | +page title stays the current homepage title.) |
| 59 | + |
| 60 | +Optional per-section structured data: a small map (in the manifest or a sibling |
| 61 | +`section-seo.ts`) of `id → JSON-LD object[]`: |
| 62 | +- `deploy` → the ItemList schema (moved out of the deleted deploy.astro). |
| 63 | +- `docker_compose` → the HowTo + SourceCode schemas (moved out of the deleted page). |
| 64 | +The dynamic route injects these into `<head>` via the Layout `head` slot. |
| 65 | + |
| 66 | +## 3. Shell, Explorer, and the removal of in-page swap |
| 67 | +- **Explorer/MobileTopBar**: section links become real URLs `href={s.slug === '' ? '/' : '/' + s.slug}`. The `standalone` prop is replaced by this URL model (every studio page links by URL now). `active` (server-rendered per page) sets the highlight. |
| 68 | +- **Every studio page renders ONE section**, server-marked active and always shown. |
| 69 | + The `.studio.js .studio-section { display:none unless .is-active }` swap rule is |
| 70 | + removed; a single section simply fills the pane (`flex-col h-full`, results scroll). |
| 71 | +- **`StudioShell`**: keeps `active`; `standalone` becomes the default/only mode |
| 72 | + (single-section). It renders the chrome + one section slot. `data-initial-active` |
| 73 | + retained for `studio.ts`. |
| 74 | + |
| 75 | +## 4. `studio.ts` simplification |
| 76 | +Remove: `setActive` section-swap toggling, hash routing (`hashchange`/`popstate`), |
| 77 | +`onLinkClick` swap, the `is-active` juggling. Section links are plain `<a href>` |
| 78 | +navigations. Keep + adapt for View Transitions (`astro:page-load`): |
| 79 | +- Command palette (open/close/keyboard) — "Jump to {section}" → `location.href = '/'+slug` (with `''`→`/`). |
| 80 | +- Explorer search filter + Enter → `location.href = '/'+firstMatch.slug`. |
| 81 | +- Console toasts; RUN shimmer + toast; Copy deep link (now copies `origin + '/' + slug`); Export; Explain toggle; column expand; mobile drawer. |
| 82 | +- Active-row highlight: set on `astro:page-load` from `location.pathname` (since chrome persists across transitions). |
| 83 | +Net: the file shrinks substantially (no swap/hash engine). |
| 84 | + |
| 85 | +## 5. View Transitions |
| 86 | +- Add `<ClientRouter />` (`astro:transitions`) in `Layout.astro` `<head>`. |
| 87 | +- Mark persistent chrome with `transition:persist`: TopBar, the Explorer sidebar, |
| 88 | + StatusBar, Console, CommandPalette (so they don't flicker; the result pane |
| 89 | + cross-fades). The `<main class="studio-pane">` content transitions. |
| 90 | +- Re-run interaction wiring on `astro:page-load` (studio.ts subscribes to it instead |
| 91 | + of only `DOMContentLoaded`). Respect `prefers-reduced-motion` (Astro VT already does; |
| 92 | + keep our shimmer guard). |
| 93 | + |
| 94 | +## 6. Content extraction (single source; mostly already components) |
| 95 | +- home/features/databases/compare/tech_stack/get_started/faq → already section |
| 96 | + components; reused by the dynamic route. No content rewrite. |
| 97 | +- deploy → `DeploySection.astro` already the single rich source (PR #5). Reused. |
| 98 | +- **`DockerComposeSection.astro` (NEW)** — single source of the docker-compose |
| 99 | + content lifted from the deleted page: quick-start block + copy button, the full |
| 100 | + `docker-compose.example.yml` via `<Code lang="yaml">`, the 5 env-var reference |
| 101 | + tables, the links row, and the `.copy-btn` client `<script>` + the `.compose-code` |
| 102 | + scoped style. Imports `composeYaml` from `../../data/docker-compose.example.yml?raw`. |
| 103 | + |
| 104 | +## 7. Internal links updated to real URLs |
| 105 | +- Footer "Product" (`/#features` → `/features`, etc.; Docker Compose link → |
| 106 | + `/docker-compose-example`), HomeSection CTAs, get_started pointer (`/#…` → `/…`), |
| 107 | + Header nav (used by the remaining standalone pages) → `/features` etc. |
| 108 | +- Hash anchors were never separately indexed, so no redirects needed. (Optional: |
| 109 | + none required.) |
| 110 | + |
| 111 | +## 8. Files |
| 112 | +``` |
| 113 | +src/data/sections.ts MOD + slug/pageTitle/pageDescription on 8; + docker_compose (9th) |
| 114 | +src/data/section-seo.ts NEW id → JSON-LD[] (deploy ItemList; docker_compose HowTo+SourceCode) |
| 115 | +src/pages/index.astro MOD StudioShell active=home + HomeSection (home page) + home SEO |
| 116 | +src/pages/[section].astro NEW dynamic route: getStaticPaths over non-home slugs; slug→component; per-section SEO + head-slot JSON-LD |
| 117 | +src/pages/deploy.astro DEL (replaced by [section].astro) |
| 118 | +src/pages/docker-compose-example.astro DEL (replaced by [section].astro + DockerComposeSection) |
| 119 | +src/components/sections/DockerComposeSection.astro NEW single-source compose content (+ copy script + style) |
| 120 | +src/components/studio/StudioShell.astro MOD single-section mode; real-URL link model |
| 121 | +src/components/studio/Explorer.astro MOD links = real URLs by slug; active highlight |
| 122 | +src/components/studio/MobileTopBar.astro MOD same link model |
| 123 | +src/scripts/studio.ts MOD remove swap/hash engine; palette/search navigate by URL; astro:page-load lifecycle; active-row sync |
| 124 | +src/styles/global.css MOD remove swap display rule; single-section always-shown |
| 125 | +src/layouts/Layout.astro MOD add <ClientRouter/>; keep head slot |
| 126 | +src/components/Footer.astro / Header.astro MOD internal links → real section URLs |
| 127 | +``` |
| 128 | + |
| 129 | +## 9. SEO |
| 130 | +- 9 indexable URLs, each with its own `<title>`/description/self-canonical → far |
| 131 | + better coverage than today's `/` + `/deploy`. Astro sitemap auto-includes all routes. |
| 132 | +- `/deploy` ItemList and `/docker-compose-example` HowTo+SourceCode JSON-LD preserved |
| 133 | + via the per-section SEO map + head slot. Existing global JSON-LD stays on every page. |
| 134 | +- `/deploy` and `/docker-compose-example` keep their exact current URLs → indexing continuity. |
| 135 | + |
| 136 | +## 10. Out of scope |
| 137 | +`/privacy-policy`, `404` remain standalone Header/Footer pages (not Explorer tables). |
| 138 | +A later pass could fold them into the shell, but they are not "tables". |
| 139 | + |
| 140 | +## 11. Success criteria |
| 141 | +- 9 real pages build; Explorer shows 9 tables; clicking any navigates by URL. |
| 142 | +- `/`, `/deploy`, `/docker-compose-example` keep their URLs + structured data. |
| 143 | +- No in-page hash swap remains; `studio.ts` has no setActive/hashchange engine. |
| 144 | +- View Transitions: navigating between sections animates; chrome doesn't flicker; |
| 145 | + reduced-motion respected. Studio interactions (palette/search/run/copy/export/ |
| 146 | + explain/toasts/drawer) work after every navigation. |
| 147 | +- `bunx astro build` passes; `bun test` green; deploy/docker-compose content each |
| 148 | + authored in exactly one source file. |
| 149 | +``` |
0 commit comments