Customize LLM output

View as Markdown

Customize what LLMs receive from your site by filtering content within a page using <llms-only> and <llms-ignore> tags, filtering endpoint output with query parameters, excluding pages with noindex, or serving your own custom files.

Filter within a page

Use <llms-only> and <llms-ignore> tags to serve different content to AI agents and human readers from the same page:

Surface<llms-only><llms-ignore>
Rendered page, Copy page, search widget, and Ask FernHiddenServed, and indexed by Ask Fern like any other page content
/llms.txt and each page’s .md/.mdx sourceServedStripped

UI-only elements belong to human readers, and their programmatic equivalents belong to AI agents:

  • Wrap clickable cards and UI walkthroughs in <llms-ignore>, and pair each with an <llms-only> block giving the CLI or API equivalent.
  • <llms-only> suits verbose technical context that would clutter the human UI, such as implementation details, architecture notes, or cross-references that help AI understand relationships between pages.
  • <llms-ignore> suits marketing CTAs, navigation hints, and comments meant to stay in source files.
Add llms-only and llms-ignore tags to my docs
Read this page: [https://buildwithfern.com/learn/docs/ai-features/customize-llm-output.md](https://buildwithfern.com/learn/docs/ai-features/customize-llm-output.md) Then analyze my documentation repo and identify where `<llms-only>` and `<llms-ignore>` tags would improve agent readability, following the guiding principle that UI-only elements belong to human readers and their programmatic (CLI/API) equivalents belong to AI agents. 1. Report your analysis first: list the pages and specific sections where you would add each tag, and explain why. 2. Wait for my confirmation, then implement the changes. 3. Add rules on when to use `<llms-only>` and `<llms-ignore>` to my `AGENTS.md` file (create the file if it doesn’t exist).

Example

Fern’s own docs quickstart pairs GitHub UI click-through steps with their CLI equivalent:

quickstart.mdx
1Use the `fern-api/docs-starter` repository as a template for your site:
2
3<llms-ignore>
41. Navigate to [fern-api/docs-starter](https://github.com/fern-api/docs-starter) and click on the **Use this template** button (found at the top right of this page). You must be logged into GitHub.
52. Choose the option to **create a new repository**. Name it `fern-docs`.
63. Clone your newly created repository and open it in your favorite code editor (e.g., Cursor, VS Code).
7</llms-ignore>
8
9<llms-only>
10Use the GitHub CLI to create a new repository from the template and clone it locally:
11
12```bash
13gh repo create my-org/fern-docs --template fern-api/docs-starter --private --clone
14cd fern-docs
15```
16
17Replace `my-org/fern-docs` with your desired owner and repository name. Use `--public` instead of `--private` if you want a public repository.
18</llms-only>

Use the fern-api/docs-starter repository as a template for your site:

  1. Navigate to fern-api/docs-starter and click on the Use this template button (found at the top right of this page). You must be logged into GitHub.
  2. Choose the option to create a new repository. Name it fern-docs.
  3. Clone your newly created repository and open it in your favorite code editor (e.g., Cursor, VS Code).

Human readers see only the numbered UI steps; LLMs reading this page’s Markdown see only the gh repo create command they can actually run.

To debug what AI sees for any page, append .md or .mdx to the page URL to view its Markdown source.

Filter endpoint output

Filter llms.txt output with the lang and excludeSpec query parameters to reduce token usage. Parameters can also be combined.

Example
/llms.txt?lang=python
/llms.txt?excludeSpec=true
/llms.txt?lang=python&excludeSpec=true
lang
'node' | 'python' | 'java' | 'ruby' | 'go' | 'csharp' | 'swift'

Filter SDK code examples to a specific language. Common aliases are also accepted: javascript, typescript, js, ts, py, and golang. Case-insensitive.

excludeSpec
boolean

Exclude OpenAPI and AsyncAPI specification sections.

Exclude whole pages

You can exclude whole pages from LLM endpoints (llms.txt) by adding noindex: true to the page’s frontmatter. Pages marked noindex aren’t indexed by search engines but remain visible in your sidebar navigation and can still be accessed directly by URL. To also hide a page from navigation, see Hiding content.

docs/pages/internal-notes.mdx
1---
2title: Internal notes
3noindex: true
4---

Serve custom files

The llms-full-txt key in docs.yml is deprecated. Use llms.txt combined with per-page Markdown access instead.

To serve your own llms.txt instead of the auto-generated version, point to your file under the agents key in docs.yml:

docs.yml
1agents:
2 llms-txt: ./path/to/llms.txt

The path is relative to the docs.yml file. The CLI validates that the file exists and uploads it as part of your docs deployment. Your custom file is served at the root-level /llms.txt endpoint. Nested paths (e.g., /api-reference/llms.txt) continue to use the auto-generated output.

To control which crawlers reach your site rather than what they receive, serve a custom robots.txt instead.