Skip to main content

Path expressions

A path expression is a mustache (between {{ and }}) that reads a value out of the rendering context. The simplest form names a top-level key:

Hello, {{name}}!
Context and output

Context

{
"name": "George"
}

Generated output

Hello, George!

Spaces inside the braces are optional and never significant: {{name}}, {{ name }}, and {{ name }} all parse identically.

Dot notation

Nested fields are reached with dot notation. There is no special operator for arrays; numeric segments are supported by helpers, not by the path syntax itself:

Hey {{name.first}} {{name.last}}!
Context and output

Context

{
"name": {
"first": "George",
"last": "Smith"
}
}

Generated output

Hey George Smith!

Missing keys

A missing key resolves to undefined and renders as the empty string. Bigodin does not walk the context stack the way Mustache does; if a name is not found in the current context, the lookup stops there. Use the context-walking variables ($parent, $root) to reach outer scopes explicitly.

A plain leading name (or the first segment of a dotted path) is resolved against the active block params before the context, so an as |name| binding shadows a context key of the same name. The prefixed forms below ($this, $parent, $root, @…, $<var>) are never shadowed by a block param.

[{{missing}}]

…with any context renders as [].

Special names

These bare-word names have built-in meanings inside path expressions; see the linked pages for details.

NameMeaning
$this, this, .Current context (see Context blocks)
$parent, ../One level up the context stack
$root, @rootOutermost context
$<name>A user-assigned variable (see Variables)
@index, @key, @first, @lastInside a loop only (see Iteration variables)
as |a b| namesBlock params bound on the enclosing block (see Block params)

Path versus helper call

A bare identifier with no parameters is ambiguous between a path lookup and a no-arg helper call. Bigodin resolves this by checking the helper registry: if a helper with that name is registered (custom or built-in), the helper runs; otherwise the name is treated as a path. To force a path lookup when a helper of the same name exists, prefix with $this.:

{{uuid}}
{{! calls the uuid helper if registered, else looks up "uuid" in context }}
{{$this.uuid}}
{{! always reads the "uuid" key from the current context }}

See Calling helpers for the full helper-call syntax.