Skip to main content

๐Ÿ“Liquid Markup - Bullet List Tips

One early challenge in using Liquid Markup is using liquid in a list, and ending up with blank bits all over your email/portal. I know I made this mistake many times early on!

This Liquid example below seems to make intuitive sense - if visit == 'N', show "Visit Campus". It even shows your simple liquid plainly in the content editor!

image.png

However, the output for a record with visit == 'Y' would render like this, with a blank list element, which is probably not what you wanted to happen:

image.png

The solution is simple - wrap the Liquidย around the raw <li></li> HTMLย code,ย not just the content.

image.png

This will now render just two bullets:

image.png

The primary drawback is that the WYSIWYG content editor will no longer display the Liquid tag in yellow, as it did originally:

image.png

It only shows in the raw source code HTML - so be mindful of this! Itย isย there, and itย is working.

<ul>
  {% if visit == 'N' %}
  <li>Visit campus</li>
  {% endif %}
  <li>Apply</li>
  <li>Confirm</li>
</ul>

This basic technique of hiding entire elements in the HTML code instead of the contents you see in the default content editor will expand your use of Liquid Markup in Slate. Now you can hide a whole <table>, a single row <tr>, an <img>... the list goes on.