Several files generated by the Next.js and SvelteKit adapters drift from the snippets published at https://prismic.io/docs/nextjs and https://prismic.io/docs/sveltekit. The docs will eventually be updated to match the CLI output, so this tracks the diffs that should be reconciled in either direction.
Ignoring the Slice Machine config reference in the docs (slicemachine.config.json vs. prismic.config.json) — that's intentional divergence.
Next.js
prismicio.{ts,js} — src/adapters/nextjs.templates.ts:225
fetchOptions branches on NODE_ENV
Current:
fetchOptions:
process.env.NODE_ENV === 'production'
? { next: { tags: ['prismic'] }, cache: 'force-cache' }
: { next: { revalidate: 5 } },
Docs ship a single unconditional block:
fetchOptions: {
next: { tags: ["prismic"] },
cache: "force-cache",
},
createClient is an arrow expression
Current (both App Router and Pages Router, TS and JS):
export const createClient = (config: ClientConfig = {}) => { ... };
Docs use a function declaration:
export function createClient(config: ClientConfig = {}) { ... }
Page template — src/adapters/nextjs.templates.ts:62
Missing generateMetadata
Docs include SEO metadata in [uid]/page.tsx:
export async function generateMetadata({ params }: PageProps<"/[uid]">): Promise<Metadata> {
const { uid } = await params;
const client = createClient();
const page = await client.getByUID("page", uid);
return {
title: page.data.meta_title,
description: page.data.meta_description,
openGraph: { images: [{ url: page.data.meta_image.url ?? "" }] },
};
}
The CLI emits only the Page component. Applies to both the repeatable and singleton App Router branches.
Missing generateStaticParams
Docs also include build-time path generation for repeatable types:
export async function generateStaticParams() {
const client = createClient();
const pages = await client.getAllByType("page");
return pages.map((page) => ({ uid: page.uid }));
}
Root layout — not generated at all
NextJsAdapter.setupProject() never touches app/layout.*. The docs expect it to include:
import { PrismicPreview } from "@prismicio/next";
import { repositoryName } from "@/prismicio";
// ...inside <html>...
<PrismicPreview repositoryName={repositoryName} />
Without this, preview mode can't render the toolbar. The SvelteKit adapter handles the equivalent via rootLayoutTemplate; Next.js should do the same.
Slice component — src/adapters/nextjs.templates.ts:20
Current:
import { FC } from "react";
import { Content } from "@prismicio/client";
import { SliceComponentProps } from "@prismicio/react";
export type ${pascalName}Props = SliceComponentProps<Content.${pascalId}Slice>;
const ${pascalName}: FC<${pascalName}Props> = ({ slice }) => { ... };
Docs:
import type { Content } from "@prismicio/client";
import { type SliceComponentProps } from "@prismicio/react";
type ${pascalName}Props = SliceComponentProps<Content.${pascalName}Slice>;
export default function ${pascalName}({ slice }: ${pascalName}Props) { ... }
Differences:
- Uses
FC<…> typing — the React team no longer recommends FC for function components.
- Arrow expression instead of function declaration.
- Value imports of
Content and SliceComponentProps; docs use type-only imports.
- Exports the
${pascalName}Props type; docs keep it local.
Revalidate route — src/adapters/nextjs.templates.ts:546
Adds a second "max" argument on Next 16+:
revalidateTag("prismic", "max");
Docs just show revalidateTag("prismic"). This is CLI-specific behavior for cacheLife profiles and may be intentional, but flagging in case the docs should pick it up.
Import path style (minor)
CLI uses relative specifiers where the docs use the @/ alias:
- Slice simulator page:
"../../slices" → "@/slices" (lines 388, 408).
- Preview route:
"../../../prismicio" → "@/prismicio" (lines 451, 463).
Functionally equivalent, but inconsistent with the published snippets.
Other small stylistic drift
- Slice simulator template is missing a semicolon after
const { state } = await searchParams (lines 393, 411).
- Slice simulator and preview route templates insert a blank line between package and local imports; docs keep them grouped.
SvelteKit
prismicio.{ts,js} — src/adapters/sveltekit.templates.ts:7
createClient is an arrow expression
Current:
export const createClient = ({ cookies, ...config }: CreateClientConfig = {}) => { ... };
Docs:
export function createClient({ cookies, ...config }: CreateClientConfig = {}) { ... }
Applies to both the TS and JS variants. fetchOptions is absent on both sides — no change needed there.
Nuxt
Not affected. The Nuxt adapter doesn't generate a prismicio file; it configures @nuxtjs/prismic via nuxt.config, which matches how the Nuxt docs set up the client.
Several files generated by the Next.js and SvelteKit adapters drift from the snippets published at https://prismic.io/docs/nextjs and https://prismic.io/docs/sveltekit. The docs will eventually be updated to match the CLI output, so this tracks the diffs that should be reconciled in either direction.
Ignoring the Slice Machine config reference in the docs (
slicemachine.config.jsonvs.prismic.config.json) — that's intentional divergence.Next.js
prismicio.{ts,js}—src/adapters/nextjs.templates.ts:225fetchOptionsbranches onNODE_ENVCurrent:
Docs ship a single unconditional block:
createClientis an arrow expressionCurrent (both App Router and Pages Router, TS and JS):
Docs use a function declaration:
Page template —
src/adapters/nextjs.templates.ts:62Missing
generateMetadataDocs include SEO metadata in
[uid]/page.tsx:The CLI emits only the
Pagecomponent. Applies to both the repeatable and singleton App Router branches.Missing
generateStaticParamsDocs also include build-time path generation for repeatable types:
Root layout — not generated at all
NextJsAdapter.setupProject()never touchesapp/layout.*. The docs expect it to include:Without this, preview mode can't render the toolbar. The SvelteKit adapter handles the equivalent via
rootLayoutTemplate; Next.js should do the same.Slice component —
src/adapters/nextjs.templates.ts:20Current:
Docs:
Differences:
FC<…>typing — the React team no longer recommendsFCfor function components.ContentandSliceComponentProps; docs use type-only imports.${pascalName}Propstype; docs keep it local.Revalidate route —
src/adapters/nextjs.templates.ts:546Adds a second
"max"argument on Next 16+:Docs just show
revalidateTag("prismic"). This is CLI-specific behavior forcacheLifeprofiles and may be intentional, but flagging in case the docs should pick it up.Import path style (minor)
CLI uses relative specifiers where the docs use the
@/alias:"../../slices"→"@/slices"(lines 388, 408)."../../../prismicio"→"@/prismicio"(lines 451, 463).Functionally equivalent, but inconsistent with the published snippets.
Other small stylistic drift
const { state } = await searchParams(lines 393, 411).SvelteKit
prismicio.{ts,js}—src/adapters/sveltekit.templates.ts:7createClientis an arrow expressionCurrent:
Docs:
Applies to both the TS and JS variants.
fetchOptionsis absent on both sides — no change needed there.Nuxt
Not affected. The Nuxt adapter doesn't generate a
prismiciofile; it configures@nuxtjs/prismicvianuxt.config, which matches how the Nuxt docs set up the client.