Skip to content

Commit 10fd972

Browse files
committed
🐛 filter llms-full.txt to single locale via ?lang= query param
Default to en so LLM consumers get a single-language document. Other locales available via /llms-full.txt?lang=zh etc. https://claude.ai/code/session_01UwMuBPaeouJ16zJTVa8UJm
1 parent a8fe078 commit 10fd972

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import { getLLMText, source } from '@/lib/source';
1+
import { getLLMText, source } from "@/lib/source";
2+
import { i18n } from "@/lib/i18n";
3+
import { type NextRequest } from "next/server";
24

35
export const revalidate = false;
46

5-
export async function GET() {
6-
const scan = source.getPages().map(getLLMText);
7-
const scanned = await Promise.all(scan);
7+
export async function GET(req: NextRequest) {
8+
const lang = req.nextUrl.searchParams.get("lang") ?? i18n.defaultLanguage;
9+
const pages = source.getPages(lang);
10+
const scanned = await Promise.all(pages.map(getLLMText));
811

9-
return new Response(scanned.join('\n\n'));
12+
return new Response(scanned.join("\n\n"));
1013
}

0 commit comments

Comments
 (0)