Skip to content

Custom Preview Templates

A custom preview template allows you to define how content entries are displayed in the CMS preview pane. By registering a custom preview template, you can create a more tailored and user-friendly editing experience for content editors.

Unimplemented

This feature from Netlify/Decap CMS is not yet supported in Sveltia CMS. It will be added before the 1.0 release. Check our release notes for updates.

Overview

To register a custom preview template, use the registerPreviewTemplate method on the CMS object:

js
CMS.registerPreviewTemplate(name, component);

Parameters

  • name (string, required): The name of the collection or collection file for which the preview template is being registered.
  • component (React component, required): A React class component that defines the preview template. This component receives the entry data as props and should render the preview accordingly.

Released under the MIT License.