Skip to main content

Defining Variables

In Frontmatter

Variables can be defined in YAML frontmatter at the top of your document:
These live in the same frontmatter block as a page’s settings — any key that isn’t a reserved page setting is treated as a variable.

In Inputs

Some components create variables that can be used elsewhere in your markdown, for example the dropdown component. When you add an input component, it creates a variable using the id attribute:
All available filters for your page can be found in the Filters tab in the sidebar.

Built-in Variables

Some variables are automatically available based on the logged-in user:

Using Variables

Reference variables using double curly braces {{ my_variable }}. Variables defined in frontmatter use the $ prefix: {{ $my_variable }}.

In Markdown

Use variables inline in your text content:

From Frontmatter

From Inputs

In Component Attributes

Reference variables in component attributes with curly braces {{}}:

From Frontmatter

Frontmatter variables also support direct assignment, useful for passing arrays and objects.

From Inputs

Note that not all attributes support input variables.

In SQL

From Frontmatter

From Inputs

Use variables in SQL queries for dynamic filtering:

Advanced Usage

Fallback Values

Add fallback values using pipes |:

Conditional Blocks

Conditional blocks [[...]] will only be included if all variables within it resolve to non-empty values:

Context-Aware Defaults

Input component variables automatically use context-aware defaults, so you can reference them directly without specifying a property:
  • In SQL contexts (SQL queries, where clauses): Uses .selected (includes quotes)
  • In text contexts (titles, markdown text): Uses .literal (excludes quotes)

Explicit Property Reference

You can explicitly specify which property to use. Each filter component offers different properties. For example, the dropdown component offers .selected, .literal, and .filter properties:

Nested Access

Use dot notation to access nested properties in frontmatter variables, and square brackets to access array indices:

Data Types

Variables can be:
  • Strings: name: John Doe
  • Numbers: age: 30
  • Booleans: active: true
  • Arrays: colors: [red, green, blue]
  • Objects: company: { name: Acme, industry: Manufacturing }