How to Create an llms.txt for Your Website
Summary
llms.txt is a file that helps neural networks understand the structure of a website: a list of key pages with titles and descriptions. Here's what it is, why it's needed, and how to create it.
What is llms.txt
llms.txt is a Markdown file in the root of the website, created specifically for LLM. Unlike the sitemap, which is oriented towards search engines, llms.txt describes the website in a language that is understandable to neural networks.
Why is it Needed
When an AI assistant answers a question about a company or a website, it looks for sources. llms.txt is a compressed map of the website that helps the model quickly understand what is there and find the necessary pages.
Basic Structure
# Website Name
> Brief description: what the website is about.
## Main
- [Home](https://site.com/): Description
- [About Us](https://site.com/about/): Description
## Services
- [Services](https://site.com/services/): Description
## Blog
- [Articles](https://site.com/blog/): Description
Format Rules
- H1 (
# Name) — mandatory; - description (
> quote) — recommended; - H2-blocks (
## Section) — optional, but should be meaningful; - links — in the format
[Name](page address): Description.
What Should Not Be Included
- pages for the cart, personal account, search;
- links with GET parameters (
?sort=,?filter=); - technical files (images, CSS, JS);
- hundreds of similar cards with article numbers — it's better to group them.
How to Generate
There are two paths:
- Manually — suitable for small websites: gather main pages and format according to the structure.
- Automatically — a script scans the sitemap, collects titles and descriptions, filters out service URLs.
The automatic option was covered in the case on optimizing the llms.txt generator: there are detailed descriptions of pitfalls — timeouts, locks, and garbage filtering.
Where to Place the File
The file should be accessible at the address:
https://site.com/llms.txt
You can also create llms-full.txt — an extended version with a larger number of pages.
Checklist
- H1 with the website name;
- brief description after the title;
- meaningful sections, not dozens of small ones;
- only useful pages;
- file accessible at
/llms.txt.