# Build CLI (onto-next)

> What onto-next does after next build: which pages it reads, what each .md holds, and what its output means.

Source: https://docs.buildonto.dev/sdk/extractor
Section: Serve SDK

---

Build CLI\[01\]

## Build CLI

`onto-next` runs after `next build` and turns each prerendered page into Markdown — so a request costs a file read, not an extraction.

### What it does

\[02\]

your build · onto-next

next build && onto-next

1.  01Find the pages
    
    Every prerendered page in `.next/server/app`. Pages rendered per request aren't there, so they get no `.md`.
    
2.  02Clean each one
    
    With `@ontosdk/core`, the cleaner the Read API uses — once per build.
    
3.  03Write the files
    
    One `.md` per page in `public/.onto/`, and `llms.txt` from your config.
    
4.  04Tell your dashboard
    
    The list goes to Onto with your site key — skipped without one.
    

public/.onto/\*.md, public/llms.txt, and your dashboard's route list

### Read its output

\[03\]

Pick your setup and see what the build prints:

Site key setNo keyA Read key by mistakebaseUrl left as example.comRun before next build

Sample run · sizes vary by page · click a line$ next build && onto-next\[Onto\] Starting Semantic Output Generation...✓ Optimized / \[96.4KB -> 4.1KB\]✓ Optimized /pricing \[148.2KB -> 6.3KB\]✓ Optimized /docs \[212.9KB -> 11.8KB\]Processed 3 pages. Total Size: 457.5KB -> 22.2KB\[Onto\] Syncing manifest with Control Plane \[https://api.buildonto.dev\]...✓ Control Plane sync successful (3 files)✓ Generated /llms.txtEdge payloads are ready at /public/.onto/\*

Pick a line with a dot to see what it means.

### What's in each file

\[04\]

markdownpublic/.onto/pricing.mdCopy

````
# Pricing
> Plans and what each includes.

**Source:** /pricing
**Extracted:** 2026-09-23T10:41:07.512Z

---

## Plans
…

## Structured Data (JSON-LD)
```json
{ "@type": "Product", … }
```
````

What happens

Which partThe first `<main>`; failing that the first `<article>`; failing that the whole `<body>`

RemovedScripts, styles, noscript, iframes, SVG, nav, header, footer, meta and link tags

HeadingsYour page title becomes the `#`, and every heading in the body moves down one level

KeptTables, links, lists — and your JSON-LD, appended at the end as a block

HeaderTitle, description, `Source` and `Extracted` — the timestamp changes every build

Content outside `<main>` doesn't make it in — if agents are missing something, that's the first place to look.

### Commands

\[05\]

CommandDoes

`onto-next`The build step. Reads `.env.local` for `ONTO_API_KEY`; a real environment variable wins.

`onto-next init`Writes `onto.config.ts`, `middleware.ts` and `.env.local` — skipping any that exist.

**Most problems won't fail your build.** Missing output, no pages, a refused key — each prints a warning and exits 0, so CI stays green. Read the log, or check Serve → Routes after a deploy.

Copy as Markdown[](/sdk/extractor.md "Open the raw Markdown")

---
## Structured Data (JSON-LD)
```json
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Onto Docs",
  "url": "https://docs.buildonto.dev",
  "description": "How to use Onto: serve AI agents Markdown from your Next.js site, call the Read API, connect over MCP, and read the AIO score.",
  "inLanguage": "en",
  "publisher": {
    "@type": "Organization",
    "name": "Onto",
    "url": "https://buildonto.dev"
  }
}
```