3X Your Interview Chances
AI Resume Builder
Import LinkedIn, get AI suggestions, land more interviews
4 min to read
Creating an llms.txt
file is a crucial step for making your website more accessible and understandable to Large Language Models (LLMs). This guide covers everything you need to know about the llms.txt
standard, from its purpose and structure to step-by-step creation, automation, and best practices.
The llms.txt
file is a standardized Markdown document placed in the root directory of your website (e.g., https://yourwebsite.com/llms.txt
). Its main purpose is to provide LLMs with a concise, structured overview of your site's content.
It enables them to understand, navigate, and retrieve information more effectively. It serves a similar function to robots.txt
and sitemap.xml
, but is specifically tailored for AI systems rather than search engines or crawlers.
File Name | Purpose | Content Level |
---|---|---|
llms.txt | Concise summary, key links, and essential documentation | High-level |
llms-full.txt | Comprehensive, full documentation in Markdown format | Detailed/full |
The llms.txt
file follows a specific Markdown-based structure, making it both human- and machine-readable:
MyWebsite is a platform offering e-commerce solutions, including product automation and AI-driven analytics.
This website contains extensive documentation on our API, automation tools, and AI-powered insights.
llms.txt
.a. Add the H1 Header
MyWebsite Docs
b. Write a Blockquote Summary
MyWebsite is a platform offering e-commerce solutions, including product automation and AI-driven analytics.
c. Add Additional Context (Optional)
This website contains extensive documentation on our API, automation tools, and AI-powered insights.
d. List Core Documentation in H2 Sections
e. Add an Optional Section
Optional
llms.txt
to your website’s root directory so it is accessible at https://yourwebsite.com/llms.txt
.For large or frequently updated sites, automation is recommended.
import os
docs_directory = "./docs"
llms_txt_path = "./llms.txt"
with open(llms_txt_path, "w") as f:
f.write("# MyWebsite Docs\n\n")
f.write("> MyWebsite provides AI-powered tools for e-commerce.\n\n")
f.write("## Core Documentation\n")
for doc in os.listdir(docs_directory):
if doc.endswith(".md"):
doc_name = doc.replace(".md", "").replace("-", " ").title()
doc_url = f"https://mywebsite.com/docs/{doc}"
f.write(f"- {doc_name}\n")
f.write("\n## Optional\n")
f.write("- Blog\n")
f.write("- Customer Stories\n")
print("LLMs.txt generated successfully!")
Several tools can automate or assist in generating llms.txt
:
llms.txt
and llms-full.txt
via API1.llms.txt
file.https://yourwebsite.com/llms.txt
to confirm it’s publicly accessible.For sites with extensive documentation, consider also providing an llms-full.txt
file:
Implementing an llms.txt
file is a straightforward yet powerful way to make your website more accessible to LLMs and AI agents. By following the standardized Markdown format, updating your file, and leveraging automation where possible, you ensure that AI systems can understand and utilize your content efficiently.
Need expert guidance? Connect with a top Codersera professional today!