Configuration

Optional onto.config.ts for per-route schema injection and llms.txt generation.

Configuration is optional. The SDK works out of the box with just ONTO_API_KEY. Add onto.config.ts when you want JSON-LD schemas auto-injected or want to control the generated llms.txt.

onto.config.ts

Create at your project root. The SDK loads it at build time (CLI) and request time (middleware).

onto.config.ts
import type { OntoConfig } from '@ontosdk/next/config';

const config: OntoConfig = {
  siteName: 'Acme',
  siteUrl: 'https://acme.com',
  description: 'Payment infrastructure for the internet.',

  // Per-route schema hints — drives automatic JSON-LD injection
  pages: {
    '/': { schema: 'organization' },
    '/pricing': { schema: 'product' },
    '/blog/*': { schema: 'article' },
  },

  // Used to generate /llms.txt
  llms: {
    primaryRoutes: ['/', '/docs', '/api'],
    contact: 'hello@acme.com',
  },
};

export default config;

Schema generation

When you set pages['/foo']: { schema: 'product' }, the SDK injects a JSON-LD <script type="application/ld+json"> block into the served Markdown with the matching schema.org type. Supported types:

organizationschemaoptionalFor your homepage / brand-level pages.
productschemaoptionalPricing pages, individual product pages.
articleschemaoptionalBlog posts, documentation entries.
faqschemaoptionalFAQ pages with question/answer pairs.
breadcrumbschemaoptionalSection pages with hierarchical navigation.
defaultschemaoptionalEverything else (no automatic injection).

For a custom schema, use the OntoHead component to inject directly:

tsx
import { OntoHead } from '@ontosdk/next/components';

export default function PricingPage() {
  return (
    <>
      <OntoHead schema={{
        '@type': 'Product',
        name: 'Pro Plan',
        offers: { '@type': 'Offer', price: '49', priceCurrency: 'USD' },
      }} />
      {/* page content */}
    </>
  );
}

llms.txt auto-discovery

The SDK serves /llms.txt automatically when llms is set in your config. This is the emerging standard for telling AI agents where your most-important content lives — analogous to robots.txt + sitemap.xml, but for LLMs.