All jobs

Add an llms.txt File to an Eleventy Site

Yes. An agent adds llms.txt and llms-full.txt templates to your Eleventy site, built from your posts collection and site metadata at every build, and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent clones the repository into its own cloud sandbox and reads how the site is assembled before it adds a template. In a site like 11ty/eleventy-base-blog, package.json is on @11ty/eleventy 3.1 with the RSS, navigation, image and syntax highlight plugins, Node 22 from .nvmrc, and npx @11ty/eleventy as the build. eleventy.config.js sets content/ as the input, _site as the output, Nunjucks for Markdown and HTML, a drafts preprocessor that drops any page with draft: true from a production build, the HtmlBasePlugin, and an Atom feed at /feed/feed.xml. _data/metadata.js holds the site title, url, description and author, with https://example.com/ as the placeholder url. content/content.11tydata.js gives every file under content/ the layouts/home.njk layout, content/blog/blog.11tydata.js tags each post into posts and gives it layouts/post.njk, and content/sitemap.xml.njk already shows the pattern for a non-HTML output: permalink, layout: false, eleventyExcludeFromCollections: true, and absolute urls through the htmlBaseUrl filter with metadata.url.

It adds content/llms.txt.njk with that same front matter and permalink: /llms.txt, so the file is excluded from the sitemap and the feed and gets no HTML layout, which the data cascade would otherwise apply. The body follows the llms.txt proposal: an h1 with metadata.title, a blockquote with metadata.description, a Posts section with one line per post as a Markdown link to its absolute url followed by its description from front matter, newest first through the reverse filter rather than a .reverse() call that would mutate the shared collection, and a Pages section linking the about page and the feed. Draft posts never appear in a build, because the preprocessor removes them before collections are made.

A second template, content/llms-full.txt.njk, writes every post in full. Eleventy 3 gives each collection item a rawInput, the original Markdown without its front matter, so the agent emits each post as a heading with the title and a readableDate, then rawInput passed through the safe filter, since Nunjucks autoescapes output and would otherwise turn every < in a code sample into an entity. Images referenced in posts stay as the relative Markdown the author wrote, and the pull request says so.

In the sandbox the agent runs npm install and npx @11ty/eleventy, reads _site/llms.txt and _site/llms-full.txt to check the links are absolute and the post order matches the home page, confirms _site/sitemap.xml does not list either file, and runs a build with ELEVENTY_RUN_MODE=build and a throwaway draft: true post to show it is left out. It then opens the pull request.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Add llms.txt and llms-full.txt to this Eleventy site. Read eleventy.config.js, _data/metadata.js, the directory data files under content/ and content/sitemap.xml.njk first. Create two Nunjucks templates under content/ with text permalinks, no layout and excluded from collections: llms.txt with the site title, description, one link per post with its description newest first and a short pages section, and llms-full.txt with each post's raw Markdown under a dated heading. Use absolute urls through the html base filter, use the reverse filter rather than mutating the collection, and keep drafts out. Build the site, check both outputs and the sitemap, and open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

What comes back is a pull request on its own branch that adds content/llms.txt.njk and content/llms-full.txt.njk and changes nothing else. The description shows the first lines of each built file, explains why the templates set layout: false and are excluded from collections, and pastes the build output from the sandbox.

The run's record keeps the build log and the cat of both outputs, so a reviewer reads the real llms.txt as a visitor would fetch it rather than reasoning from the template.

Before merging, a reviewer sets metadata.url to the real domain if it is still the placeholder, since every link in both files is built from it, and decides whether llms-full.txt should include every post or only a recent window, which is a head filter away.

Run it on every new site repository

Start one run per site from your own server: POST /o/{org}/sessions with this prompt and that repository in resources, one call each. GET /o/{org}/github lists every repository the Rush GitHub App installation reaches, so a script can pick the Eleventy sites with no llms.txt template and start a run for each, in its own sandbox and on its own branch.

Give the key a webhook_url and each run posts run.completed with its session_url when the turn finishes, so the pull request links collect on your side without polling. A script over many Eleventy sites can fire every request in one go: a key keeps max_concurrent runs in progress, 4 by default and up to 100, and a site past that answers 202 with status: "queued", then starts, oldest first, when a slot frees.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

An llms.txt is two small templates, and the ways to get them wrong are specific to this site: a layout applied by the data cascade that wraps the text in HTML, relative links that mean nothing outside the site, a .reverse() that quietly flips the home page's post order, escaped code samples in the full file, or a draft that leaks. The agent reads the config and the data files, follows the sitemap template's own conventions, and builds the site in its own sandbox before the pull request exists.

The sandbox runs the build with the Node version the repository names and keeps every command and its output in the run's record. Several sites can get the same two files at once in separate sandboxes, each ending in its own pull request built from that site's metadata.

Frequently asked questions

Will the files update when I publish a post?

Yes. Both are Eleventy templates over collections.posts, so every build rewrites them from the current posts and metadata, the same way the feed and sitemap are rebuilt. Nothing is generated by hand or committed as output.

Why are they excluded from collections?

The sitemap template iterates collections.all, and the feed reads posts, so a text file in the collections would list itself in the sitemap. Excluding it, as sitemap.xml.njk already does for itself, keeps both files out of every list.

Do drafts end up in llms-full.txt?

No. The drafts preprocessor in eleventy.config.js returns false for any draft: true page when ELEVENTY_RUN_MODE is build, so the page never joins a collection. During --serve drafts are rendered with (draft) in the title and would appear, which is the same behaviour the blog archive has.

What about the HTML base plugin and a path prefix?

Links are passed through htmlBaseUrl with metadata.url, the filter the sitemap uses, so a pathPrefix set for a subdirectory deploy is included in every url. Set metadata.url to the real domain, because the placeholder https://example.com/ would be baked into both files.

More Eleventy jobs

The same job on other stacks

Keep reading