Docs / Clautron / Variable syntax

Variable syntax

Most string fields in a blueprint accept variables — placeholders that resolve at runtime to context-specific values. Variables use double curly braces: {{post.title}}.

Basic usage

When a feature, job, or report runs, Clautron substitutes any {{variable}} tokens in string fields with their current values.

{
  "type": "send_email",
  "to": "admin@example.com",
  "subject": "New post: {{post.title}}",
  "body": "Author: {{post.author.display_name}}\nURL: {{post.permalink}}"
}

Available variable namespaces

{{post.*}} — current post

Available when triggered by save_post or any post-related hook.

{{user.*}} — current user

{{site.*}} — site info

{{date.*}} — current time

{{trigger.*}} — trigger payload

Whatever data the trigger passed in. For save_post this includes {{trigger.post_id}}; for rest_api triggers it includes the request body.

{{previous.*}} — previous action results

If an action stores its result, subsequent actions can reference it. Example: a data_query action stores results, then a send_email action uses them.

{{previous.query.count}}        // number of rows returned
{{previous.query.first.title}}  // first row's title field

Filters & modifiers

Append filters with the pipe character to transform values:

{{post.title|upper}}              UPPERCASE
{{post.title|lower}}              lowercase
{{post.title|truncate:50}}        Truncate to 50 chars
{{post.content|strip_tags}}       Remove HTML
{{date.now|format:Y-m-d}}         Format date
{{post.permalink|url_encode}}     URL-encode

Default values

Provide a fallback if the variable is missing:

{{post.meta.subtitle|default:No subtitle}}
SAFETY
Variables resolved into HTML output are automatically escaped. To intentionally allow HTML, use the |raw filter — but only if you trust the source.