# OntoProvider

> OntoProvider and OntoHead: the JSON-LD and Markdown discovery links they add to your pages.

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

---

OntoProvider\[01\]

## OntoProvider

Two optional components for your root layout. `OntoProvider` adds JSON-LD to the pages you mark; `OntoHead` adds the links that point agents at each page's Markdown. Serving the Markdown is the middleware's job — neither component does that.

### What lands on the page

\[02\]

Pick a component and a route:

OntoProviderOntoHead

`/``/about`_about_`/pricing`

Lands on /about

<link rel="alternate" type="text/markdown"
      href="https://acme.com/about?format=md"
      title="AI-optimized Markdown version" />

Nothing answers ?format=md yet — agents following this link get HTML.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "AboutPage",
  "name": "About Acme",
  "url": "https://acme.com/about",
  "mainEntity": { "@type": "Organization", "name": "Acme", … }
}
</script>

**Use OntoHead for the discovery link.** OntoProvider's link points at `?format=md`, which the middleware doesn't answer yet; OntoHead's points at the `.md` file itself. Keep OntoProvider for the JSON-LD.

### Set it up

\[03\]

tsxapp/layout.tsxCopy

```
import { OntoProvider } from '@ontosdk/next/provider';
import { OntoHead } from '@ontosdk/next/components';
import ontoConfig from '../onto.config';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <OntoProvider baseUrl="https://acme.com" config={ontoConfig}>
      <html lang="en">
        <head>
          <OntoHead />
        </head>
        <body>{children}</body>
      </html>
    </OntoProvider>
  );
}
```

Both are client components that follow the current route, so the tags change as people navigate without a reload.

### Props

\[04\]

ComponentPropsRenders

`OntoProvider``baseUrl` (required), `config`, `children`The Markdown link, plus JSON-LD on routes whose `pageType` is `about` or `scoring`

`OntoHead`noneLinks to `/.onto/{route}.md` and `/llms.txt`

JSON-LD only appears where you asked for it — so installing the Provider doesn't by itself fix the score's missing-JSON-LD penalty on other pages. Page types are on [Configuration](/sdk/configuration).

### Check it

\[05\]


```
# a browser user-agent, or plain curl counts as an agent and gets Markdown
curl -s -A 'Mozilla/5.0' https://acme.com/about \
  | grep -oE '<link rel="alternate"[^>]*>|application/ld\+json'
```

You should see the alternate link, and on an `about` route the JSON-LD type.

Copy as Markdown[](/sdk/provider.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"
  }
}
```