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

# Show content conditionally and repeat a list

> Show a section to some recipients only, switch between two versions, and repeat a list of items.

Sometimes one email needs to change shape: show a section to some recipients, swap one offer for another, or list a different number of points each time. You do this with two kinds of Liquid instructions, `if` and `for`. You write them in the email's design, between the placeholders you already use. For the placeholders themselves, see [Personalizing an email](https://docs.allgoodhq.com/mk/content/email/emails/personalizing-an-email.md). For ready-made snippets, see [Liquid recipes](https://docs.allgoodhq.com/mk/content/email/emails/liquid-recipes.md).

## Show a section to some recipients only

Wrap the section in `if` and `endif`. Recipients who don't match never see it, and you don't need to do anything else.

```liquid theme={null}
{% if person.lifecycleStage == "Customer" %}
  <mj-section>
    <mj-column>
      <mj-text>Thanks for being a customer. Here is your renewal guide.</mj-text>
    </mj-column>
  </mj-section>
{% endif %}
```

Your condition can test any [merge field](https://docs.allgoodhq.com/mk/content/email/emails/merge-field-reference.md), such as `person.title`, `person.companyName`, or `person.lifecycleStage`.

## Switch between two versions

Add `else` to show something different to everyone who doesn't match.

```liquid theme={null}
{% if person.lifecycleStage == "Customer" %}
  Here is your renewal guide.
{% else %}
  Here is how to get started.
{% endif %}
```

If you leave `else` out, everyone else sees nothing.

## Repeat a list

To show a different number of bullet points each time, use `for` over a copy field whose type is `array`.

```liquid theme={null}
<mj-text>
  <ul>
    {% for point in asset.copy.content.points.value %}
      <li>{{ point }}</li>
    {% endfor %}
  </ul>
</mj-text>
```

You add as many points as you need when you write the email, and the list in the design grows or shrinks to match. Your template's [copy schema](https://docs.allgoodhq.com/mk/content/email/templates/writing-the-copy-schema.md) must declare `points` as an `array`.

## Run a promotion for a limited time

Compare today's date to an end date you keep in a copy field. allGood works out the email when it sends, so a nurture email that goes out over many months picks the right version each time.

```liquid theme={null}
{% assign today = "now" | date: "%Y-%m-%d" %}
{% if today < asset.copy.content.promoEnds.value %}
  Use code SPRING for 20% off.
{% else %}
  Browse our latest offers.
{% endif %}
```

Write the end date as year-month-day, such as `2026-12-01`, so the comparison orders correctly. Because the date sits in the copy, you can change it without editing the design.

* **The date is fixed when the email sends.** A recipient who opens it a week later still sees the version that was live when it sent. If the end date matters, state it in the email.
* **Time zones:** the send time is likely in UTC, so the cutoff can shift by up to a day for some of your recipients.
* **Preview shows today.** To check the after-the-date version, move the end date back for a moment.
* **Review perennial emails.** Once a promotion ends, your email shows the fallback or nothing. Note the end date where reviewers will see it.

## What can go wrong

* **A misspelled field counts as empty.** `{% if person.titel == "VP" %}` quietly means false for everyone. Preview the email as a real person who should match.
* **Keep required footer items outside conditions.** Your unsubscribe link and postal address must appear in every recipient's message. See [Before an email can send](https://docs.allgoodhq.com/mk/content/email/emails/before-an-email-can-send.md).
* **Wrap whole sections.** Put a condition around an entire `mj-section`, not around one `mj-column` of a multi-column section.
* **One bad render stops the whole send.** If your email fails to render for one recipient, the whole send fails. Before you publish, preview it as someone with blank fields.
* **Only standard Liquid works.** There are no custom filters.

## Related articles

* [Personalizing an email](https://docs.allgoodhq.com/mk/content/email/emails/personalizing-an-email.md)
* [Merge field reference](https://docs.allgoodhq.com/mk/content/email/emails/merge-field-reference.md)
* [Liquid recipes for emails](https://docs.allgoodhq.com/mk/content/email/emails/liquid-recipes.md)
* [Previewing and testing an email](https://docs.allgoodhq.com/mk/content/email/emails/previewing-and-testing-an-email.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.