Loving Tina? ⭐️ us on GitHubStar

Docs

Learn

v.Latest
Documentation
    Content Modeling with TinaCMS
    Table of Contents

    Defining "collections"

    Each item in your collections array represents its own entity. In the above example, we defined a post collection, and set its path as content/posts, which maps to a directory in our site's repository. Each collection contains an array of fields, that each have a defined type.

    ---
    title: This is my title
    ---
    This is my main post body.
    Note: The isBody property is used to output a given field to the markdown body, instead of its frontmatter.

    Once we've defined a collection, we can edit its fields through the Tina UI, or query its content using the Tina Content API.

    Grouping properties as an "object"

    An object type takes either a fields or templates property (just like the collections definition). The simplest kind of object is one with fields:

    // ...
    fields: [
    {
    label: 'Testimonial',
    name: 'testimonial',
    type: 'object',
    fields: [
    {
    label: 'Author',
    name: 'author',
    type: 'string',
    },
    {
    label: 'Role',
    name: 'role',
    type: 'string',
    },
    {
    label: 'Quote',
    name: 'quote',
    type: 'string',
    ui: {
    component: 'textarea',
    },
    },
    ],
    },
    ]
    // ...

    Setting list: true would turn the values into an array.

    More complex shapes can be built by using the templates property. This allows your editors to build out pages using predefined blocks.

    Referencing another document

    The reference field connects one document to another and only needs to be defined on one side of the relationship. You can specify any number of collections you'd like to connect:

    // ...
    fields: [
    // ...
    {
    label: 'Author',
    name: 'author',
    type: 'reference',
    collections: ['author'], // points to a collection with the name "author"
    },
    ]
    //

    Available data types

    Each field in a collection can be of the following type:

    scalar types

    nonscalar types

    Video Tutorial

    For those who prefer to learn from video, you can check out a snippet on media from our "TinaCMS Deep Dive" series.

    Summary

    • Your content is modeled in the tina/config.{ts,js,tsx} in your repo using defineConfig.
    • Your content model contains an array of "collections". A "collection" maps a content type to a directory in your repo.
    • A "collection" contains multiple fields, which can be of multiple scalar or non-scalar data types.
    Last Edited: March 11, 2025