Installation
@ontosdk/next turns every prerendered page of your Next.js site into Markdown at build time, and hands it to agents at the edge. About five minutes.
Install
[02]Install the package
npm, pnpm or yarn — whichever your project uses.
npm install @ontosdk/nextScaffold it
Writes
onto.config.ts,middleware.tsand.env.local, and leaves alone any that already exist.npx onto-next initAdd your site key
From Serve once your domain is registered. The name is
ONTO_API_KEY, the value is the site'sonto_live_key — a Read key is refused. Without one the pages still build; they just don't reach your dashboard..env.localONTO_API_KEY=onto_live_YOUR_SITE_KEYAdd the build step
After
next build, the CLI writes a.mdof every prerendered page intopublic/.onto/, plusllms.txt.package.json"scripts": { "build": "next build && onto-next" }Build and deploy
Deploy as you normally do.
npm run build- It works when
A request with an agent's user-agent comes back as Markdown, with Onto's headers on it.
curl -sI -A 'GPTBot/1.0' https://yoursite.com/pricing # Content-Type: text/markdown; charset=utf-8 # X-Onto-Bot: GPTBot (OpenAI) # X-Onto-Matched: trueIt didn’t work
Still HTML? Only prerendered pages get a
.md; anything rendered per request falls back to HTML. Otherwise the build step didn't run, or the middleware'smatcherskips the route.“Control Plane sync skipped: Invalid API Key”? That's a Read key in
ONTO_API_KEY— use the site key.Key set but not picked up? The build CLI reads
.env.localonly; a real environment variable wins over it.
Requirements
[03].next/server/app output.@ontosdk/core, the same cleaner the Read API uses.