Complex types in Markdown front matters

If you use a static site generator, such as Jekyll, Hugo, or Next.js, you probably write a post in a Markdown file and include the post metadata in the file's first section, the front matter. It turns out that front matters are typically1 parsed as YAML, a language supporting more types than just strings:

# Example of a YAML front matter
# Notice that YAML supports comments.
title: "If there's a colon in the title: you need to escape it because of YAML"
publish: true #  you can use booleans...
tags: # ...or arrays
  - yaml
  - markdown
changelog: # ...or arrays of objects
  - date: 2020-04-19 # ...or dates
    msg: published first version
  - date: 2020-05-20
    msg: added a code example
Content of the page, in Markdown.

  1. Hugo supports also TOML or JSON for front matters.


If you need help with building the tech products get in touch.