mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 23:49:03 +00:00
30833db87e005e4ef0257eaed728ea569b03c359
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2e63060c59 |
fix(docs): serve markdown 404s for guessed .md urls (#52293)
Coding agents guess docs URLs that don't exist: markdown variants of pages that have no markdown (`/docs/reference/<sdk>/<fn>.md`, `/docs/guides/<slug>.md`) and `/docs/llms.txt`. Reference guesses get an empty-body 404 from the crawler renderer for bot user agents and the full HTML reference for browsers, and the rest get the HTML 404 page, so the agent never learns where the content lives. Reference `.md` guesses are about half of coding-agent docs 4xx, and guide `.md` guesses about a tenth. **Changed:** - **Reference `.md` guesses**: the docs proxy answers every `/docs/reference/**.md` request itself, for any user agent and before the crawler rewrite, with a markdown 404 (`no-store`) linking the HTML page and the SDK's full markdown reference (`/llms/js.txt`, `/llms/dart.txt`, and so on), or `/llms.txt` for references without one. - **Unknown guide `.md` guesses**: guide `.md` requests whose slug has no markdown variant get the same markdown 404 instead of the HTML 404. The body says there is no markdown version of the page, because a few real guide pages (CLI config, self-hosting config, troubleshooting indexes) are TSX-only. Known guides and Accept-negotiated requests without `.md` are unchanged. - **`/docs/llms.txt`**: I added a permanent www redirect to `/llms.txt`, next to the existing `/docs/reference/llms.md` redirect. **Note:** the `.md` check in `proxy.ts` catches every reference `.md` URL, so it has to be narrowed when per-function reference markdown ships, or it will 404 those files. ## To test Tested on the PR previews (docs deployment for the 404s, www deployment for the redirect): - [x] `curl -sD - -A 'curl/8.7.1' <docs-preview>/docs/reference/javascript/select.md`: expect 404, `content-type: text/markdown`, `cache-control: no-store`, and a body linking `https://supabase.com/docs/reference/javascript/select` and `https://supabase.com/llms/js.txt` - [x] Repeat for `dart/select.md`, `python/select.md`, `cli/supabase-init.md` and `api/v1-list-all-projects.md`: expect the matching `/llms/<sdk>.txt` - [x] Repeat `javascript/select.md` with a browser user agent: expect the same markdown 404 - [x] `curl -sD - <docs-preview>/docs/guides/doesnotexist.md`: expect 404 markdown with `no-store`, linking `https://supabase.com/llms.txt` - [x] `curl -s <docs-preview>/docs/guides/local-development/cli/config.md`: expect 404 markdown linking `https://supabase.com/docs/guides/local-development/cli/config` - [x] `curl -sD - <docs-preview>/docs/guides/database/overview.md`: expect 200 markdown, unchanged - [x] Open `<docs-preview>/docs/guides/doesnotexist` in a browser: expect the branded HTML 404, unchanged - [x] `curl -sIL -o /dev/null -w '%{num_redirects} %{http_code}\n' <www-preview>/docs/llms.txt`, once with a browser user agent and once with `Googlebot/2.1`: expect `1 200` ## Linear - fixes GROWTH-1325 |
||
|
|
44386580e3 |
feat(docs): upgrade to Next.js 16 (#52045)
## Problem The docs site (`apps/docs`) is still on Next.js 15, which is close to the end of its support window under the [Next.js support policy](https://nextjs.org/support-policy). Resolves [DOCS-1485](https://linear.app/supabase/issue/DOCS-1485/upgrade-the-docs-site-to-nextjs-16). ## Solution Upgrades `apps/docs` to Next.js 16.3.6. The scope is limited to what Next.js 16 requires, so existing routes, redirects, and responses stay the same. - **Dependencies:** `next` uses the workspace catalog, and `@next/mdx` and `@next/bundle-analyzer` are bumped to 16.3.6. - **Webpack:** `dev` and `build` run with `--webpack`, because the docs config loads `.include`, `.toml`, and YAML files through webpack, and the MDX remark plugins have non-serializable options. - **Proxy:** `middleware.ts` is renamed to `proxy.ts`. - **Cache revalidation:** `revalidateTag` is called with `{ expire: 0 }` to keep immediate expiration. - **Images:** `images.localPatterns` allows guide images with `?v=N` cache-busting query strings. Without it, those pages return 500. - **Scroll behavior:** `data-scroll-behavior="smooth"` on `<html>` keeps route changes jumping to the top instantly. - **Config:** the `eslint` key is removed from `next.config.mjs`, and Sentry options use their new names. - **`next-env.d.ts`:** gitignored, like in the other apps, because Next.js 16 regenerates it differently for `dev` and `typegen`. ### Dependency on the marketing site upgrade The docs chat edge function (`/api/ai/docs`) stays under the Vercel Edge Function size limit because #52001 ([FE-4673](https://linear.app/supabase/issue/FE-4673/upgrade-the-marketing-site-to-nextjs-16)) removed `js-tiktoken` from `ai-commands`. This branch is based on `master` with that change. ## Known limitations - `proxy.ts` runs on the Node.js runtime instead of edge. - `nuqs` v1 doesn't declare support for Next.js 15 or 16. The troubleshooting filters work on Next.js 16, but the dependency is outside its supported range. - `next/legacy/image` and `unstable_cache` are deprecated but still supported. - Tabs opened before the deploy keep running the Next.js 15 client. On their next client-side navigation, the router loads the page in full instead. Docs pages are prerendered, so these requests don't reach the renderer or report errors to Sentry. ## Review instructions 1. Run `pnpm --filter=docs typecheck` and `pnpm --filter=docs test:local`. 2. Run `pnpm dev:docs` and open a guide, a client library reference page, and `/guides/troubleshooting` with a filter applied. 3. Check the Vercel preview against production docs: every sitemap URL returns the same status code, and redirects, `.md` responses, search, and the AI chat behave the same. A local production build already matches production for the following: - All 2,564 sitemap URLs - The redirects in `next.config.mjs`, except where a www redirect handles the path first - `.md` negotiation, including the 406 response - Reference rewrites, including bot requests Search and the AI chat need the preview, because they depend on production data and keys. 4. Confirm the preview build has enough memory. Locally, `next build` peaked at about 4 GB. ## Future work - Upgrade `nuqs` to v2. - Replace `next/legacy/image` with `next/image`. - Replace `unstable_cache` with `use cache`. ## Checklist Check all before review: - [ ] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) |