Files
vercel__workflow/docs/proxy.ts
Peter Wielander 5188f5b003 docs: make v5 the default documentation version
Serves `content/docs/v5` and `content/worlds/v5` unprefixed at /docs,
/worlds and /cookbook, moves v4 under /v4, and puts What's new first in
the v5 sidebar.

The versioned source config drives both route trees (the root tree always
renders `versionedSources.current`), so this is a `routePrefix` move plus
source re-binding rather than a restructure. The only file moves are
`app/[lang]/v5/**` → `app/[lang]/v4/**`.

- Version switcher: `v5 (Latest)` / `v4 (Maintenance)`, `current: 'v5'`.
- `pre-release-banner.tsx` becomes `maintenance-banner.tsx`. v4 pages
  carry an amber notice whose "Go to Workflow 5 (Latest)" link deep-links
  to the same page on the current version, falling back to the nearest
  section index for v4-only pages, and keep `robots: noindex, follow`.
- Redirects: `/v5/*` to the unprefixed equivalent (bare `/v5` needs its
  own rule, since `:path*` expands to an empty Location). The world-docs
  and api-reference restructure rules are mirrored onto `/v4/docs/*`, and
  every page existing in only one tree gets a version-switcher fallback.
- Both worlds route trees pass an explicit version into the shared page
  components, whose semantics flipped with the switch, so the smoke checks
  now assert the pairing: a " · v4" title marker and noindex on the
  maintenance routes, neither on the canonical ones, and a community world
  serving directly rather than self-redirecting.
- The link lint's two URL spaces swap with the prefixes. Redirect
  destinations resolve against the real HTTP space, since redirects are
  matched before render-time href rewriting.
- The two `/v4/...` links this makes expressible are restored: a v5 page
  cannot link to a v4 page while v4 is the unprefixed version.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 12:50:56 -07:00

31 lines
946 B
TypeScript

import { createProxy } from '@vercel/geistdocs/proxy';
import { config as geistdocsConfig } from '@/lib/geistdocs/config';
import { trackMdRequest } from '@/lib/md-tracking';
const proxy = createProxy({
config: geistdocsConfig,
trackMarkdownRequest: trackMdRequest,
markdownRoutes: [
{ from: '/docs/*path', to: '/[lang]/llms.mdx/docs/*path' },
{ from: '/cookbook/*path', to: '/[lang]/llms.mdx/cookbook/*path' },
{ from: '/v4/docs/*path', to: '/[lang]/llms.mdx/v4/docs/*path' },
{
from: '/v4/cookbook/*path',
to: '/[lang]/llms.mdx/v4/cookbook/*path',
},
{ from: '/worlds/*path', to: '/[lang]/llms.mdx/worlds/*path' },
{
from: '/v4/worlds/*path',
to: '/[lang]/llms.mdx/v4/worlds/*path',
},
],
});
export const config = {
matcher: [
'/((?!api(?:/|$)|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt|og(?:/|$)|.*\\.svg$|.*\\.zip$).*)',
],
};
export default proxy;