Guide

How to Use Conditional Fields to Show and Hide Signature Elements

Lastline Team6 min read
Share

Not every employee has a mobile number. Not every team member has a job title filled in. When those fields are empty, your email signature shouldn't show blank lines or broken icons. Lastline's conditional fields feature automatically hides signature elements when the underlying data is missing — no manual editing required.

The Problem with Empty Fields

Imagine a signature template that includes a phone number row. If an employee doesn't have a phone number on file, a naive template would render something like:

John Smith

Marketing Manager

(blank)

[email protected]

That blank row with a lonely phone icon looks unprofessional. Multiply this across hundreds of employees — some missing titles, others missing departments — and you end up with inconsistent, messy signatures across your organization.

How Conditional Comments Work

Lastline uses a simple HTML comment syntax to conditionally show or hide parts of your signature. Wrap any section of your signature template with a pair of conditional comments, and Lastline will automatically remove that section when the field is empty.

The syntax is straightforward:

<!--[if FIELD_NAME]-->
  <!-- your HTML here -->
<!--[/if FIELD_NAME]-->

When Lastline renders the signature for a specific employee:

  • If the field has a value, the conditional comments are stripped away and the content is displayed normally.
  • If the field is empty or null, the entire block — including the HTML inside — is removed from the signature.

Supported Fields

You can use conditional comments with any placeholder field in your signature template. The most commonly used fields include:

{{PHONE}}{{MOBILE}}{{TITLE}}{{DEPARTMENT}}{{COMPANY}}{{WEBSITE}}

Any custom placeholder you add to your template — such as {{LINKEDIN}} or {{FAX}} — can also be wrapped with conditional comments.

Practical Examples

Hide a phone number row

Wrap the entire table row so it disappears when the employee has no phone number:

<!--[if PHONE]-->
<tr>
  <td><img src="phone-icon.png" alt="Phone" /></td>
  <td><a href="tel:{{PHONE}}">{{PHONE}}</a></td>
</tr>
<!--[/if PHONE]-->

Hide a mobile number row

<!--[if MOBILE]-->
<tr>
  <td><img src="mobile-icon.png" alt="Mobile" /></td>
  <td><a href="tel:{{MOBILE}}">{{MOBILE}}</a></td>
</tr>
<!--[/if MOBILE]-->

Hide a job title

Perfect for employees who haven't had their title set yet:

<!--[if TITLE]-->
<p style="color: #666; font-size: 14px;">{{TITLE}}</p>
<!--[/if TITLE]-->

Hide a department line

<!--[if DEPARTMENT]-->
<p style="color: #999; font-size: 12px;">{{DEPARTMENT}}</p>
<!--[/if DEPARTMENT]-->

Hide a website link

<!--[if WEBSITE]-->
<tr>
  <td><img src="website-icon.png" alt="Website" /></td>
  <td><a href="{{WEBSITE}}">{{WEBSITE}}</a></td>
</tr>
<!--[/if WEBSITE]-->

Ready to manage your email signatures?

Start for free and deploy professional, consistent signatures across your entire organization in minutes.

Start free trial

Combining Multiple Conditions

You can use multiple conditional blocks in the same template. Each condition is evaluated independently. Here's a realistic signature template with several conditional fields:

<table>
  <tr>
    <td>
      <strong>{{FULL_NAME}}</strong><br/>

      <!--[if TITLE]-->
      <span style="color: #666;">{{TITLE}}</span><br/>
      <!--[/if TITLE]-->

      <!--[if DEPARTMENT]-->
      <span style="color: #999;">{{DEPARTMENT}}</span><br/>
      <!--[/if DEPARTMENT]-->
    </td>
  </tr>
  <tr>
    <td>
      <!--[if PHONE]-->
      <a href="tel:{{PHONE}}">{{PHONE}}</a><br/>
      <!--[/if PHONE]-->

      <!--[if MOBILE]-->
      <a href="tel:{{MOBILE}}">{{MOBILE}}</a><br/>
      <!--[/if MOBILE]-->

      <!--[if WEBSITE]-->
      <a href="{{WEBSITE}}">{{WEBSITE}}</a>
      <!--[/if WEBSITE]-->
    </td>
  </tr>
</table>

An employee with all fields populated sees the full signature. An employee with only a name and email sees a clean, compact signature with no gaps or blank rows.

Before and After

Here's what the difference looks like for an employee who has no phone number and no department:

Without conditional fields

Sarah Johnson

(empty title line)

(empty department line)

[email protected]

(empty phone line)

With conditional fields

Sarah Johnson

[email protected]

The result is a clean, professional signature that adapts to each employee's available data.

Best Practices

  • Wrap the entire visual element — Include the full table row, paragraph, or container in the conditional block. Don't wrap just the placeholder text, or you'll be left with empty icons and labels.
  • Match the field name exactly — The field name in <!--[if PHONE]--> must match the placeholder {{PHONE}} exactly (case-sensitive).
  • Always close your conditions — Every <!--[if FIELD]--> needs a matching <!--[/if FIELD]-->. Unclosed conditions may cause unexpected rendering.
  • Test with sparse employee data — Preview your signature using an employee who has minimal data filled in. This helps you catch layout issues early.
  • Keep required fields unwrapped — Fields like name and email that every employee will have don't need conditional comments. Only wrap optional fields.

Conditional fields work with all Lastline signature templates, including custom HTML templates. They're evaluated at render time — you design once, and every employee gets a clean result.

Common Use Cases

  • New hires — They may not have a title, department, or direct phone number yet. Conditional fields keep their signature clean until their profile is complete.
  • Multi-country teams — Not every region uses the same contact fields. Some offices might not have a fax number or landline, while others do.
  • Partial Google Workspace sync — If your Google Workspace directory has incomplete employee profiles, conditional fields prevent blank data from showing up in signatures.
  • Optional social links — Add LinkedIn or Twitter icons that only appear when the employee has filled in their profile URL.

Getting Started

If you're using one of Lastline's built-in templates, many common fields are already wrapped with conditional comments out of the box. For custom HTML templates, you can add conditional comments to any section by following the syntax above.

  1. Open your signature template in Lastline's signature editor.
  2. Identify fields that may be empty for some employees (phone, title, department, etc.).
  3. Wrap those sections with <!--[if FIELD]--> and <!--[/if FIELD]--> comments.
  4. Preview the signature with different employee profiles to verify.
  5. Deploy — Lastline handles the rest automatically.