Skip to content

Commit c243ad7

Browse files
authored
fix(docs): serve llms-full.txt in the default locale only (#183)
Fixes #177 source.getPages() returns every locale's page set concatenated when called without a language, so /llms-full.txt served the full text of all seven locales interleaved — 4,608,768 bytes over 641 title lines. Pinned to i18n.defaultLanguage, following the shape PR #179 gave llms.txt. Measured over HTTP from production builds at base and head: 4,608,768 -> 671,413 bytes, 641 -> 93 title lines. Locale-exclusive titles before: en 63/63, zh-Hans 53/53, ja 31/31, de 25/25, es 32/32, fr 28/28, ko 31/31. After: en 63/63 and zero for all six others. This closes an exposure opened minutes earlier by #179, which removed the robots block on this endpoint. Translated page text stays reachable per page through the .mdx rewrite and the locale URLs llms.txt announces.
1 parent 8feb90d commit c243ad7

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎apps/docs/app/llms-full.txt/route.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1+
import { i18n } from '@/lib/i18n';
12
import { getLLMText, source } from '@/lib/source';
23

34
export const revalidate = false;
45

6+
/**
7+
* English only, by `AGENTS.md` rule 1 — English is the single source of truth
8+
* and every `*.<locale>.mdx` is a derived artifact. This is the same pin
9+
* `llms.txt` carries, for the same reason: `source.getPages()` filters by
10+
* locale **only when a language is passed** — called bare it returns every
11+
* language's page set concatenated, so this route used to emit all 335 pages
12+
* across 7 locales (4.6 MB, the same page appearing up to seven times) instead
13+
* of the 79 English ones. The locale text stays reachable per page through the
14+
* `.mdx` rewrite and the locale URLs announced at the end of `llms.txt`.
15+
*/
16+
const LANG = i18n.defaultLanguage;
17+
518
export async function GET() {
6-
const scan = source.getPages().map(getLLMText);
19+
const scan = source.getPages(LANG).map(getLLMText);
720
const scanned = await Promise.all(scan);
821

922
return new Response(scanned.join('\n\n'));

0 commit comments

Comments
 (0)