Test substring using Liquid syntax

I have been reviewing the list of methods available in Liquid syntax.

I wonder if there’s something like {% if link.includes('localhost') %}, similarly to {% if user.user_metadata.lang == 'en' %}

I need to use something like this in my login email template given that two or more different templates cannot be configured for the magic link email.

I just answered myself. Hope it helps someone else:

# string = 'hello world'
{% if string contains 'hello' %}
   string includes 'hello'
{% endif %}

Source: Liquid for Designers · Shopify/liquid Wiki · GitHub

1 Like

Wooohooo! Thanks for sharing it with the rest of community!

1 Like