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.
| Generator | Plugin or approach |
|---|---|
| Docusaurus | docusaurus-plugin-llms |
| VitePress | vitepress-plugin-llms |
| Astro / Starlight | starlight-llms-txt, or astro-llms-txt |
| Hugo | A custom output format |
| Plain HTML | Pandoc |
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:
# 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:
# 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:
{
"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:
/*.md
Content-Type: text/markdown; charset=utf-8
Vary: AcceptCloudflare has no config file for this; you create a Transform Rule in the dashboard that matches .md paths and sets the two headers.
# 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 = AcceptIf 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.
<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.
# 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
Generate yours free
Learn more
- What is llms.txt?
- llms.txt V2: what changed
- Format & specification
- How to create llms.txt
- Best practices
- Examples & templates
- Do I need llms.txt?
- llms.txt for SEO
- What is llms-full.txt?
- llms.txt vs llms-full.txt
- llms.txt vs robots.txt
- llms.txt in the news
- LLMs.txt Generator
- LLMs-full.txt Generator
- LLMs.txt Validator
- llms.txt V2 Checker
- Robots.txt Generator
- Robots.txt Tester