Skip to content
ContractSpec
Start here

Package manual · platform

·Interfaces, presentations and design

lib.presentation-runtime-next

Next.js lane for contract-driven marketing SEO/LLMO: metadata, JSON-LD, sitemap, robots, and llms.txt/agents.json route handlers

platformlibraryv4.0.4stableservernode
@lssm-tech/lib.presentation-runtime-next
bun add @lssm-tech/lib.presentation-runtime-next
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

Next.js lane for contract-driven marketing SEO / LLMO. It maps the framework-neutral metadata produced by @lssm-tech/lib.presentation-runtime-core/marketing into Next.js primitives and serves AI-discovery artifacts.

This is the only presentation-runtime package allowed to import next. presentation-runtime-core and presentation-runtime-react stay Next-free.

Adapters

ExportPurpose
toNextMetadata(meta, opts?)NormalizedMetadata → Next Metadata (hreflang via negotiateLocale).
JsonLd, StructuredData, serializeJsonLdJSON-LD <script> rendering from resolved schema.org shapes.
JsonLdDocument, serializeJsonLdDocument, escapeJsonForScriptHost-authored JSON-LD documents (single node or @graph node list with @id links); all JSON-LD emission escapes <, >, &, U+2028 and U+2029 so the payload cannot break out of the <script>.
buildSitemap(blueprint, opts?)AppBlueprintSpec.routes → MetadataRoute.Sitemap.
buildRobots(aiDiscovery, opts?)AiDiscoveryConfig.crawlerPolicy → MetadataRoute.Robots.
createLlmoRouteHandlers(emitter, opts?)/llms.txt, /llms-full.md, /agents.json route handlers with CDN cache headers.

Usage

Page metadata + JSON-LD

tsx
// app/pricing/page.tsx
import type { Metadata } from 'next';
import { transformAppConfigSeo } from '@lssm-tech/lib.presentation-runtime-core/marketing';
import { toNextMetadata, StructuredData } from '@lssm-tech/lib.presentation-runtime-next';
import { resolvedAppConfig } from '@/app-config';

const normalized = transformAppConfigSeo(resolvedAppConfig, { routePath: '/pricing' });

export const metadata: Metadata = toNextMetadata(normalized);

export default function PricingPage() {
  return (
    <>
      <StructuredData metadata={normalized} />
      {/* … */}
    </>
  );
}

sitemap + robots

ts
// app/sitemap.ts
import { buildSitemap } from '@lssm-tech/lib.presentation-runtime-next';
import { blueprint } from '@/app-config';
export default function sitemap() {
  return buildSitemap(blueprint, { supportedLocales: ['en', 'fr'], defaultLocale: 'en' });
}

// app/robots.ts
import { buildRobots } from '@lssm-tech/lib.presentation-runtime-next';
import { blueprint } from '@/app-config';
export default function robots() {
  return buildRobots(blueprint.aiDiscovery, {
    baseUrl: 'https://contractspec.dev',
    sitemapUrl: 'https://contractspec.dev/sitemap.xml',
  });
}

LLMO route handlers (ISR + CDN cache)

ts
// app/llms.txt/route.ts
import { createLlmoRouteHandlers } from '@lssm-tech/lib.presentation-runtime-next';
import { llmoEmitter } from '@/app-config'; // @lssm-tech/lib.content-gen LlmoEmitter

// Next.js segment config must be statically analyzable; keep this literal in the route file.
export const revalidate = 3600;
export const GET = createLlmoRouteHandlers(llmoEmitter).llmsTxt;

The LlmoEmitter contract is declared structurally in ./llmo-routes so the concrete @lssm-tech/lib.content-gen emitter is injected by the app.

Relationships

THIS PACKAGElib.presentation-runtime-next18 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

7 declarations

Declared capabilities

Lib Presentation Runtime Next

Next.js lane for contract-driven marketing SEO/LLMO: metadata, JSON-LD, sitemap, robots, and llms.txt/agents.json route handlers

Scripts

  • publish:pkgbun publish --tolerate-republish --ignore-scripts --verbose
  • publish:pkg:canarybun publish:pkg --tag canary
  • buildcontractspec-bun-build build
  • build:bundlecontractspec-bun-build transpile
  • build:typescontractspec-bun-build types
  • cleanrimraf dist .turbo
  • devcontractspec-bun-build dev
  • lintbun run lint:fix
  • lint:fixnode ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .
  • lint:checknode ../../../../scripts/biome.cjs check .
  • testbun test --pass-with-no-tests
  • prebuildcontractspec-bun-build prebuild
  • typechecktsgo --noEmit -p tsconfig.json