# merge\_tags

Source: https://zotonic.com/docs/2432/merge_tags

URI: https://zotonic.com/id/2432

Language: en



A mail-merge like filter where tag-expressions in a text are replaced with the value of their evaluation.

The tags in the text are surrounded by `{{ ... }}` markers. After the tag is evaluated the resulting text is escaped and replaces the tag.

Example:

```django
{{ "Hello {{ name }}"|merge_tags:%{ name: "World" } }}
```

This is most useful to replace markers in texts like emails, where the default text is saved into a body or summary of a page.

For example, a page’s body could be like:

```django
<p>Hello {{ name_first }},</p>
```

And the template could be like:

```django
{{ message_id.body|merge_tags:%{ id: recipient_id } }}
```

Then the tag in the saved body will be replaced with the first name of the recipient.

It is also possible to use some simple filters:

```django
<p>Hello {{ name_first|default:title }},</p>
```

Or simple expressions:

```django
<p>The sum is {{ 100 + 200 }}</p>
```

Or a date filter:

```django
<p>This article was created on {{ created|date:"Y-m-d" }}</p>
```

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2432?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2432?language=en>)
