llms.txt

Publish an llms.txt file to guide AI models to your key content.

llms.txt is a proposed standard: a Markdown file at your site root that gives AI models a clean, curated map of your most important content. It is analogous to robots.txt, but aimed at LLMs rather than crawlers.

What it contains

  • A short description of the site.
  • Curated links to key pages, docs and resources.
  • Optional notes to help models use your content correctly.

Status

It is an emerging, not-yet-universally-adopted convention. Support varies by AI provider, but it is low-cost to publish and may help models find your best material.

Example

Example · bash
# https://example.com/llms.txt
# SoundsCode

> Free tutorials on web development, SEO and AI.

## Docs
- [SEO Tutorial](https://example.com/seo): Full SEO with AI course
- [HTML Tutorial](https://example.com/html): Learn HTML basics

## About
- [About SoundsCode](https://example.com/about)

When to use it

  • A developer documentation site publishes an llms.txt file listing its key API reference and guide URLs so AI assistants like Claude and ChatGPT retrieve accurate, up-to-date answers from authoritative sources.
  • A B2B SaaS company uses llms.txt to point AI models to their product documentation and pricing page, ensuring AI-generated answers about their tool are grounded in official content.
  • A publisher adds an llms.txt with curated article URLs so when AI systems crawl the site they index the most authoritative long-form content rather than thin tag pages.

More examples

Basic llms.txt file

An llms.txt file at the root of the domain curates the most authoritative URLs for AI models, ensuring they retrieve content from pages the site owner considers canonical and trustworthy.

Example · bash
# /llms.txt — published at https://example.com/llms.txt
# Based on the llms.txt proposal (llmstxt.org)

# Acme Running — key pages for AI models

## About
https://example.com/about/
https://example.com/editorial-policy/

## Documentation
https://example.com/docs/getting-started/
https://example.com/docs/api-reference/

## Key articles
https://example.com/blog/how-to-train-for-marathon/
https://example.com/blog/trail-running-shoe-guide/

Extended llms-full.txt with metadata

The extended llms-full.txt includes descriptions so AI models have richer context about each URL's content, improving the relevance of retrieved answers.

Example · bash
# /llms-full.txt — optional extended version with descriptions
# Title: Acme Running
# Description: Expert running gear reviews, training plans and trail guides.
# Author: Acme Running Editorial Team

## Product documentation
- Trail Shoe Buying Guide: https://example.com/guides/trail-shoes/
  A 2 000-word guide covering drop, stack height and outsole patterns.

## Training resources
- 16-Week Marathon Plan: https://example.com/training/marathon-16-week/
  Printable PDF training schedule with weekly mileage and pacing targets.

Serve llms.txt with correct content type

Serving llms.txt as plain text with a 24-hour cache header ensures AI crawlers can fetch it reliably without encountering content-type negotiation issues.

Example · bash
# nginx config: serve llms.txt as plain text at the root
server {
    listen 443 ssl;
    server_name example.com;

    # Serve the llms.txt file with the correct MIME type
    location = /llms.txt {
        root /var/www/html;
        default_type text/plain;
        add_header Cache-Control "max-age=86400";
    }

    location = /llms-full.txt {
        root /var/www/html;
        default_type text/plain;
        add_header Cache-Control "max-age=86400";
    }
}

Discussion

  • Be the first to comment on this lesson.