Supported File Formats

Illustrated drawing of Amadeus Maxmimilian StadlerIllustrated drawing of Amadeus Maxmimilian Stadler

Amadeus Stadler

Last updated June 30, 2023

Every Collection in Mattrbld has a content type that dictates what types of content files can be edited in that Collection and how Mattrbld serialises them. This article is intended to give you an overview over what types of content files Mattrbld supports.

Genral Information

A content file in Mattrbld refers to the file stored in the project’s repository containing the data that forms a piece of the content of that project. The file holding information about an author on a shared blog is a content file, and so is an individual blog post.

All files that can be edited with Mattrbld are text files, but there are a variety of text file formats out there and while Mattrbld cannot possibly support all of them, some lend themselves to be used in a headless CMS more than others.

Currently Supported File Formats

JSON

Useful to both humans and computers alike, JSON files may be a bit more verbose than other file formats, but are still highly flexible and easy to work with due to the fact that a browser can parse them without the need for external libraries.

File suffix: .json

Markdown + YAML Frontmatter

Another file format prevalent with static websites is Markdown, a simple syntax for expressing rich text. In order to store more than just text content, the concept of frontmatters was introduced, a set of metadata that would be added to a Markdown file before the actual content as a header of sorts.

The name “Mattrbld” is actually derived from the concept of frontmatter: it’s a combination of “(front)matter” and “build”, since Mattrbld helps you build the frontmatter of your Markdown files with ease. 😊

For Collections with a content type of “Markdown”, Mattrbld will save all fields formatted as YAML in the frontmatter of the file. To add actual markdown content to the file, give a top-level field (typically a Rich Text field outputting Markdown) of the Schema the special key content.

File suffix: .md

Media

This file format is special since it is technically not a file format at all. Setting a Collections content type to “Media” turns it into a Media Collection, which functions more like the Media Library than a Collection of a different type—with the benefit of being able to be marked as “linkable”, which can be very useful. This allows you, for example, to set up a directory of downloadable PDF documents that resides outside of your media folder. You can learn more about this special type of collection in the dedicated article on Media Collections.

File suffix: n/a

Formats Under Consideration

YAML

YAML is a common, less verbose alternative to JSON, which is also used by some static site generators. Since Mattrbld is already able to parse and serialise YAML for Markdown frontmatters, it would be an easy additional format to implement, but hasn’t been added yet.


In the next article, you’ll learn about Media Collections, but you can also skip ahead to the article on URL templates, which can be used to make it easy for Content Editors to link to other content items in your project.