<!-- Generated from llms-txt-eleventy/index.html. The canonical document is the HTML page. -->

- [ Home ](/) 
/
- [ How to create ](/how-to-create/) 
/
- Eleventy guide            
# llms.txt for Eleventy (11ty)

Eleventy's template system makes llms.txt straightforward: use a plain text file with a permalink frontmatter key, or loop over collections to auto-generate links from your content.

Last updated: April 22, 2026

## Option 1: plain text template

Create a file at `src/llms.txt` (or anywhere in your input directory). Add a `permalink` key in YAML frontmatter to control the output path. Eleventy will process the file and write it
to `_site/llms.txt`.
src/llms.txt   
Copy

```
---
permalink: /llms.txt
eleventyExcludeFromCollections: true
---
# Your Site

> One-sentence description of what your site or product does.

## Documentation

- [Getting Started](https://yoursite.com/docs/start): Install and configure in minutes.
- [API Reference](https://yoursite.com/docs/api): Full endpoint catalog with examples.

## Product

- [Overview](https://yoursite.com/product): Core features and capabilities.
- [Pricing](https://yoursite.com/pricing): Plans and billing details.

## Optional

- [Changelog](https://yoursite.com/changelog): Release history.
- [GitHub](https://github.com/your-org/your-repo): Source code.

```

✓ Add txt to templateFormats

By default Eleventy does not process  .txt  files as templates. Add  'txt'  to the  templateFormats  array in your  eleventy.config.js . See the config snippet below.
eleventy.config.js, enable txt templates   
Copy

```
// eleventy.config.js
module.exports = function (eleventyConfig) {
// Add passthrough copy for any assets you want served verbatim
// llms.txt is handled via permalink in the template, no passthrough needed

// Optional: add a collection for docs
eleventyConfig.addCollection('docs', function (collectionApi) {
return collectionApi.getFilteredByGlob('src/docs/**/*.md');
});

// Ensure .txt files are processed as templates
return {
templateFormats: ['md', 'njk', 'html', 'txt'],
dir: {
input: 'src',
output: '_site',
},
};
};

```

## Option 2: generate from collections

If your documentation is managed as Eleventy collections (Markdown files with frontmatter), you
can loop over the collection inside the template and generate the link list automatically. Use
the `---js` frontmatter syntax for JavaScript-based configuration, or Nunjucks/Liquid template
syntax for the body.
src/llms.txt, from collections   
Copy

```
---js
{
permalink: "/llms.txt",
eleventyExcludeFromCollections: true
}
---
# Your Site

> {{ site.description }}

## Documentation

{% for doc in collections.docs | sort(attribute='data.order') -%}
- [{{ doc.data.title }}]({{ site.url }}{{ doc.url }}): {{ doc.data.description }}
{% endfor %}

```

The `site.url` global data variable should be set in your `_data/site.js` or `_data/site.json` file. Ensure all links use absolute URLs,
relative paths will not resolve correctly when fetched by AI crawlers.

## Permalink config

Key frontmatter options for your `llms.txt` template:

- `permalink: /llms.txt`, output the file at the root of your site. 
- `eleventyExcludeFromCollections: true`, prevents the file from appearing in your
site collections (nav, feeds, sitemaps). 
- `layout: false`, ensures no layout wrapper is applied (not needed since `.txt` files don't use HTML layouts by default).   
## Verify

Run your Eleventy build and check the output:
Build and verify   
Copy

```
# Build
npx @11ty/eleventy

# Check that the file was generated
cat _site/llms.txt | head -5

# After deploying, verify the live URL
curl -I https://yoursite.com/llms.txt
# Expected: content-type: text/plain; charset=utf-8
```

## Related guides

- [How to create llms.txt](/how-to-create/), templates and checklist. 
- [llms.txt format reference](/llms-txt-format/), spec details. 
- [Hugo guide](/llms-txt-hugo/), similar static site generator approach. 
- [Gatsby guide](/llms-txt-gatsby/), React-based static generation. 
- [Validator](/validator/) · [Generator](/generator/).        
## Sources

- [ llmstxt.org, official spec ](https://llmstxt.org/)
- [ Eleventy docs, permalinks ](https://www.11ty.dev/docs/permalinks/)
- [ Eleventy docs, collections ](https://www.11ty.dev/docs/collections/)           
On this page

- [ Option 1: plain text template ](#static)
- [ Option 2: generate from collections ](#dynamic)
- [ Permalink config ](#permalink)
- [ Verify ](#verify)
