Skip to content

contentful-preview setup

ContentPreviewProvider

Registers the Contentful live-preview bridge and refreshes the route when an editor saves.

import { ContentPreviewProvider } from "@evolve-storefront/contentful-preview/provider";
Design notes

The refresh is a router.refresh() rather than local state because the page is server-rendered: the blocks come back from the server with the new content, which is the only way a Server Component tree can update.

Anchors are disabled while previewing so a click inside the editor's iframe selects the block instead of navigating away from the page being edited.

PropTypeDescription
childrenReactNode
targetOrigin?string

Where the editor is served from. Defaults to Contentful's SaaS origin; an EU or self-hosted space is a different one, and a mismatch means the bridge silently never connects.

debug?boolean

Log the bridge's own traffic. Off by default — it is noisy.