Next.js
Generate Metadata, JSON-LD, sitemap and robots in the App Router with @geo/sdk-next.
npm i @geo/sdk-nextgenerateMetadata
// app/[locale]/blog/[slug]/page.tsx
import { geoMetadata } from '@geo/sdk-next';
export async function generateMetadata({ params }) {
const { locale, slug } = await params;
const post = await getPost(slug, locale);
return geoMetadata({
site: process.env.NEXT_PUBLIC_GEO_SITE!,
path: `/blog/${slug}`,
locale,
variables: { title: post.title, summary: post.summary, cover: post.cover },
fallback: { title: post.title, description: post.summary },
});
}geoMetadata() converts platform rules into Next Metadata: title, description, alternates.canonical, alternates.languages (hreflang), openGraph, twitter and robots.
JSON-LD
import { GeoJsonLd } from '@geo/sdk-next';
export default async function Page({ params }) {
return (
<>
<GeoJsonLd site={site} path={`/blog/${slug}`} locale={locale} variables={{ title, summary }} />
<article>…</article>
</>
);
}sitemap and robots
// app/sitemap.ts
import { geoSitemap } from '@geo/sdk-next';
export default geoSitemap({ site: process.env.NEXT_PUBLIC_GEO_SITE! });
// app/robots.ts
import { geoRobots } from '@geo/sdk-next';
export default geoRobots({ site: process.env.NEXT_PUBLIC_GEO_SITE! });Both are generated from the platform's sitemap and robots configuration with multilingual alternates.
Client routing
Add <GeoClient site="…" /> to the root layout so the head stays in sync with rules during SPA navigation (fields already covered by generateMetadata are not written twice).
Caching
Config requests are cached at the edge for 5 minutes and invalidated per site on publish. geoMetadata() defaults to revalidate: 300, adjustable through the cache option.