Frontmatter settings

Frontmatter is what static site generators use to store content's metadata. Spinal gives an easy way to add and edit these.

Using frontmatter in Spinal is a way to make sure all frontmatter, and its values, are consistent throughout your content type. Opposed to using the flatfile format your static generator provides, where you can add whatever key/value. The UI Spinal gives makes it way easier for your team to edit these values, instead of thinking about the format it needs to (eg. with quotes, as an array, or a hash maybe?).

Screenshot of the frontmatter form in the Spinal's content type settingd

Edit frontmatter settings #

Any frontmatter found in your content type is collected and shown on the content type’s settings.

Screenshot of the frontmatter form in the Spinal's content type settingd

Key #

Think of it as the identifier of the frontmatter. It’s the part before the value, eg. category: marketing. If you edit frontmatter, you cannot change this value. Otherwise it would mess up the content where the frontmatter key was already used.

Type #

The type determines how the field shows up in your editor. It can be one of the following:

  • string (default type);
  • upload: allows to drag & drop images to your Cloudinary account or GitHub repo;
  • text: shows as a textarea for longer text;
  • datetime: shows as a datetime field;
  • number: also returns a non-string number value;
  • boolean: shows as a checkbox to be either true or false;
  • checkbox: shows as multiple checkboxes, returns an array;
  • select: allows to choose one value;
  • hash: a nested key/value pairing;
  • array: a list of value under a nested key.

Helper text #

The helper text shows below the field in the editor. It can be used to guide your writers on the input needed or why the field is there.

Allowed values #

Allowed values is a comma-separated list of values that works with the checkbox and select field types. If you imported existing content, the allowed values are collected for you.

Add by default #

Not all frontmatter needs to be added when you create new content. When Add by default is checked, the frontmatter is added to the new content. You can always remove it from your your content if not needed.

Read only #

Some fields should not be edited by your team. When you check Read only, it shows up in the editor, but can’t be edited.

Default value #

Both the, default available, filename and folder frontmatter have the option to set a default value. You could add in a static value, like /posts for the path, but you can also add a magic value that is transformed upon creation, example: posts/%Y-%m-%d-new-content.md. This gets transformed, upon new content creation, as posts/2022-01-01-new-content.md. Assuming today was the first day of 2022. You can use any strftime directives.

Create new frontmatter key #

If you need a new frontmatter key, you can easily create it. Select Add field, and a new set of fields shows. This set is the same as editing frontmatter, except for the fact you can choose the frontmatter key.

Screenshot of the new frontmatter key form in the Spinal's content type settingd

Have questions?

Something still unclear? Reach out to support.