Defining Constants

Constants can be defined in YAML frontmatter at the top of your document.
---
company:
  name: Acme Corp
  industry: Manufacturing
  employees: 121
category: Home
---

Using Constants

Inline in text

# {% $company.name %} Dashboard

{% $company.name %} operates in the {% $company.industry %} industry, and has {% $company.employees %} employees.

Pass directly to attributes

{% big_value
  data="demo_daily_orders"
  title=$company.name
  value="sum(total_sales)"
/%}

Interpolate into Strings

{% line_chart
  data="demo_daily_orders"
  title="Revenue for {{ $company.name }}"
  x="date"
  y="sum(total_sales)"
/%}

Use in SQL

```sql home_sales
select * from demo_daily_orders
where category = '{{ $category }}'
```

Data Types

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

Nested Access

Use dot notation to access nested properties, and square brackets to access array indices:
{% $company.name %}       # Acme
{% $targets.revenue %}    # 1000000
{% $colors[0] %}          # red