sittari-studio

pages

by sittari-studio
payload-plugins
Publishing workflow
v4
^4.0.0-0
MIT

Overview

Summary generated from the README

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.

Features

  • Versioned pages collection with drafts and autosave every 375 milliseconds
  • Page types keyed by name, each rendered as a conditional field group
  • Built-in factories for a standard rich-text page and a block-based flexible page
  • Localized title that can be switched off with an option
  • Overrides callback to change access control, hooks, admin settings or fields
  • English, Russian and Ukrainian labels included

Use cases

  • Set up a pages collection with several layouts such as article pages and block-built landing pages
  • Build a multilingual site where page titles and content are localized
  • Pair with a permalink plugin to give pages WordPress-style slugs and URLs

From the author

PayloadCMS pages plugin.

Installation

npm i @sittari/payload-pages

0

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

Repository stars

Trends appear after 7 days of data. Daily snapshots have not started yet.

Shared by 8 plugins in sittari-studio/payload-plugins.

npm weekly downloads

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

59/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1294311885-pages.svg)](https://payloaddirectory.dev/plugins/1294311885-pages)
HTML
<a href="https://payloaddirectory.dev/plugins/1294311885-pages"><img src="https://payloaddirectory.dev/badge/1294311885-pages.svg" alt="Payload Directory"></a>
Updated Sep 11, 2026Created Jul 8, 2026Published Sep 11, 2026

README

@sittari/payload-pages

A Payload CMS plugin that adds a versioned pages collection with configurable page types, localized fields, drafts, and autosave.

Install

pnpm add @sittari/payload-pages

Basic usage

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: [],
});

Configuration

pageTypes is required unless the plugin is disabled.

OptionTypeDefaultDescription
enabledbooleantrueSet to false to return the incoming Payload config unchanged.
localizeTitlebooleantrueEnables or disables localization on the default title field.
pageTypesPageTypesRequiredPage-type definitions keyed by the value stored in pageType.
overrides(defaultCollection) => CollectionConfigDefault collectionExtends 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: '' },
    },
  }),
];

Enable or disable the plugin

pagesPlugin({
  enabled: false,
});

When disabled, the plugin does not add the pages collection.

Compose page types

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.

Configure title localization

The default title is localized. Disable localization when the Payload project does not use localized page titles:

pagesPlugin({
  pageTypes: {
    standardContent: createStandardContentPageType(),
  },
  localizeTitle: false,
});

Customize a built-in page type

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'],
});

Override the collection

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.

Collection defaults

The generated collection has:

  • The slug pages
  • title as the admin display title
  • English, Russian, and Ukrainian collection and field labels
  • Drafts and versions enabled
  • Draft autosave every 375 milliseconds
  • A required title field, localized by default
  • A required pageType select followed by one conditional group per page type

Built-in page-type factories

  • createStandardContentPageType() 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.

Similar plugins