BRAZE LIQUID — 3 Types of Liquid Code — Liquid For Technical Marketers
BRAZE LIQUID — 3 Types of Liquid Code — Liquid For Technical Marketers
🗣️ WATCH FULL YOUTUBE VIDEO HERE 🗣
What’s up everyone, my name is Allan, Founder and Consultant at For Now Marketing, and welcome to LIQUID FOR TECHNICAL MARKETERS!
Today, we’re going to talk about the 3 types of Liquid code. There’s only 3 types of Liquid code, and when we break it down this way, it sounds so simple!
Let’s get started!
#1: Variable
First, we have what’s called a variable.
What exactly is a variable? Think back to your middle school Algebra class where x equaled some value. It’s a very similar concept.
A Liquid variable is assigned a certain value, and we can use that variable to create personalized messages.
A variable is always surrounded by the curly brackets, {{ and }}. Whenever you see curly brackets, you can expect that variable’s value to be rendered in our messages.
BRAZE:
{% assign first_name = “allan” %}
For example, “Hello !” Notice first_name is surrounded by two curly brackets.
On the Liquid documentation page, variables are sometimes referred to as “objects”. But for our program, we’ll refer to them as variables.
#2: Tags
Second, we have tags. I like to think of tags as functions.
Tags are the more advanced type of Liquid code, but the good thing is that there really isn’t too many tags to learn, and each tag is not too complex.
Tags or functions will never render anything themselves, but all the work gets done “in the background”.
Tags are surrounded by a single curly bracket and a percentage symbol, {% %}, like this. I’m sure you noticed the other code when we went over the first_name variable example.
Well, that’s actually called the assign tag, and the assign tag allows us to assign values to variables. The assign tag is how we were able to create a variable called “first_name”.
We’ll talk more about the assign tag many more times throughout our program, so don’t worry if this is still new to you!
#3: Filters
Lastly, we have filters. Filters change the output of a Liquid variable, and Filters cannot stand alone in Liquid and must always be tied to a variable.
For example, did you notice that my first_name, allan, was spelled with a lowercase? When sending an email to a customer, we might want to make sure that their name is capitalized, even if their name is lowercased in our internal database.
Liquid filters allow me to take that variable and put it through a filter so that the first name value gets capitalized. The specific filter we would use is called “capitalize”, and here’s how we use it.
To use a filter, we put a pipeline character | after our variable name, before the closing brackets. For example, “Hello {{ first_name | capitalize }}.
Here, we are using the “capitalize” filter to make sure that our variable is being rendered with the first letter capitalized, even if the variable value itself does not have the first letter capitalized.
Syntax
By the way, all the symbols that we use for coding are called syntax. So curly brackets {{ }} is the syntax for variables, curly bracket percent symbol {% %} is the syntax for tags or functions, and pipeline character | is the syntax for filters.
Thank You!
That’s it for today! Thank you for watching, and see you next time!
allan@fornowmarketing.com
fornowmarketing.com