---
title: "Liquid templates"
slug: "liquid-templates"
description: "Explore how Liquid templates in Userflow enable dynamic content generation based on user attributes, enhancing customization and user experience."
updated: 2026-03-25T12:52:44Z
published: 2026-03-25T12:52:44Z
stale: true
---

> ## Documentation Index
> Fetch the complete documentation index at: https://help.userflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Liquid templates

[Liquid](https://shopify.github.io/liquid/) is an open-source template language, originally created by Shopify and now used by many other apps.

In Userflow, Liquid templates are used in a few places to allow for highly custom logic. Liquid templates can generate dynamic values, based on user attributes, the current page, and control flow statements such as `if` and `case/when`.

Example use cases:

- An Adoption Agent can be provided with instructions tailored to the user (e.g. a “company type” attribute).
- A resource center’s knowledge block’s **Default search query field** can be used to perform a different search based e.g. on the current page, in order to make the right articles show up under **Suggested articles**.

[See also official Liquid documentation](https://shopify.github.io/liquid/)

### Userflow context variables

When Liquid templates are rendered, e.g. when the instructions for the Adoption Agent is being used, they have access to a few built-in variables which provide information about the user.

You can add user/company attributes to your template by enclosing them in double curly braces.

#### page_url

Contains the URL of the page the user is currently on, if the template is used in the context of an actively visiting user.

#### user

Contains an object with all the user’s attributes. Access a user attribute as:

```plaintext
{{ user.example_attribute }}
```

#### group

Contains an object with all the user’s current company/group’s attributes. Access a company/group attribute as:

```plaintext
{{ group.example_attribute }}
```

The term “group” is used here because it is the technical term we use for companies, just as you call `userflow.group(companyId)` in Userflow.js to associate a user with a company/group.

#### group_membership

Contains an object with all the attributes of the membership between the user and the current company/group. Access a membership attribute as:

```plaintext
{{ group_membership.example_attribute }}
```

### Userflow custom filters

#### url_matches

```plaintext
<url> | url_matches: <pattern>
```

Returns `true` if `&lt;url&gt;` matches the `&lt;pattern&gt;`.

We use the same rules as in our **Current page** conditions. [See the URL pattern matching guide](/userflow/docs/url-pattern-matching).

Example:

```plaintext
page_url | url_matches: '/projects/:id'
```

Will return `true` for `https://example.com/projects/123` and `false` for `https://example.com/dashboard`.

If you want a template to return a single value based on multiple different URL patterns, you need to first assign the result of `url_matches` to a local variable, since Liquid does not support filters in `if` or `case` statements.

```plaintext
{% assign is_projects = page_url | url_matches: '/projects*' %}

{% assign is_themes = page_url | url_matches: '/themes*' %}

{% if is_flows %}
  flows
{% elsif is_themes %}
  themes
{% else %}
  fallback value
{% endif %}
```
