Loving Tina? us on GitHub0.0k

Docs

Learn

v.Latest
Documentation
Templates
Table of Contents

Templates allow you to define multiple structured variants within a single collection or object. They’re ideal when you need different data shapes under the same parent.

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

Tina uses folder names matching the template to organize files correctly, e.g.:

/content/pages/marketing/home.md
/content/pages/content/about.md

Limitations

  • Collections using templates cannot use the ‘Add Folder’ button
Last Edited: March 26, 2025