Prismic

Use Prismic when document types have UIDs or route resolver URLs that map cleanly to Next.js routes.

Install

For CLI scans, @cms-lab/cli includes the bundled adapter. Add @cms-lab/core for defineConfig. Install @cms-lab/prismic only when importing the adapter directly in project code or tests.

pnpm add -D @cms-lab/cli @cms-lab/core
pnpm add -D @cms-lab/prismic

Config

import { defineConfig } from "@cms-lab/core";

export default defineConfig({
  site: { url: "http://localhost:3000" },
  framework: { type: "next", router: "app" },
  cms: {
    provider: "prismic",
    repositoryName: "my-repo",
    accessToken: process.env.PRISMIC_ACCESS_TOKEN,
  },
  routes: [
    { type: "page", pattern: "/:uid", getPath: (doc) => "/" + doc.uid },
    {
      type: "blog_post",
      pattern: "/blog/:uid",
      getPath: (doc) => "/blog/" + doc.uid,
    },
  ],
});

UID and URL field mapping

Use uidField when the route key lives in a custom nested CMS field. Use urlField when the CMS stores the public permalink. Both read dotted paths from document.data.

// Prismic exposes uid and url directly when available.
routes: [
  { type: "page", pattern: "/:uid", getPath: (doc) => doc.url ?? "/" + doc.uid },
];

CI command

npx @cms-lab/cli doctor
npx @cms-lab/cli scan --ci --report --fail-on error

Provider caveats

  • The adapter reads the repository API v2 master ref and published documents.
  • Draft preview refs and Prismic migration API checks are not part of the default scan yet.
  • Custom route logic should live in getPath when Prismic URL output is not enough.

Check the adapter maturity matrix before using this provider as a strict deploy gate.