API
DiscoverabilityHow to optimize llms.txt

How to optimize llms.txt

Turn a flat list of URLs into a concise, prioritized map that helps AI systems find the right Talizen pages first.

Talizen automatically serves /llms.txt and a Markdown version of every indexed page. The URL inventory comes from the same source as the sitemap, while a root-level /llms.ts controls how those URLs are presented to an AI reader.

Why structure matters

Without configuration, every page appears in one alphabetically sorted Pages section. That is a safe default, but it gives a pricing page, a key implementation guide, and a minor legal page equal prominence.

A better file puts high-value product and documentation pages first, groups related content, and removes pages that are duplicated, obsolete, private in intent, or too weak to help an AI answer accurately.

The title and summary need no configuration: they come from the site's metadata.title and metadata.description, so improving those updates the file automatically. A /public/llms.txt is never served — the platform always provides its own.

Create /llms.ts at the project root and default-export a function (it may be async). Returning an object declares the structure and lets the platform enumerate and lay out pages. The following configuration prioritizes core pages and AI documentation, keeps the blog together, and marks legal content as optional.

// /llms.ts
export default function llms() {
  return {
    sections: [
      { name: 'Core pages', pages: ['/', '/pricing', '/templates', '/figma-to-website'] },
      { name: 'Docs', pages: ['/docs/*'] },
      { name: 'Blog', pages: ['/blog/*'] },
      { name: 'Optional', pages: ['/solutions/*', '/contact'] },
    ],
    exclude: [
      '/cmstest',
      '/newfile',
    ],
  }
}

Section names are emitted exactly as written, so use labels that make sense to the AI audience for your site. The name Optional has special placement semantics and is conventionally used for links an AI can skip when context is limited.

How matching works

Exact paths

A pattern such as /price matches only /price. A leading slash may be omitted, but including it is clearer.

Prefix wildcards

A trailing /* matches the prefix page and every child path. /docs/ai/* matches /docs/ai and /docs/ai/guide, but not /docs/ai-tools.

First match wins

A page is assigned to the first matching section. Put narrow, high-priority sections before broad catch-all patterns.

Exclusions win first

The exclude list is checked before sections. A matching page is omitted even if it also matches a section pattern.

Inside a section, the order of patterns in pages is the primary sort order. URLs matched by the same pattern are sorted alphabetically. Empty sections are not rendered.

Pages that match no configured section are preserved in an automatic Pages section. If an Optional section exists, this fallback section is inserted immediately before it; otherwise it appears last. Set includeUnmatched: false to drop those unclaimed pages instead.

To list links by hand, write a section as { name, links } where each entry is { name, url }. Such a section skips pattern matching and may sit in the same sections array as pages sections — hand-pick the important few, let the platform fill the rest.

Add site context

Use details for a short Markdown briefing that should be available before an AI follows any page link. Keep it factual, stable, and compact: what the product is, which documentation is authoritative, and any important terminology.

return {
  details: `Talizen is a visual and AI website builder.
Use the AI website docs for implementation guidance.
Use core pages for product and pricing facts.`,
  sections: [/* ... */],
}

The generated file already starts with the site title and metadata.description. Do not repeat those verbatim in details; use the space for context that improves routing and interpretation.

Take full control

Return a string instead of an object and it becomes the entire /llms.txt — you own the heading, the summary, and every link. The ctx argument still hands you the platform's page enumeration, so you are not starting from nothing.

export default function llms(ctx) {
  const docs = ctx.pages.filter((p) => p.path.startsWith('/docs/'))
  return [
    `# ${ctx.metadata.title}`,
    '',
    '## Docs',
    '',
    ...docs.map((p) => `- [${p.path}](${p.url})`),
    '',
  ].join('\n')
}

ctx provides origin, pages (each with path, url, and an optional lastModified), and metadata. See LLMsFile and LLMsContext in the talizen package for the full types.

Verification checklist

  • Open /llms.txt on the deployed domain and confirm the most important section appears first.
  • Follow several generated .md links, including /index.md for the home page, and verify the content is useful without browser-only UI.
  • Check that wildcard patterns do not unintentionally absorb a more specific section.
  • Confirm excluded URLs are absent and unclassified pages still appear under Pages.
  • Keep Optional last so constrained AI readers can safely deprioritize it.
  • If /llms.ts throws or returns the wrong shape, the endpoint returns 5xx rather than quietly falling back to the default output — a 5xx there means the file itself has a bug.

Render diagnostics