Skip to main content

@agentshop/seo/next (App Router)

All App Router helpers default to ISR caching ({ next: { revalidate: 3600 } }), overridable via config.fetchOptions. Metadata helpers support Next 14 (sync params) and Next 15/16 (Promise params).

Metadata

Ready generateMetadata for app/products/[handle]/page.tsx:
Factory for a configured generateMetadata. Use this whenever you pass config — it avoids the positional-argument collision with Next’s generateMetadata(props, parent) call signature.
Collection equivalents, same signatures and behavior.
All App Router metadata omits og:type"product" isn’t in Next’s typed Metadata union and throws at runtime. All other Open Graph tags render with property="og:*".

Components

Async server components. Each renders an escaped <script type="application/ld+json">, or null when the bundle is unavailable. SiteJsonLd belongs on the home page only.

Routes

Route-handler factory for app/sitemap.xml/route.ts:
Responds 200 XML or 502 empty. Sets Content-Type: application/xml; charset=utf-8 (no Cache-Control header — caching is via ISR).

Re-exports

The bundle → Metadata mapper, for wiring metadata yourself — see Core API.

@agentshop/seo/next/pages (Pages Router)

getServerSideProps helper — reads the handle from route params and returns the bundle as a seo prop.
Renders the full tag set into next/head: title, description, canonical, Open Graph (including og:type=product — raw meta accepts it), Twitter, and the escaped JSON-LD script. Renders nothing for null.
Handler factory for pages/sitemap.xml.ts or an API route:
Responds 200 XML or 502 empty; sets Content-Type: application/xml; charset=utf-8 and Cache-Control: public, max-age=3600, stale-while-revalidate=86400.

Remix and Hydrogen exports

Documented in their framework guides: Remix (loadProductSeo(handle, config?), agentshopProductMeta, productSitemapLoader) and Hydrogen (same names, but loadProductSeo(context, handle, config?) and a context-aware sitemap loader).