Gerador de llms.txt

Monte o arquivo llms.txt que aponta os modelos de IA para as suas páginas canônicas. Roda no navegador — copie ou baixe o arquivo pronto.

obrigatório
obrigatório

llms.txt gerado

llms.txt
1# Untitled

Código do gerador

A mesma função que roda acima — baixe e use no seu build.

llms-generator.js
1// llms-generator.js
2// Pure, framework-agnostic builder for an llms.txt file (Chapter 9).
3// Same function powers the live tool at eduardomendes.com.br/repo/llms-txt.
4//
5// The llms.txt convention (https://llmstxt.org): an H1 name, a blockquote
6// summary, optional free-text notes, then H2 sections of Markdown links that
7// point language models at your canonical, machine-readable pages.
8//
9// Usage:
10// import { buildLlmsTxt } from "./llms-generator.js";
11// const text = buildLlmsTxt({ name, description, services, area, contacts, notes });
12/**
13 * @param {object} data
14 * @param {string} data.name Canonical business/site name (required)
15 * @param {string} data.description One-line summary (required)
16 * @param {string} [data.siteUrl] Canonical homepage URL
17 * @param {Array<{title:string,url:string,note?:string}>} [data.services]
18 * @param {string} [data.area] Coverage area (neighborhoods / cities)
19 * @param {Array<{title:string,url:string}>} [data.contacts]
20 * @param {string} [data.notes] Guidance for language models
21 * @returns {string} Markdown (llms.txt content)
22 */ export function buildLlmsTxt(data = {}) {
23 const name = (data.name || "").trim() || "Untitled";
24 const description = (data.description || "").trim();
25 const lines = [];
26 lines.push(`# ${name}`);
27 lines.push("");
28 if (description) {
29 lines.push(`> ${description}`);
30 lines.push("");
31 }
32 if (data.siteUrl && data.siteUrl.trim()) {
33 lines.push(`Canonical site: ${data.siteUrl.trim()}`);
34 lines.push("");
35 }
36 if (data.area && data.area.trim()) {
37 lines.push(`Area served: ${data.area.trim()}`);
38 lines.push("");
39 }
40 if (data.notes && data.notes.trim()) {
41 lines.push(data.notes.trim());
42 lines.push("");
43 }
44 const services = Array.isArray(data.services) ? data.services.filter((s)=>s && s.title && s.title.trim()) : [];
45 if (services.length) {
46 lines.push("## Services");
47 for (const s of services){
48 const note = s.note && s.note.trim() ? `: ${s.note.trim()}` : "";
49 const url = s.url && s.url.trim() ? s.url.trim() : "";
50 lines.push(url ? `- [${s.title.trim()}](${url})${note}` : `- ${s.title.trim()}${note}`);
51 }
52 lines.push("");
53 }
54 const contacts = Array.isArray(data.contacts) ? data.contacts.filter((c)=>c && c.title && c.title.trim()) : [];
55 if (contacts.length) {
56 lines.push("## Contact");
57 for (const c of contacts){
58 const url = c.url && c.url.trim() ? c.url.trim() : "";
59 lines.push(url ? `- [${c.title.trim()}](${url})` : `- ${c.title.trim()}`);
60 }
61 lines.push("");
62 }
63 // Collapse trailing blank lines to a single newline.
64 return lines.join("\n").replace(/\n{3,}/g, "\n\n").replace(/\n+$/, "") + "\n";
65}
66export function validate(data = {}) {
67 const errors = {};
68 if (!data.name || !data.name.trim()) errors.name = "required";
69 if (!data.description || !data.description.trim()) errors.description = "required";
70 return errors;
71}

Perguntas frequentes

Onde fica o arquivo llms.txt?

Na raiz do domínio: https://seusite.com/llms.txt, servido como text/plain.

Para que serve?

É uma convenção (llmstxt.org) que dá aos modelos de linguagem um mapa curado das suas páginas canônicas e legíveis, reduzindo ruído e aumentando a chance de citação correta.

Substitui robots.txt ou sitemap?

Não. É complementar: robots controla rastreamento, sitemap lista URLs, e llms.txt orienta modelos sobre o que é canônico e importante.