Generate experiences with Puck AI
Read docs
CloudAPI referenceplugin-pagescreatePagesPlugin

createPagesPlugin

Puck Pages is experimental and may change in a future release.

Create a plugin that lets users create, browse, and publish pages stored in Puck Pages.

npm i @puckeditor/plugin-pages --save
import { createPagesPlugin } from "@puckeditor/plugin-pages";
 
const pagesPlugin = createPagesPlugin();
 
export function Editor() {
  return (
    <Puck
      plugins={[pagesPlugin]}
      // ...
    />
  );
}

The plugin needs puckHandler() on your server. It loads pages into the editor and adds its own Save and Publish buttons to the header, so <Puck> no longer calls onPublish.

See Set up Puck Pages for a full setup.

Params

ParamExampleTypeStatus
hosthost: "https://www.example.com/api/puck/pages"String-
initialPathinitialPath: "/about"String-
siteUrlsiteUrl: "https://www.example.com"String-

Optional params

host

Set where puckHandler serves the pages API. Defaults to /api/puck/pages.

const pagesPlugin = createPagesPlugin({
  host: "https://www.example.com/api/puck/pages",
});

initialPath

Set the path of the page to open first. Defaults to the path search param. For example, /puck?path=/about opens /about.

const pagesPlugin = createPagesPlugin({
  initialPath: "/about",
});

siteUrl

Set the URL where your site renders pages, with no trailing slash. The plugin’s “View page” links add the page’s path to this URL. Defaults to the editor’s origin.

const pagesPlugin = createPagesPlugin({
  siteUrl: "https://www.example.com",
});