astro-llms-md
v2.0.0
Published
Generate llms.txt, llms-full.txt, and individual markdown files from your Astro site with this Astro integration
Maintainers
Readme
astro-llms-md
Listed on Astro Integrations: astro-llms-md on astro.build
An Astro integration to generate llms.txt, llms-full.txt, and markdown files from your Astro site.
What is llms.txt?
The llms.txt standard helps language models discover and understand your website's content. It provides:
- llms.txt - A lightweight index of your site's pages
- llms-full.txt - Complete content from all pages in one file
- Individual .md files - Separate markdown files for each page
Features
- ✅ Astro Integration - Seamless integration with Astro build process
- ✅ Zero-config - Works out of the box with sensible defaults
- ✅ Smart detection - Auto-detects Astro site URL from config
- ✅ TypeScript support - Full TypeScript type definitions
- ✅ Smart cleanup - Removes disabled file types automatically
Quick Start
1. Install
npm install -D astro-llms-md2. Add to Astro Config
// astro.config.mjs
import { defineConfig } from "astro/config";
import llms from "astro-llms-md";
export default defineConfig({
site: "https://your-site.com", // Required: your site URL
integrations: [
llms(), // That's it!
],
});3. Build
npm run buildThe integration automatically runs after the build and generates all files in your dist/ folder.
Integration Options
Configure the integration in astro.config.mjs:
import llms from "astro-llms-md";
export default defineConfig({
site: "https://your-site.com",
integrations: [
llms({
siteUrl: "https://your-site.com",
name: "My Site",
description: "A great website",
generateIndividualMd: true,
generateLlmsTxt: true,
generateLlmsFullTxt: true,
titleSelector: "h1",
contentSelector: "main",
exclude: ["404", "404.html", "_astro"],
verbose: false,
}),
],
});Configuration Options
All configuration is defined in astro.config.mjs via llms({...}). The integration also uses Astro's top-level site value when siteUrl is not provided.
| Option | Type | Default | Description |
| ---------------------- | ------- | ------------- | ------------------------------ |
| siteUrl | string | config.site | Your site's base URL |
| name | string | auto | Site name for llms.txt heading |
| description | string | auto | Site description |
| generateIndividualMd | boolean | true | Generate individual .md files |
| generateLlmsTxt | boolean | true | Generate llms.txt index |
| generateLlmsFullTxt | boolean | true | Generate llms-full.txt |
| titleSelector | string | "h1" | CSS selector for page title |
| contentSelector | string | "main" | CSS selector for main content |
| exclude | array | see below | Patterns to exclude |
| verbose | boolean | false | Detailed output |
Default Excludes
["404", "404.html", "_astro", "**.xml", "**.txt", "node_modules"]Output Files
After building, you'll have:
llms.txt
A lightweight index file:
# Your Site Name
> Your site description
This file helps language models discover the most useful content on this site.
## Home
- [Welcome](https://your-site.com/index.md)
## Company
- [About Us](https://your-site.com/about.md): Learn about our company
- [Contact](https://your-site.com/contact.md): Get in touchllms-full.txt
Complete content from all pages:
# Your Site Name
## Welcome
Full content from your homepage...
---
## About Us
Full content from your about page...Individual .md Files
Each page gets its own markdown file with YAML frontmatter:
---
title: "About Us"
url: "https://your-site.com/about"
description: "Learn about our company"
---
Content converted from HTML to Markdown...Troubleshooting
"No site URL specified"
Make sure to either:
- Set
siteinastro.config.mjs - Pass
siteUrlto the integration options
Pages not showing up
Check that your pages have:
- An
<h1>tag (or configuretitleSelector) - A
<main>element (or configurecontentSelector) - Valid HTML structure
License
MIT © Al Murad Uzzaman
