mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem Agents have no single index of the docs markdown exports, unlike the KB's `sitemap.md`. www's `/llms.txt` and `/llms-full.txt` also read docs files from disk, which forces www's build to wait on the docs build. ## Solution **docs** - Add `build:markdown-sitemap`, which writes `public/markdown/sitemap.md`. It scans `public/markdown/**/*.md` and lists each file as `[title](url.md)`. Guide URLs are `/docs/guides/<page>.md` and the rest are `/docs/markdown/<page>.md`, built with the existing `internal-links` helpers. - Add `build:markdown-full`, which writes `public/markdown/full.md`. It concatenates the same files. - Both scripts share one file-list helper (`internals/markdown-files.ts`), so they always cover the same files and exclude `sitemap.md` and `full.md`. - Both tasks depend on `build:markdown` and are wired into `build` in turbo. - Search v2 ingestion and the `docs.tar.gz` archive now ignore both files. **www** - `/llms.txt` and `/llms-full.txt` now fetch `sitemap.md` and `full.md` from `NEXT_PUBLIC_DOCS_URL`, replacing only their docs parts. Pricing, product overviews, agent resources, the KB link and the customer stories link are unchanged. If docs is unreachable, the docs section is left out instead of returning a 404. - Remove the on-disk docs reads, the `outputFileTracingIncludes` entries, and the `docs#build:guides-markdown` dependency and docs input globs from www's turbo config. These routes were the only link between www and the docs build. `turbo-build.test.ts` is updated to match. - Add a `/docs.md` → `/docs/markdown/sitemap.md` redirect, next to the existing `/kb.md` one. Routes without a markdown export are not patched, they are simply absent from the sitemap. ## Review instructions From the Docs preview link: 1. Open /docs/markdown/sitemap.md it should show a file with all links to the docs pages available in markdown 1. Open /docs/markdown/full.md it should show a file with all the content from all the pages Sadly, only after deployed... 1. www project should return the content of both files when: a. supabase.com/llms.txt is queried should return docs sitemap.md content b. supabase.com/llms-full.txt is queried should return docs full.md content 1. supabase.com/docs.md should return sitemap.md file ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] 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)
27 lines
966 B
TypeScript
27 lines
966 B
TypeScript
import fs from 'node:fs/promises'
|
|
|
|
import { FULL_FILE, listMarkdownFiles, MARKDOWN_DIR } from './markdown-files'
|
|
|
|
// Concatenates the content of every file listed in sitemap.md into a single markdown file.
|
|
async function generate() {
|
|
const files = await listMarkdownFiles()
|
|
const contents = await Promise.all(
|
|
files.map(async (file) => (await fs.readFile(`${MARKDOWN_DIR}/${file}`, 'utf8')).trim())
|
|
)
|
|
|
|
const fullContent = [
|
|
'# Supabase Documentation',
|
|
'',
|
|
'> Supabase is a Postgres development platform. Each index below lists every page in one area of the docs: a guide section, an SDK, the CLI, or the Management API.',
|
|
'',
|
|
'For product overviews and pricing, see the site-wide index at https://supabase.com/llms.txt.',
|
|
'',
|
|
contents.join('\n\n'),
|
|
].join('\n')
|
|
|
|
await fs.writeFile(`${MARKDOWN_DIR}/${FULL_FILE}`, fullContent)
|
|
console.log(`Created ${MARKDOWN_DIR}/${FULL_FILE} from ${files.length} files`)
|
|
}
|
|
|
|
generate()
|