/ llmtxt.info

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:

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
---
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.
eleventy.config.js — enable txt templates
// 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
---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.

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
# 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

Sources