starlight-llms-txt
Version:
Generate llms.txt files to train large language models on your Starlight documentation website
19 lines (15 loc) • 580 B
text/typescript
import type { APIRoute } from 'astro';
import { generateLlmsTxt } from './generator';
import { getSiteTitle } from './utils';
// Explicitly set this to prerender so it works the same way for sites in `server` mode.
export const prerender = true;
/**
* Route that generates a single plaintext Markdown document from the full website content.
*/
export const GET: APIRoute = async (context) => {
const body = await generateLlmsTxt(context, {
minify: false,
description: `This is the full developer documentation for ${getSiteTitle()}`,
});
return new Response(body);
};