Adds a pages collection to Payload with a required title and a page type selector that shows one conditional field group per type. Page types are configured through the plugin options, with optional factories for standard rich-text content and flexible block layouts. Drafts, versions and autosave are enabled by default, and an overrides callback can modify the final collection. It targets Payload 4.
PayloadCMS pages plugin.
Installation
npm i @sittari/payload-pages0
Stars
0
Forks
0
Open Issues
1 months ago
Last Updated
3
Weekly Downloads
v2.1.0
npm Version
25.1 KB
Unpacked Size
0
Dependencies
Trends appear after 7 days of data. Daily snapshots have not started yet.
Shared by 8 plugins in sittari-studio/payload-plugins.
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1294311885-pages)<a href="https://payloaddirectory.dev/plugins/1294311885-pages"><img src="https://payloaddirectory.dev/badge/1294311885-pages.svg" alt="Payload Directory"></a>README
A Payload CMS plugin that adds a versioned pages collection with configurable page types, localized fields, drafts, and autosave.
pnpm add @sittari/payload-pages
import { buildConfig } from 'payload';
import {
createFlexiblePageType,
createStandardContentPageType,
pagesPlugin,
} from '@sittari/payload-pages';
export default buildConfig({
plugins: [
pagesPlugin({
pageTypes: {
standardContent: createStandardContentPageType(),
flexible: createFlexiblePageType({
blockSlugs: ['hero', 'content'],
}),
},
}),
],
collections: [],
});
pageTypes is required unless the plugin is disabled.
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Set to false to return the incoming Payload config unchanged. |
localizeTitle | boolean | true | Enables or disables localization on the default title field. |
pageTypes | PageTypes | Required | Page-type definitions keyed by the value stored in pageType. |
overrides | (defaultCollection) => CollectionConfig | Default collection | Extends or replaces the final pages collection configuration. Applied last. |
The package root exports createStandardContentPageType and createFlexiblePageType. Their option types and the PagesPluginConfig, PageTypeConfig, and PageTypes types are also available from the package root and from @sittari/payload-pages/types.
pagesPlugin does not create a slug or path field. Use @sittari/payload-permalink after pagesPlugin when the collection needs WordPress-style slugs and permalinks:
import { permalinkPlugin } from '@sittari/payload-permalink';
plugins: [
pagesPlugin({
pageTypes: {
standardContent: createStandardContentPageType(),
},
}),
permalinkPlugin({
siteUrl: 'https://example.com',
collections: {
pages: { prefix: '' },
},
}),
];
pagesPlugin({
enabled: false,
});
When disabled, the plugin does not add the pages collection.
pagesPlugin({
pageTypes: {
standardContent: createStandardContentPageType(),
flexible: createFlexiblePageType({
blockSlugs: ['hero', 'content', 'gallery'],
}),
blogIndex: {
label: 'Blog Index',
fields: [{ name: 'heading', type: 'text' }],
},
},
});
The object key becomes the stored value and group-field name. Its label is used in the page-type selector. The first entry is the default selection.
The built-in factories are optional. Include either, both, or neither of them.
The default title is localized. Disable localization when the Payload project does not use localized page titles:
pagesPlugin({
pageTypes: {
standardContent: createStandardContentPageType(),
},
localizeTitle: false,
});
Factory options shallowly replace the generated page-type properties. This keeps array replacement explicit and avoids deep-merge behavior:
pagesPlugin({
pageTypes: {
standardContent: createStandardContentPageType({
label: 'Article',
fields: [
{
name: 'content',
type: 'richText',
localized: false,
editor: customEditor,
},
],
}),
},
});
The flexible factory accepts blockSlugs, which become blockReferences on its blocks field:
createFlexiblePageType({
blockSlugs: ['hero', 'content', 'gallery'],
});
overrides runs after page types and all default fields have been assembled. Use it for access control, hooks, admin settings, versions, or additional fields:
pagesPlugin({
pageTypes: {
standardContent: createStandardContentPageType(),
},
overrides: (defaultCollection) => ({
...defaultCollection,
admin: {
...defaultCollection.admin,
defaultColumns: ['title', 'pageType', '_status', 'updatedAt'],
},
fields: [
...defaultCollection.fields,
{
name: 'internalName',
type: 'text',
},
],
}),
});
The callback must return a complete Payload CollectionConfig. Spread defaultCollection and nested properties you want to preserve when making partial changes.
The generated collection has:
pagestitle as the admin display titletitle field, localized by defaultpageType select followed by one conditional group per page typecreateStandardContentPageType() creates a localized content rich-text field.createFlexiblePageType() creates a blocks field and accepts a blockSlugs option.The plugin does not add these types automatically. Payload localization must be configured in the consuming project when using the standard-content factory's localized field.
payload better editor
Side-by-side live-preview iframe with a sidebar for editing individual blocks in the Payload edit view
710/wk113v3
payload better preview
Live preview with block hover highlighting and two-way scroll sync between the Payload admin and the preview
490/wk16v3
payload lexical collaboration
Inline threaded comments on text selections in the Payload Lexical rich text editor
220/wk14v3
richtext
Rich-text child block, default Lexical editor preset and JSX renderer for Atomic Payload
610/wk37v3
plugin
On-page editing and draft preview links for Payload collections and globals on a Next.js frontend
610/wk0v3 v4
payload plugin json form builder
Turn a Payload JSON field into real admin fields with an in-admin form builder
580/wk29v3