The 30-second answer: one llms.txt per language, each at the prefix its pages use
Publish the root /llms.txt in your default language, the one that gets x-default in your hreflang. For every other language, publish a file at the same prefix the pages use: /ja/llms.txt for pages under /ja/, ja.example.com/llms.txt for a language subdomain. Write each file in its own language, with links to that language’s pages, and let each file link to the others under Optional.
The spec makes this work without saying a word about languages: a file covers the URLs under its path, and an agent is expected to use the most specific file. A reader that lands on /ja/guides/wordpress and looks for the nearest llms.txt finds the Japanese one. The alternative, one mixed file, makes every reader pay for every language.
What the spec says, and what it leaves out
The v2 specification, revised in August 2026, states that the file is for the root path or any sub-path, that a file covers the URLs under its path, and that where more than one applies, agents should use the most specific one. It also recommends two link relations: rel="alternate" with type text/markdown from an HTML page to its Markdown version, and rel="describedby" from a page to the llms.txt that covers it, as a <link> element or an HTTP Link header.
Language, locale, and translation do not appear anywhere in the text. There is no field for the file’s language, no way to declare that two files are translations of each other, and no guidance on which language the root file should be in. Those gaps are what the rest of this guide fills by convention.
Three layouts, three answers
| Your site | What to publish | How files find each other |
|---|---|---|
| One main language, a handful of translated pages | One /llms.txt in the main language | An Other languages section (or Optional) linking the translated pages |
| Full locales under sub-paths (/ja/, /de/) | /llms.txt in the default language, plus /ja/llms.txt, /de/llms.txt, each in its language | Root links each locale file under Optional; each locale file links back to the root and siblings |
| Full locales on subdomains or separate domains | A root llms.txt on every host, in that host's language | Each file links the other hosts under Optional; rel=describedby on pages stays within the host |
The second row is the common case for documentation and SaaS sites, and it is also what documentation platforms generate. Mintlify, for example, keeps the root index in English and emits one index file per locale under /_llms/, linked from the root. Many multilingual docs sites publish no localized file at all: as of October 2026 the Japanese versions of the Vue and Astro documentation return 404 for a locale llms.txt, so a Japanese reader gets the English index or nothing.
How it lines up with hreflang
For search engines you already declare localized versions one of three ways: link rel="alternate" hreflang elements in the HTML head, the same in an HTTP Link header, or xhtml:link entries in the sitemap. Every version must list itself and all the others, and x-default names the fallback when no language matches.
llms.txt has no equivalent and does not need one, because its job is different: it describes one language’s pages well, it does not pair pages across languages. Two rules keep the two systems consistent. First, the language of the root llms.txt is the x-default language, so the file an agent finds by default matches the page a search engine shows by default. Second, each localized page points at its own locale’s file with rel="describedby", so the page and the index agree on language:
<!-- in the <head> of /ja/guides/wordpress --> <link rel="alternate" hreflang="en" href="https://example.com/guides/wordpress" /> <link rel="alternate" hreflang="ja" href="https://example.com/ja/guides/wordpress" /> <link rel="alternate" hreflang="x-default" href="https://example.com/guides/wordpress" /> <link rel="describedby" href="https://example.com/ja/llms.txt" />
What this site does
KnownByLLM is published in nine languages under sub-paths, with English at the root. The setup is the second row of the table, generated rather than hand-written:
- One route handler per locale.
app/llms.txt/route.tsserves English andapp/ja/llms.txt/route.tsthroughapp/pt/llms.txt/route.tsserve the other eight. Each is a few lines: call a shared builder with the locale, return the text astext/markdown, mark the routeforce-staticso it renders at build time. - One builder, nine dictionaries. The builder takes the locale, pulls the site description, section names, and page labels from that locale’s dictionary, and links that locale’s URLs. Setup guides whose body is not yet translated fall back to English text but still link the localized page, so the index is complete in every language.
- Cross-links under Optional. Every file ends with an Optional section holding the spec link and the eight other language home pages, named in their own language. The root file is English because English is the site’s
x-default. - hreflang from the sitemap. The sitemap lists every page once per locale with
xhtml:linkalternates and anx-defaultpointing at the English URL, so the search-engine view and the llms.txt view name the same default.
The part worth copying is not the code but the shape: one source of truth for page lists, one file per language at the language’s prefix, and a default language that is the same in both systems.
Mistakes to avoid
- A mixed-language file. It makes the blockquote impossible to write and doubles or triples what every reader pays.
- Translating the index before the pages. A Japanese llms.txt whose links lead to English pages misleads the reader; link the localized page only where it exists, and fall back to the default-language page with a note otherwise.
- Content negotiation on the root file. Serving different languages at the same URL by
Accept-Languageconfuses caches and validators. Fixed URLs per language are what both crawlers and people can reason about. - Forgetting the locale file when you add a page. Generate the files from the same list the sitemap uses, so a new page appears in every language’s index the day it ships.
Checking the result
for p in "" /ja /de; do curl -s -o /dev/null -w "$p/llms.txt %{http_code} %{content_type}\n" "https://example.com$p/llms.txt"; done
curl -s https://example.com/ja/llms.txt | head -3
curl -sI https://example.com/ja/guides/wordpress | grep -i 'rel="describedby"'Each locale should return 200 with a text type, the first lines of each file should be in that locale’s language, and the localized pages should point at the localized index. Then run each locale’s file through a validator separately; a valid root file says nothing about the others.
Validate each language's llms.txt
Paste a locale URL such as example.com/ja and the validator fetches that path's llms.txt, checks the structure against the spec, and lists every link it found.
Open the validator →FAQ
Does the llms.txt spec say anything about languages?
No. The v2 specification defines the file's shape and says a file may live at the root or at any sub-path, covering the URLs under its path, with agents expected to use the most specific file. It never mentions languages, locales, or translation. Everything in this guide is a convention built on that sub-path rule and on how hreflang already works for search engines.
Can I just put all languages in one llms.txt?
You can, but it reads badly. A file that alternates English, Japanese, and German sections makes an assistant pay for every language to find the one it needs, and the blockquote summary can only be in one of them. Keep one language per file. If most of your site is in one language with a few translated pages, one file in that language with a short Other languages section is fine.
Where should the per-language file live?
At the same prefix the pages use. If Japanese pages are under /ja/, publish /ja/llms.txt; if they are on ja.example.com, publish ja.example.com/llms.txt. The spec's rule that a file covers the URLs under its path is what makes this work: an agent that fetched /ja/getting-started and looks for the nearest llms.txt finds the Japanese one.
How does this relate to hreflang?
hreflang tells search engines which page is the translation of which, with the rule that every version lists itself and all the others. llms.txt does not have that mechanism and does not need it; its job is to describe one language's pages well. The two line up when the language that gets x-default in your hreflang is also the language of the root llms.txt, and each localized page points at its own locale's file with rel=describedby.
Should the root llms.txt be served in the visitor's language with Accept-Language?
No. Crawlers and caches do not reliably send or honor Accept-Language, and a file whose content depends on a request header is hard to validate and easy to cache wrongly. Serve one fixed language at the root, which is your default locale, and give every other language its own fixed URL.
Next steps
- → The llms.txt spec, explained line by line (the sub-path rule and rel=describedby, in the spec’s words)
- → Generating llms.txt at build time in Next.js, Astro, and Hugo (the route handler pattern this site uses per locale)
- → What goes in the llms.txt Optional section
- → All Learn articles