Content types

Content types define the data structure of a document in your project.

Written by Peter Balazs

Last updated: 05/10/2018

A content type defines a document's data structure in your project. A content type consists of one or more fields. A field describes the type of the data that will be included in your document. The type of a field is either a predefined type or a content type that you have defined previously.

There are four different content types:

  • Simple content type

    A simple content type is the default one. Content editors can create multiple documents of a simple content type.

  • Singleton content type

    Content editors can create only one document of a singleton content type. It is ideal for content that are not repeatable (like a footer component, or a landing page).

  • Enumeration content type

    Enumeration content types are for defining list values. These enumeration content types can be used as values for the select input in the content editor.

  • Union content type

    Union content type fields are used for enabling content editors to create richer and more dynamic page layouts.

    For example in an Article document, adding a union field allows the content editor to choose between inserting a rich text block, an image gallery or a quote. The editor can create an article by adding and ordering as many of these options as they want.

  • Embeddable content type

    Across different content types you can find yourself to repeat the same set of fields with same settings. For this Mozaik supports content type embedding. An embeddable content type cannot be used to create a document. It works as a predefined set of fields that can be used in multiple content types.

    Let's see how it works through an example. Let's assume your project has the following content types:

    • Article

      The Article content type has a publish date, an author, a title, a content field, and since you're building a responsive website it also has three image fields: one for mobile view, one for tablet, and one for desktop.

    • Event

      The Event content type has a date and a location field, and just like the Article content type three image fields: one for mobile view, one for tablet, and one for desktop.

    With Mozaik you can extract these repeated fields into a new content type. Let's call it Responsive Image. Now you can use this content type as a field type and instead of defining three different fields on the Article and Event content types, you only need to define one (let's name it image) and set the field type to the new Responsive Image.

    Content editors will see all three fields when editing an Article or Event document and you can still easily query the images. You don't have to maintain the same fields across different content types, but only in one place.