@agentshop/seo/next/proxy
middleware on Next 15 and below) to report AI-crawler requests. An existing handler passed as the first argument runs first and its response is returned untouched — and it may return nothing, matching Next’s own proxy contract, in which case NextResponse.next() is used. Reporting is deferred with event.waitUntil, and the bot check runs before it, so a human page view never extends the invocation. See AI crawler visibility.
@agentshop/seo/next (App Router)
All App Router helpers default to ISR caching ({ next: { revalidate: 3600 } }), overridable via config.fetchOptions — except AgentShopPixel, which caches separately (see below). Metadata helpers support Next 14 (sync params) and Next 15/16 (Promise params).
Analytics
<Script strategy="afterInteractive">. Render once in your root layout. Returns null when the pixel isn’t configured or the endpoint is unreachable.
Caches via unstable_cache for 5 minutes.
config.fetchOptions is forwarded to the fetch, except cache, which this helper pins to no-store so the unstable_cache window above is the only cache in play. The resolved script URL is only rendered if it’s https: — an http: URL is dropped rather than emit a mixed-content script tag. See Storefront analytics.
Metadata
generateMetadata for app/products/[handle]/page.tsx:
generateMetadata. Use this whenever you pass config — it avoids the positional-argument collision with Next’s generateMetadata(props, parent) call signature.
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
<script type="application/ld+json">, or null when the bundle is unavailable. SiteJsonLd belongs on the home page only.
Routes
app/sitemap.xml/route.ts:
Content-Type: application/xml; charset=utf-8 (no Cache-Control header — caching is via ISR).
Re-exports
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.
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.
pages/sitemap.xml.ts or an API route:
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).
