starlight-llms-txt
Version:
Generate llms.txt files to train large language models on your Starlight documentation website
17 lines (15 loc) • 585 B
text/typescript
import type { APIRoute } from 'astro';
import { starlightLllmsTxtContext } from 'virtual:starlight-llms-txt/context';
import { generateLlmsTxt } from './generator';
import { getSiteTitle } from './utils';
/**
* 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: true,
description: `This is the abridged developer documentation for ${getSiteTitle()}`,
exclude: starlightLllmsTxtContext.exclude,
});
return new Response(body);
};