# Add an llms.txt file to your docs

import { Aside, Steps } from '@astrojs/starlight/components';

This guide shows you how to publish an `llms.txt` file so large language models can use your documentation at inference time. You create the file, place it correctly, and set up a routine to keep it current. If you are new to the standard, read [What is llms.txt?](/guides/llms-txt/what-is-llms-txt/) first.

## Goal

Publish a valid `llms.txt` file at the root of your documentation site and keep it in sync as your docs change.

## Prerequisites

- A documentation site you can deploy static files to.
- The ability to serve a file at your site root (for example, `https://docs.example.com/llms.txt`).
- A short, accurate summary of what your product or project does.

## Decide what to include

`llms.txt` is a curated file, so start by choosing the pages a model most needs:

- Entry points: overview, quickstart, and getting-started pages.
- High-value reference: API references, configuration, and core concepts.
- Leave out marketing pages, duplicate content, and low-value utility pages.

Group the rest under an **Optional** section so models can skip it when context is tight.

## Create the file

<Steps>

1. Create a file named `llms.txt` with an H1 title and a blockquote summary:

   ```markdown
   # Example Docs

   > Example is a tool that does X for Y. This file links the documentation
   > most useful to language models answering questions about it.
   ```

2. Add H2 sections with curated links. Point each link at a clean Markdown version of the page where one exists, and add a short note after a colon:

   ```markdown
   ## Docs

   - [Quickstart](https://docs.example.com/quickstart.md): Install and run in five minutes
   - [Configuration](https://docs.example.com/configuration.md): All settings and defaults

   ## Optional

   - [Changelog](https://docs.example.com/changelog.md): Release history
   ```

3. Deploy the file to your site root so it resolves at `https://docs.example.com/llms.txt`.

</Steps>

<Aside type="note">
Place the file at the root path, the same level as `robots.txt` and `sitemap.xml`. Tools and models look for it at `/llms.txt`.
</Aside>

## Fastest path: generate it from your docs

Writing the file by hand does not scale, and you rarely need to. If your site runs on a common documentation platform, a plugin generates `llms.txt` from your existing content at build time — so it stays current with no manual work.

If you run **Astro Starlight**, this is a two-step setup. Install the plugin:

```bash
npm install starlight-llms-txt
```

Add it to the `starlight` plugins array in `astro.config.mjs`:

```js
import starlightLlmsTxt from 'starlight-llms-txt';

// inside starlight({ ... })
plugins: [starlightLlmsTxt()],
```

Build the site, and the plugin serves `llms.txt` and `llms-full.txt` from your root. The EkLine documentation site uses this exact setup.

Other platforms have equivalent plugins:

- **Docusaurus** — add [`docusaurus-plugin-llms`](https://github.com/rachfop/docusaurus-plugin-llms). Install it with `npm install docusaurus-plugin-llms --save-dev`, then add `'docusaurus-plugin-llms'` to the `plugins` array in `docusaurus.config.js`. It generates both `llms.txt` and `llms-full.txt` on build with no further configuration.
- **VitePress, MkDocs, and others** — community plugins generate the file during the build.
- **Any platform** — the [`llms_txt2ctx`](https://llmstxt.org/) CLI from the specification authors converts an `llms.txt` file into model context, and most static-site generators have a community generator you can add to your build.

If no plugin fits your platform, write the file by hand using the [manual steps](#create-the-file) and the [copy-paste template](#copy-paste-template).

## Copy-paste template

Start from this complete file, replace the placeholders, and delete any sections you do not need:

```markdown
# Your Project

> One or two sentences on what your project does and who it is for.
> This summary is the most important line — models read it first.

## Docs

- [Overview](https://docs.example.com/overview.md): What the product is and when to use it
- [Quickstart](https://docs.example.com/quickstart.md): Install and run in five minutes
- [Configuration](https://docs.example.com/configuration.md): All settings and defaults
- [API reference](https://docs.example.com/api.md): Endpoints, parameters, and responses

## Guides

- [Authentication](https://docs.example.com/guides/auth.md): Set up API keys and tokens
- [Deployment](https://docs.example.com/guides/deploy.md): Ship to production

## Optional

- [Changelog](https://docs.example.com/changelog.md): Release history
- [FAQ](https://docs.example.com/faq.md): Common questions
```

## Validate the file

Before you rely on it, confirm the file is correct:

- It resolves at `/llms.txt` and returns plain text or Markdown, not HTML.
- It starts with a single H1 and a blockquote summary.
- Every link resolves, and links point to Markdown versions where you provide them.
- The summary is accurate and current.

## Keep it current

An `llms.txt` file that drifts from your docs sends models to stale or missing pages.

- Regenerate the file on every documentation build so it tracks new and removed pages automatically.
- If you maintain it by hand, review it on a fixed cadence, such as quarterly, and after any large documentation change.
- Check periodically that linked Markdown versions still resolve.

## Verify your setup

You are done when:

- `https://your-docs-domain/llms.txt` returns a valid file with an H1 and a blockquote.
- The curated links resolve and point to your highest-value pages.
- The file regenerates or gets reviewed as part of your normal docs workflow.

## Related

- [What is llms.txt?](/guides/llms-txt/what-is-llms-txt/) — the format and the standard behind this file.
- [Monitor AI traffic to your docs](/guides/ai-traffic/monitor/) — measure the AI systems that read your content.