Frontmatter

When writing frontmatter in Markdown (usually in YAML format), whether or not you need to use quotes depends on what's inside the value.

Date Format

The YAML frontmatter date uses the following format, year-month-day in the Elements CMS.

No Quotes Needed If

You can safely skip quotes for simple strings:

title: My Blog Post
date: 2025-08-06
author: Julia

Use Quotes If

  1. The value contains special characters like :, @, #, or {}:

title: “My Favorite Tools: Tailwind, Alpine, and Elements”
  1. The value **starts with a number** that might be misread (like a version number):

version: “1.0”
  1. The value looks like a **boolean**, `null`, or includes **colons/time values**:

status: “false”

time: “14:30”
  1. The value has **line breaks** (rare, but possible in multiline strings).

Safe Rule of Thumb

If you’re unsure — wrap it in quotes. You won’t break anything by quoting strings:

title: “I Just Used Tailwind UI in Elements – And It’s a Game Changer!”

Defining an Array of Images

The following example defines an array of images in the frontmatter for use in a photo gallery.

gallery:
  - src: /project-photos/joel-filipe-unsplash.jpg
    title: "Sunset over the hills"
    alt: "A golden sunset behind rolling hills"
    type: resource
  - src: /project-photos/sam-melchor-unsplash.jpg
    title: "City skyline"
    alt: "Tall buildings against a cloudy sky at dusk"
    type: resource
  - src: /project-photos/sunguk-kim-unsplash.jpg
    title: "Forest trail"
    alt: "A narrow dirt path winding through a dense forest"
    type: resource

Last updated