Creates one managed document per developer-defined template, which editors can change but not create, duplicate, delete or rename. A templateField helper adds a group to any collection, global, tab, array or block that stores local overrides and inherits empty values from the template on read. Includes a typed template getter and requires Payload 4.
Managed template documents for Payload CMS.
Installation
npm i @sittari/payload-templates0
Stars
0
Forks
0
Open Issues
2 months ago
Last Updated
27
Weekly Downloads
v0.5.0
npm Version
91.7 KB
Unpacked Size
1
Dependencies
00 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
| Oct 31, 2026 | 0 |
| Oct 30, 2026 | 0 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 0 |
| Oct 25, 2026 | 0 |
| Oct 24, 2026 | 0 |
| Oct 23, 2026 | 0 |
| Oct 22, 2026 | 0 |
| Oct 21, 2026 | 0 |
| Oct 20, 2026 | 0 |
| Oct 19, 2026 | 0 |
| Oct 18, 2026 | 0 |
| Oct 17, 2026 | 0 |
| Oct 16, 2026 | 0 |
| Oct 15, 2026 | 0 |
| Oct 14, 2026 | 0 |
| Oct 13, 2026 | 0 |
| Oct 12, 2026 | 0 |
| Oct 11, 2026 | 0 |
| Oct 10, 2026 | 0 |
| Oct 9, 2026 | 0 |
| Oct 8, 2026 | 0 |
| Oct 7, 2026 | 0 |
| Oct 6, 2026 | 0 |
| Oct 5, 2026 | 0 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
| Sep 26, 2026 | 0 |
| Sep 25, 2026 | 0 |
| Sep 24, 2026 | 0 |
| Sep 23, 2026 | 0 |
| Sep 22, 2026 | 0 |
| Sep 21, 2026 | 0 |
| Sep 20, 2026 | 0 |
| Sep 19, 2026 | 0 |
| Sep 18, 2026 | 0 |
| Sep 17, 2026 | 0 |
| Sep 16, 2026 | 0 |
| Sep 15, 2026 | 0 |
| Sep 14, 2026 | 0 |
| Sep 13, 2026 | 0 |
| Sep 12, 2026 | 0 |
| Sep 11, 2026 | 0 |
| Sep 10, 2026 | 0 |
| Sep 9, 2026 | 0 |
| Sep 8, 2026 | 0 |
| Sep 7, 2026 | 0 |
| Sep 6, 2026 | 0 |
Shared by 8 plugins in sittari-studio/payload-plugins.
12−350 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 12 |
| Dec 4, 2026 | 13 |
| Dec 3, 2026 | 13 |
| Dec 2, 2026 | 11 |
| Dec 1, 2026 | 15 |
| Nov 30, 2026 | 15 |
| Nov 29, 2026 | 14 |
| Nov 28, 2026 | 13 |
| Nov 27, 2026 | 13 |
| Nov 26, 2026 | 13 |
| Nov 25, 2026 | 6 |
| Nov 24, 2026 | 2 |
| Nov 23, 2026 | 2 |
| Nov 22, 2026 | 4 |
| Nov 21, 2026 | 4 |
| Nov 20, 2026 | 12 |
| Nov 19, 2026 | 12 |
| Nov 18, 2026 | 20 |
| Nov 17, 2026 | 20 |
| Nov 16, 2026 | 20 |
| Nov 15, 2026 | 19 |
| Nov 14, 2026 | 19 |
| Nov 13, 2026 | 10 |
| Nov 12, 2026 | 12 |
| Nov 11, 2026 | 3 |
| Nov 10, 2026 | 11 |
| Nov 9, 2026 | 19 |
| Nov 8, 2026 | 21 |
| Nov 7, 2026 | 21 |
| Nov 6, 2026 | 21 |
| Nov 5, 2026 | 20 |
| Nov 4, 2026 | 23 |
| Nov 3, 2026 | 15 |
| Nov 2, 2026 | 7 |
| Nov 1, 2026 | 4 |
| Oct 31, 2026 | 5 |
| Oct 30, 2026 | 5 |
| Oct 29, 2026 | 4 |
| Oct 28, 2026 | 1 |
| Oct 27, 2026 | 1 |
| Oct 26, 2026 | 3 |
| Oct 25, 2026 | 3 |
| Oct 24, 2026 | 3 |
| Oct 23, 2026 | 3 |
| Oct 22, 2026 | 5 |
| Oct 21, 2026 | 14 |
| Oct 20, 2026 | 15 |
| Oct 19, 2026 | 13 |
| Oct 18, 2026 | 20 |
| Oct 17, 2026 | 23 |
| Oct 16, 2026 | 27 |
| Oct 15, 2026 | 28 |
| Oct 14, 2026 | 19 |
| Oct 13, 2026 | 18 |
| Oct 12, 2026 | 18 |
| Oct 11, 2026 | 12 |
| Oct 10, 2026 | 17 |
| Oct 9, 2026 | 21 |
| Oct 8, 2026 | 20 |
| Oct 7, 2026 | 21 |
| Oct 6, 2026 | 29 |
| Oct 5, 2026 | 29 |
| Oct 4, 2026 | 32 |
| Oct 3, 2026 | 32 |
| Oct 2, 2026 | 25 |
| Oct 1, 2026 | 23 |
| Sep 30, 2026 | 25 |
| Sep 29, 2026 | 17 |
| Sep 28, 2026 | 31 |
| Sep 27, 2026 | 28 |
| Sep 26, 2026 | 25 |
| Sep 25, 2026 | 29 |
| Sep 24, 2026 | 39 |
| Sep 23, 2026 | 46 |
| Sep 22, 2026 | 55 |
| Sep 21, 2026 | 70 |
| Sep 20, 2026 | 199 |
| Sep 19, 2026 | 194 |
| Sep 18, 2026 | 189 |
| Sep 17, 2026 | 189 |
| Sep 16, 2026 | 186 |
| Sep 15, 2026 | 188 |
| Sep 14, 2026 | 163 |
| Sep 13, 2026 | 39 |
| Sep 12, 2026 | 40 |
| Sep 11, 2026 | 54 |
| Sep 10, 2026 | 55 |
| Sep 9, 2026 | 73 |
| Sep 8, 2026 | 368 |
| Sep 7, 2026 | 364 |
| Sep 6, 2026 | 362 |
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-templates)<a href="https://payloaddirectory.dev/plugins/1294311885-templates"><img src="https://payloaddirectory.dev/badge/1294311885-templates.svg" alt="Payload Directory"></a>README
A Payload CMS plugin that creates one managed document for every developer-defined template. Users can edit template content, but cannot create, duplicate, delete, or change the identity of template documents.
pnpm add @sittari/payload-templates
import { templateField, templatesPlugin } from '@sittari/payload-templates';
import { buildConfig } from 'payload';
export default buildConfig({
collections: [
{
slug: 'pages',
fields: [
templateField({
name: 'notFoundContent',
template: '404',
}),
],
},
],
plugins: [
templatesPlugin({
templates: [
{
name: '404',
label: 'Page 404',
fields: [
{ name: 'heading', type: 'text', required: true },
{ name: 'message', type: 'textarea' },
],
initialData: {
heading: 'Page not found',
},
},
],
}),
],
});
The generated document stores editable fields under data_<name>—for example, data_404.heading. The title and templateType fields are managed by the plugin and hidden from the admin form.
templateField()templateField(config: TemplateFieldConfig): GroupField
Creates a named Payload group whose fields and fallback values come from a
template registered with templatesPlugin(). It can be used anywhere Payload
accepts fields, including collections, globals, tabs, arrays, and blocks.
import { templateField } from '@sittari/payload-templates';
import type { CollectionConfig } from 'payload';
export const Pages: CollectionConfig = {
slug: 'pages',
fields: [
templateField({
name: 'hero',
template: 'defaultHero',
label: {
en: 'Hero overrides',
uk: 'Перевизначення Hero',
},
admin: {
hideGutter: true,
},
}),
],
};
| Option | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Field name used in the consuming document. Its stored overrides live at this property. |
template | string | Yes | name of a template registered with templatesPlugin(). Unknown names throw during configuration. |
label | GroupField['label'] | No | Payload group label. Static strings, localized label maps, and label functions are supported. |
admin | GroupField['admin'] | No | Payload Admin settings for the generated group. The plugin preserves these settings and installs its template field renderer. |
The function initially returns a marked group definition. During plugin
configuration, templatesPlugin() replaces its empty field list with an
optionalized copy of the registered template fields and adds the fallback hook.
Consequently, templateField() must be used in the same Payload config as an
enabled templatesPlugin() call containing the referenced template.
The consuming document stores only local overrides:
// Managed template: data_defaultHero
{
heading: 'Build something useful',
summary: 'Default summary',
}
// Page document: hero
{
heading: 'A page-specific heading',
// Empty summary inherits "Default summary".
}
Fields copied into the consuming group are optional, even when the managed template requires them. On read, empty local values inherit from the managed template:
undefined, null, '', empty arrays, and empty plain objects inherit.false, 0, and whitespace-only strings remain explicit local values.Inheritance is read-time only. Fallback values are not written into the consuming document, so later edits to the managed template are reflected on the next API read. Admin edit forms receive the raw stored overrides. Empty supported inputs display the active locale's managed template value as a placeholder, and each template-backed group includes a localized link to edit that template document. The Admin API inspector still displays resolved values.
You can explicitly control resolution for Local API operations through Payload request context:
await payload.findByID({
collection: 'pages',
id,
context: {
templateFields: 'raw', // or 'resolved'
},
});
An explicit context mode takes precedence over automatic Admin request detection. Template-backed fields cannot be nested inside a template definition.
| Option | Type | Default | Description |
|---|---|---|---|
templates | TemplateConfig[] | Required | Complete set of managed template definitions. |
enabled | boolean | true | Set to false to leave the Payload config unchanged. |
Each template has:
name: stable unique identifier containing only letters, numbers, and underscores.label: admin document title.fields: Payload fields shown for this template.initialData: optional values applied only when the document is first created. Payload field defaults still apply.On Payload initialization, the plugin creates missing documents, updates labels, and deletes documents removed from configuration. Existing editable data is preserved. Renaming a template is treated as removing the old template and creating a new one.
Collection access prevents normal admin, REST, GraphQL, and access-controlled Local API users from creating or deleting template documents. The identity fields also deny user changes. As with every Payload collection, trusted Local API calls using the default overrideAccess: true bypass access control.
The package exports TemplateConfig, TemplateFieldConfig, and
TemplatesPluginConfig from both the package root and
@sittari/payload-templates/types.
Create a lookup helper with the generated Template type from your project:
import config from '@payload-config';
import { createTemplateGetter } from '@sittari/payload-templates';
import { getPayload } from 'payload';
import type { Template } from './payload-types';
export const getTemplate = createTemplateGetter<Template>(() =>
getPayload({ config }),
);
const notFound = await getTemplate('404');
// Typed as: { id: string | number; data_404?: Template['data_404'] } | null
Valid template names are inferred from the generated type's data_* properties. Each lookup filters by templateType and selects only the matching data_<name> group (plus Payload's always-selected document ID). It returns null when no configured document is found.
payload lineage
Admin pages that show a lineage graph and an ERD of your collections, globals, blocks and their linking fields
5472/wk0v3
better use as title
Build a custom document title from multiple fields for the admin useAsTitle display
50120/wk335v3
payload plugin tree list
Collapsible tree list view for Payload collections that use nested docs parents
3817/wk50v3
payload plugin presets
Save and apply reusable block configurations as presets from the Payload admin blocks drawer
786.7k/wk37v3
payload dynamic
Define record types, fields and relationships in the Payload admin and store them in native SQL-backed collections
78865/wk0v4
payload puck
Puck drag-and-drop visual page builder embedded in the Payload admin for building pages
772.5k/wk117v3