Automatically discovers and processes all your Astro pages to generate three optimized documentation files:
npm i astro-llms-generate
/llms.txt– Smart index with titles, descriptions, and organized links grouped by directory/llms-small.txt– Ultra-compact structure-only version (titles + URLs)/llms-full.txt– Complete Markdown content dump with full page content
Watch Tutorial Video.
pnpm i astro-llms-generate
npm i astro-llms-generate
yarn add astro-llms-generateimport { defineConfig } from 'astro/config';
import astroLLMsGenerator from 'astro-llms-generate';
export default defineConfig({
site: 'https://example.com', // Required for full URLs in output files
integrations: [
astroLLMsGenerator(), // No configuration needed!
],
});export default defineConfig({
site: 'https://example.com',
integrations: [
astroLLMsGenerator({
title: 'My Documentation',
description: 'Custom description for AI systems',
includePatterns: ['**/*'], // Pages to include
excludePatterns: ['**/404*', '**/api/**'], // Pages to exclude
customSeparator: '\n\n---\n\n', // Custom separator for full content
i18n: false // Enable multilingual support - generates llms-en.txt, llms-es.txt, etc.
}),
],
});Since files are generated in the build output, they're available at /llms.txt, /llms-small.txt, and /llms-full.txt in your deployed site. To include them in your sitemap:
import sitemap from '@astrojs/sitemap';
export default defineConfig({
site: 'https://example.com',
integrations: [
astroLLMsGenerator(),
sitemap({
customPages: [
'https://example.com/llms.txt',
'https://example.com/llms-small.txt',
'https://example.com/llms-full.txt'
],
}),
],
});Files are automatically generated in the build output directory during astro build:
- Available at
/llms.txt,/llms-small.txt,/llms-full.txtin your final deployment - Generated only when running
astro build(not during development)
ps: forked from @4hse/astro-llms-txt for personal usage
Found a bug or want to contribute? Open an issue or submit a PR!