---
title: "Conditional fields (Liquid templates)"
slug: "conditional-fields-new-liquid-templates"
description: "Wrap a signature field in a Liquid if statement so it appears only when the user has a value, and use unless to show fallback text when a field is empty."
updated: 2024-01-16T21:02:01.000Z
canonical: "https://help.opensense.com/docs/conditional-fields-new-liquid-templates"
---

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

# Conditional fields (Liquid templates)

## Overview

This article uses the current Opensense template syntax, Liquid (**as of 2022**). If you're used to the older format, see [Conditional fields (legacy templates)](https://help.opensense.com/docs/conditional-fields-pre-2022-legacy).

- You can make any field a conditional field.
- Make a field optional if some employees use it and some don't. It's removed automatically from the final email signature for employees who don't use it.
- You can wrap IF statements around any signature element, to make it appear **only** if that field is used: `{% if field %} {{field}} {% endif %}`.


## A conditional field on its own line

**HTML code view.** The row is wrapped in an if statement:

<img src="https://help.opensense.com/media/conditionalfields1-bb010c1baca6.png" alt="A table row wrapped in {% if mobile %} and {% endif %}, so the M: label and the mobile link show only when the mobile field has a value" width="874" height="460" loading="lazy" decoding="async">

**Recipient's view.** If either field is removed, the separator line is removed too.

<img src="https://help.opensense.com/media/conditionalfields2-9692c6e9507c.png" alt="Rendered signature lines on three rows: an office phone, a mobile number, and a website" width="316" height="118" loading="lazy" decoding="async">


## Conditional fields that share a line

**HTML code view.** Each field has its own if block, and a nested condition shows the separator only when both fields have values:

<img src="https://help.opensense.com/media/conditionalfields3-d7c7445c4b8b.png" alt="HTML code with separate if blocks for phone and mobile, and a nested condition that shows the separator only when both fields have values" width="1428" height="606" loading="lazy" decoding="async">

**Signature preview with logic:**

<img src="https://help.opensense.com/media/conditionalfields4-722c3d5b8171.png" alt="One line of template logic: the phone, a nested phone-and-mobile check around the separator, then the mobile" width="1236" height="88" loading="lazy" decoding="async">

**Recipient's view.** If either field is removed, the separator line is removed too.

<img src="https://help.opensense.com/media/conditionalfields5-66eba5bce737.png" alt="A rendered line with a phone number and a mobile number separated by a vertical bar" width="427" height="43" loading="lazy" decoding="async">

## "Not if" logic

Need "not if" logic? We have that too. Wrap your HTML with `{% unless field %} Alternative Text {% endunless %}` instead.

For example: `{% unless phone %} 1-800-MAINLINE {% endunless %}`

## What's next

- [Hidden fields (Liquid templates)](https://help.opensense.com/docs/hidden-fields-new-liquid-templates)
- [HTML and field types (Liquid templates)](https://help.opensense.com/docs/html-field-types)

For further help, contact Opensense Support at [help@opensense.com](mailto:help@opensense.com).
