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:

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>

Set it up

[03]
app/layout.tsx
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
OntoProviderbaseUrl (required), config, childrenThe Markdown link, plus JSON-LD on routes whose pageType is about or scoring
OntoHeadnoneLinks 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.

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.