> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.meetgail.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.meetgail.com/_mcp/server.

# String Templates

> Compose text with live values dropped in, and repeat text for every item in a list.

A string template is text with placeholders that get filled in when a workflow
runs. You write ordinary text and mark the spots where a value should go with
`{{ }}`. When the step runs, each placeholder is replaced with the real value.
Templates are the natural choice any time you are building text: an email body, a
subject line, a message, or a URL.

## The basics

Put an [expression](/platform/workflows/core-concepts/expressions/using-expressions-in-nodes) inside
the double braces and it is replaced with its value:

```text
Hello, {{node.contact.first_name}}!
```

You can use as many placeholders as you like in one template:

```text
{{node.contact.first_name}} {{node.contact.last_name}} has {{node.account.points}} points.
```

The placeholder does not have to be a simple value. Anything you can write as an
expression works, including a small calculation or a choice between two options:

```text
Your score is {{node.score.value * 100}}% ({{node.score.value >= 0.7 ? "Pass" : "Fail"}}).
```

Need a literal `{{` in your text, rather than a placeholder? Write `\{{` and it
will appear as `{{` in the output.

## Repeating text for a list

Sometimes you want to produce one line of text per item in a list, like a
line-item summary or a bulleted digest. An `{{each}}` block does that: it repeats
the text between `{{each ...}}` and `{{end}}` once for every item in a list.

Inside the block, refer to the current item and its position by adding
`._each_.item` and `._each_.index` to the list's path. So if you are looping over
`node.order.items`, the current item is `node.order.items._each_.item` and its
position is `node.order.items._each_.index` (counting from zero, so add 1 for a
friendly, human-readable number).

```text
Here is your order:

{{each node.order.items}}
{{node.order.items._each_.index + 1}}. {{node.order.items._each_.item.name}} (qty: {{node.order.items._each_.item.quantity}})
{{end}}
Thank you for your order!
```

For a list of three items, this produces:

```text
Here is your order:

1. Widget A (qty: 3)
2. Widget B (qty: 7)
3. Gadget C (qty: 1)

Thank you for your order!
```

An `{{each}}` block builds text. If instead you need to run a set of steps for
every item in a list, such as sending a separate email to each contact, use the
[For Each](/platform/workflows/node-reference/logic-and-flow/for-each) node. A rough rule:
reach for `{{each}}` to assemble a report, reach for For Each to take an action
per item.

## Good to know

* **Everything becomes text.** Whatever a placeholder holds is turned into text
  for the output. A number like `42` prints as `42`; a yes/no value prints as
  `true` or `false`.
* **Spaces inside the braces do not matter.** `{{ node.value }}` and
  `{{node.value}}` mean the same thing.
* **The list in an `{{each}}` block must be a plain reference** to a list a step
  produced, not a calculation. If you need to filter or reshape a list first, do
  that in an earlier step (for example a
  [Data Transform](/platform/workflows/node-reference/logic-and-flow/data-transform)) and
  point the block at that step's output.

## Related

#### [Expressions](/platform/workflows/core-concepts/expressions/using-expressions-in-nodes)

The language you write inside the braces.

#### [Variables & Data Flow](/platform/workflows/core-concepts/variables-data-flow)

Where the values in a template come from.