LLMs.txt Tools
All tools are free to use — no account and no sign-up required.
Back to the generator

llms.txt V2 for Static Sites and Servers

A static site has no application server, but V2 still needs two things: Markdown versions of your pages, and the headers and links that tell AI tools where they are. This guide covers both — generating Markdown at build time with your site's own tooling, then serving it with the right Content-Type and Vary header on Apache, Nginx, Vercel, Netlify and Cloudflare.

Published: [FILL IN] · Last modified: [FILL IN]

Part 1: Build-time Markdown

The cleanest way to publish V2 Markdown is at build time, so a .md file sits next to each page in your output. Most modern generators have a plugin or a built-in output format for exactly this. The table below maps each to the usual approach; plugin names change over time, so confirm the current package before adding it.

GeneratorPlugin or approach
Docusaurusdocusaurus-plugin-llms
VitePressvitepress-plugin-llms
Astro / Starlightstarlight-llms-txt, or astro-llms-txt
HugoA custom output format
Plain HTMLPandoc

The goal is a stable set of .md URLs that mirror your pages — following the V2 patterns page.md or page.html.md. Once the files exist in your build output, everything below is about serving them correctly, which is where static hosts differ.

Part 2: Server headers and rewrites

Browsers and agents decide how to read a file from its Content-Type. Left alone, most hosts will serve a .md file as plain text or even a download, which is not what you want. Set the type to text/markdown and add Vary: Accept so caches know the response depends on the request's Accept header — the same header V2 content negotiation relies on.

Apache, via a .htaccess file at your web root:

.htaccess
# Serve .md files as Markdown and vary on Accept
AddType text/markdown .md

<IfModule mod_headers.c>
  <FilesMatch "\.md$">
    Header set Vary "Accept"
  </FilesMatch>
</IfModule>

Nginx, inside your server block:

nginx.conf
# Serve .md files with the right Content-Type and Vary header
location ~* \.md$ {
    default_type text/markdown;
    add_header Vary Accept;
    try_files $uri =404;
}

Vercel, in a vercel.json at the project root:

vercel.json
{
  "headers": [
    {
      "source": "/(.*).md",
      "headers": [
        { "key": "Content-Type", "value": "text/markdown; charset=utf-8" },
        { "key": "Vary", "value": "Accept" }
      ]
    }
  ]
}

Netlify, in a _headers file in your publish directory:

_headers
/*.md
  Content-Type: text/markdown; charset=utf-8
  Vary: Accept

Cloudflare has no config file for this; you create a Transform Rule in the dashboard that matches .md paths and sets the two headers.

Cloudflare rule
# Cloudflare -> Rules -> Transform Rules -> Modify Response Header
# When the request path matches:  ^/.*\.md$
# Then set static header:
#   Content-Type = text/markdown; charset=utf-8
#   Vary         = Accept

If your host lets you test it, request a .md URL and check the response headers directly. Seeing text/markdown and Vary: Accept means the rule is working.

Part 3: rel=alternate per page

Headers alone are not enough: V2 wants each HTML page to point at its own Markdown version. Add an alternate link with the text/markdown type in the head of every page — in a static site that usually means a line in your layout template, with the href built from the page's path.

page head
<link rel="alternate" type="text/markdown" href="/docs/getting-started.md">

Because a static generator reuses one template for many pages, emit the href from the page path rather than hard-coding it, so each page links to its own .md file. If a page also needs the describedby relation, add a second link element pointing at your llms.txt.

Part 4: Link llms.txt to your .md pages, then check

Finally, list the Markdown URLs in llms.txt so an agent can skip your HTML and read the clean version. Point each entry at the .md address.

llms.txt
# Acme Docs
> Guides and API references for the Acme platform.

## Docs
- [Getting started](https://acme.com/docs/getting-started.md): Install and run in minutes.
- [API reference](https://acme.com/docs/api.md): Every endpoint and parameter.

With the files, headers and links in place, confirm the result. The llms.txt V2 checker goes through the V2 requirements and flags anything your static setup is missing, from a wrong content type to a page with no alternate link.

Check your file

Validate your llms.txt before you go live — it scores nine checks and flags broken links. Open the LLMs.txt Validator.

Generate yours free

No account needed. Build an llms.txt from your website, sitemap or a pasted list in seconds. Open the LLMs.txt Generator.

Learn more