Skip to content

Overview of handling various types of frontmatter fields, including tricks and traps.

Working with Frontmatter

This page is a work in progress.


Numbers & Logic

TABLE WITHOUT ID EmptyValue, Bool, Numeric, StringNumeric
FROM ""
WHERE file.name = this.file.name

Strings

Basic

TABLE WITHOUT ID StringWithQuotes as "String in Quotes", StringNoQuotes as "String no Quotes", StringEscapting as "String Escaping", StringHTML as "String with HTML"
FROM ""
WHERE file.name = this.file.name

Multiline

TABLE WITHOUT ID StringMultiline, StringMultiWithBreaks
FROM ""
WHERE file.name = this.file.name

Tips for Working with Strings

Traps for Working with Strings


TABLE WITHOUT ID Link, Link.file.cday
FROM ""
WHERE file.name = this.file.name

Dates

TABLE WITHOUT ID Date, DateTime, Duration, Date + Duration as "Date + Duration", dateformat(Date, "yyyy-MM") as "Formatted Date"
FROM ""
WHERE file.name = this.file.name

Arrays

TABLE WITHOUT ID FlatArray, BulletArray
FROM ""
WHERE file.name = this.file.name
  • If field is an array (like in your case), then contains is looking for an element that matches exactly. So if you had field:: [[abc]], [[def]], a then it would match. If field is a string (an array of characters)... it would still be looking for an element it's just that in that case elements are individual characters. A simple way around it would be to do =contains(join(this.field), "a") which turns the array into a string, and then does a character search for any a's.

Objects

Basics

TABLE WITHOUT ID KeyedObject, NestedObject
FROM ""
WHERE file.name = this.file.name

Looking inside

TABLE WITHOUT ID KeyedObject.name, NestedObject[0].color, "<div style='background-color:#" + NestedObject[0].color + ";'> </div>" as  "HTML Color"
FROM ""
WHERE file.name = this.file.name

Flattening objects

TABLE WITHOUT ID NObjects.name, NObjects.color, "<div style='background-color:#" + NObjects.color + ";'> </div>" as  "HTML Color"
FROM ""
WHERE file.name = this.file.name
FLATTEN NestedObject as NObjects