Loving Tina? ⭐️ us on GitHubStar

Docs

Learn

v.Latest
Documentation
Templates
Table of Contents

Templates exist as an alternative to the fields type when multiple variants of the same collection or object.

For example in a "page" collection there might be a need for a marketing page template and a content page template, both under the collection "page".

Type Definition

REQUIRED
name
string

The name of the template.


REQUIRED
fields
Field[]

An array of fields.


label
string

The template name as shown in the editor.

All properties marked as REQUIRED must be specified for the field to work properly.

Examples

Basic example with two templates

export default defineConfig({
//...
schema: {
collections: [
{
name: 'page',
label: 'A page of the website',
path: 'content/pages',
format: 'mdx',
templates: [
{
name: 'content',
label: 'Content Page',
fields: [
// ... content page fields
],
},
{
name: 'marketing',
label: 'Marketing Page',
inline: true,
fields: [
//... marketing page fields
],
},
],
},
],
},
})
Last Edited: March 26, 2025