|
| 1 | +# Docs v6 Consolidation Plan |
| 2 | + |
| 3 | +## Current State |
| 4 | + |
| 5 | +- **`content/docs/`** (v7): Main docs — ~644 MDX files across ORM, Postgres, Accelerate, CLI, Guides, etc. |
| 6 | +- **`content/docs.v6/`** (v6): Full duplicate — ~222 MDX files mirroring the same sections: |
| 7 | + - `(index)/` — v6 landing + prisma-orm + prisma-postgres quickstarts |
| 8 | + - `orm/` — v6-specific ORM content (different structure than v7) |
| 9 | + - `postgres/`, `accelerate/`, `optimize/`, `guides/`, `platform/`, `ai/` |
| 10 | + |
| 11 | +- **Routing**: `/` and `/*` → v7 (default); `/v6` and `/v6/*` → v6 (own layout + `sourceV6`) |
| 12 | +- **Version switcher**: Shown on both v7 and v6 layouts; switches between v7/v6 sections |
| 13 | + |
| 14 | +## Goal |
| 15 | + |
| 16 | +- Version only the **ORM** section between v6 and v7 |
| 17 | +- Remove the full `docs.v6` duplication |
| 18 | +- Non-ORM sections (Postgres, Accelerate, Guides, etc.) use v7 content only |
| 19 | +- Version switcher appears only on ORM pages |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Plan |
| 24 | + |
| 25 | +### Phase 1: Content Restructure |
| 26 | + |
| 27 | +#### 1.1 Create ORM-only v6 content |
| 28 | + |
| 29 | +- **Keep**: `content/docs.v6/orm/` (v6-specific ORM content) |
| 30 | +- **Remove**: Everything else from `docs.v6`: |
| 31 | + - `(index)/`, `accelerate/`, `ai/`, `guides/`, `optimize/`, `platform/`, `postgres/` |
| 32 | + |
| 33 | +#### 1.2 v6 landing options |
| 34 | + |
| 35 | +**Option A – Redirect (simplest)** |
| 36 | +- `/v6` → redirect to `/v6/orm` |
| 37 | +- No extra v6 index content |
| 38 | +- Remove `(index)/` from docs.v6 entirely |
| 39 | + |
| 40 | +**Option B – Minimal landing page** |
| 41 | +- Keep a small `content/docs.v6/(index)/index.mdx` that: |
| 42 | + - Acts as `/v6` landing |
| 43 | + - Links to `/v6/orm` (versioned ORM) |
| 44 | + - Links to v7 sections for Postgres, Guides, etc. (`/postgres`, `/guides`, …) |
| 45 | + |
| 46 | +#### 1.3 Update source config |
| 47 | + |
| 48 | +**`source.config.ts`**: |
| 49 | + |
| 50 | +- Keep `docs` (v7) as is |
| 51 | +- Change `docsV6` to load only ORM + index: |
| 52 | + |
| 53 | + ```ts |
| 54 | + // Option A: Keep structure, restrict via meta |
| 55 | + export const docsV6 = defineDocs({ |
| 56 | + dir: 'content/docs.v6', |
| 57 | + // Only orm/ and index exist |
| 58 | + }); |
| 59 | + ``` |
| 60 | + |
| 61 | + Or use a separate “orm v6” source if fumadocs allows multiple dirs. The key is that `docsV6` should only expose ORM pages + `/v6` index. |
| 62 | + |
| 63 | +#### 1.4 Internal links in v6 ORM |
| 64 | + |
| 65 | +- v6 ORM currently links to `/v6/postgres`, `/v6/guides`, etc. |
| 66 | +- After removal, these must point to v7 equivalents: `/postgres`, `/guides`, etc. |
| 67 | +- Run a bulk update (or script) to replace `/v6/` with `/` for non-ORM sections |
| 68 | +- Keep `/v6/orm` links as-is for links within ORM |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +### Phase 2: Routing & Layout |
| 73 | + |
| 74 | +#### 2.1 Redirect non-ORM v6 paths |
| 75 | + |
| 76 | +For `/v6/postgres`, `/v6/accelerate`, etc., add redirects to v7: |
| 77 | + |
| 78 | +- `/v6` → keep (v6 landing) |
| 79 | +- `/v6/orm`, `/v6/orm/*` → serve from v6 ORM source |
| 80 | +- `/v6/postgres`, `/v6/postgres/*` → redirect to `/postgres`, `/postgres/*` |
| 81 | +- `/v6/accelerate`, `/v6/accelerate/*` → redirect to `/accelerate`, … |
| 82 | +- `/v6/guides`, `/v6/optimize`, `/v6/platform`, `/v6/ai` → same pattern |
| 83 | + |
| 84 | +**Implementation options**: |
| 85 | + |
| 86 | +- **A. Middleware** (`middleware.ts`): Match `/v6/<section>` and redirect non-ORM sections. |
| 87 | +- **B. v6 catch-all page**: In `(docs)/v6/[[...slug]]/page.tsx`, if `slug[0]` is not `orm` and not empty, call `redirect()` to the v7 path. |
| 88 | + |
| 89 | +#### 2.2 v6 layout |
| 90 | + |
| 91 | +- **ORM pages** (`/v6/orm/*`): Use current v6 layout with v6 ORM sidebar. |
| 92 | +- **v6 index** (`/v6`): Use a simplified layout or shared layout with minimal nav. |
| 93 | + |
| 94 | +If we merge v6 into the default route group, the v6 layout can be conditional: show v6 sidebar only for `/v6/orm/*`, otherwise use v7 tree. |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +### Phase 3: Source & Data |
| 99 | + |
| 100 | +#### 3.1 `source.config.ts` |
| 101 | + |
| 102 | +```ts |
| 103 | +// v6 docs: only orm + index (no postgres, accelerate, etc.) |
| 104 | +export const docsV6 = defineDocs({ |
| 105 | + dir: 'content/docs.v6', |
| 106 | + // Structure: index.mdx (/) + orm/ (orm subtree) |
| 107 | +}); |
| 108 | +``` |
| 109 | + |
| 110 | +Ensure `meta.json` for `content/docs.v6` only lists `orm` (and optionally `(index)` if needed). |
| 111 | + |
| 112 | +#### 3.2 `source.ts` |
| 113 | + |
| 114 | +- `sourceV6` continues to use `docsV6`, but it will have far fewer pages (ORM + index only). |
| 115 | +- `getSource(version)` stays the same; v6 source will just have a smaller page set. |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +### Phase 4: Integrations |
| 120 | + |
| 121 | +Update all consumers of `sourceV6` to reflect that it now only has ORM + index: |
| 122 | + |
| 123 | +| File | Change | |
| 124 | +|------|--------| |
| 125 | +| `src/lib/source.ts` | No change if `sourceV6` is just a smaller loader | |
| 126 | +| `src/app/(docs)/sitemap.ts` | No change; fewer v6 URLs | |
| 127 | +| `src/app/og/docs/[...slug]/route.tsx` | No change; v6 pages still valid | |
| 128 | +| `src/app/llms.txt/route.ts` | No change | |
| 129 | +| `src/app/llms.mdx/[[...slug]]/route.ts` | No change | |
| 130 | +| `src/app/llms-full.txt/route.ts` | No change | |
| 131 | +| `src/app/api/search/route.ts` | No change | |
| 132 | +| `scripts/lint-links.ts` | No change | |
| 133 | +| `src/lib/page-badges.ts` | No change | |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +### Phase 5: Version Switcher |
| 138 | + |
| 139 | +- **Current**: Shown on every v7 and v6 page. |
| 140 | +- **Target**: Show only on ORM pages. |
| 141 | + |
| 142 | +**Changes**: |
| 143 | + |
| 144 | +1. **`(default)/layout.tsx`** |
| 145 | + Show `VersionSwitcher` only when `pathname` matches `/orm` or `/orm/*`. |
| 146 | + |
| 147 | +2. **`v6/layout.tsx`** |
| 148 | + Keep `VersionSwitcher` (all v6 routes will be ORM or index, which is fine). |
| 149 | + |
| 150 | +3. **`version-switcher.tsx`** |
| 151 | + Update `VERSION_SECTIONS` so that when switching: |
| 152 | + - From v7 ORM to v6: go to `/v6/orm` |
| 153 | + - From v6 ORM to v7: go to `/orm` |
| 154 | + - When not on ORM, switching versions can either hide the switcher or navigate to `/orm` / `/v6/orm`. |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +### Phase 6: Static Assets |
| 159 | + |
| 160 | +- **Keep**: `public/docs/v6/orm/` (images used by v6 ORM) |
| 161 | +- **Remove**: `public/docs/v6/` assets for other sections if any |
| 162 | +- **Verify**: Image paths in v6 ORM MDX (e.g. `/docs/v6/orm/...`) still resolve correctly |
| 163 | + |
| 164 | +--- |
| 165 | + |
| 166 | +### Phase 7: Link Migration Script |
| 167 | + |
| 168 | +Create a script to update internal links in `content/docs.v6/orm/**/*.mdx`: |
| 169 | + |
| 170 | +- Links like `/v6/postgres/...` → `/postgres/...` |
| 171 | +- Links like `/v6/guides/...` → `/guides/...` |
| 172 | +- Links like `/v6/accelerate/...` → `/accelerate/...` |
| 173 | +- Links like `/v6/platform/...` → `/platform/...` |
| 174 | +- Links like `/v6/ai/...` → `/ai/...` |
| 175 | +- Keep `/v6/orm/...` as-is |
| 176 | + |
| 177 | +--- |
| 178 | + |
| 179 | +## File Structure After Consolidation |
| 180 | + |
| 181 | +``` |
| 182 | +content/ |
| 183 | + docs/ # v7 (unchanged) |
| 184 | + orm/ |
| 185 | + postgres/ |
| 186 | + ... |
| 187 | + docs.v6/ # Minimal v6 |
| 188 | + index.mdx # /v6 landing (new or extracted) |
| 189 | + orm/ # v6 ORM only (keep) |
| 190 | + getting-started/ |
| 191 | + overview/ |
| 192 | + prisma-client/ |
| 193 | + prisma-migrate/ |
| 194 | + prisma-schema/ |
| 195 | + reference/ |
| 196 | + ... |
| 197 | + meta.json # pages: ["(index)", "orm"] or equivalent |
| 198 | +``` |
| 199 | + |
| 200 | +--- |
| 201 | + |
| 202 | +## Implementation Order |
| 203 | + |
| 204 | +1. **Phase 1.3 + 1.4**: Update source config and `meta.json`; add link migration script and run it. |
| 205 | +2. **Phase 1.1 + 1.2**: Remove non-ORM content from `docs.v6`; add v6 index. |
| 206 | +3. **Phase 2.1**: Implement redirects for non-ORM v6 paths. |
| 207 | +4. **Phase 2.2**: Adjust v6 layout for ORM-only content. |
| 208 | +5. **Phase 5**: Restrict version switcher to ORM pages. |
| 209 | +6. **Phase 6**: Clean up public assets. |
| 210 | +7. Test sitemap, OG, LLM, search, and lint-links. |
| 211 | + |
| 212 | +--- |
| 213 | + |
| 214 | +## Risks & Considerations |
| 215 | + |
| 216 | +1. **Existing links**: External links to `/v6/postgres`, `/v6/guides`, etc. will 301/308 to v7. Ensure redirects are correct. |
| 217 | +2. **v6 ORM ↔ v7 sections**: v6 ORM content may link to v7 Postgres/Guides. Verify those v7 pages exist and are appropriate for v6 users. |
| 218 | +3. **Fumadocs source**: Confirm that defining `docsV6` with only `orm/` + index in `dir: 'content/docs.v6'` produces the expected URL structure (`/v6`, `/v6/orm`, `/v6/orm/*`). |
| 219 | + |
| 220 | +--- |
| 221 | + |
| 222 | +## Optional Enhancements |
| 223 | + |
| 224 | +- **Version banner**: On v7 ORM, optionally show: “Viewing v7. Switch to [v6](/v6/orm).” |
| 225 | +- **Breadcrumbs**: Ensure breadcrumbs correctly show “ORM” and version when on `/v6/orm/*`. |
| 226 | +- **Edit on GitHub** (required fix): In `(docs)/v6/[[...slug]]/page.tsx`, `EditOnGitHub` currently uses `content/docs/${page.path}` but v6 content lives in `content/docs.v6/`. Update to `content/docs.v6/${page.path}`. |
0 commit comments