...
For more information beyond the basics covered here, visit the Liquid Script External Wiki.
Topics
Table of Contents |
---|
maxLevel | 3 |
---|
minLevel | 2 |
---|
indent | 20px |
---|
style | none |
---|
|
Personalization
Date
Code Block |
---|
|
{{ "now"| date: "%m/%d/%Y" }} |
Note: For additional options visit http://strftime.net/
Default
Code Block |
---|
|
{{ Object | default: "My Default" }} |
First, Last, & Email
Code Block |
---|
|
{{ user.firstname }}
{{ user.lastname }}
{{ user.email }} |
User Transactions (Advantage Data Objects)
Code Block |
---|
|
{{ user_transaction.object }} |
Note: For a list of available advantage data objects, please see the Data Object Map.
Whitespace Control
Code Block |
---|
|
<!--If Liquid Script is causing formatting issues, try using the minus sign (-) inside your tags-->
{%- some liquid script -%} |
Assigning a Value to a Variable
Code Block |
---|
|
{% assign my_variable = "some value" %}
<p>This is {{ my_variable }}</p> |
Output:
This is some value
Template and Shared Asset Logic
The following markup examples are shown using the list_code data object mapped from Advantage to Blueshift. You can use any data object available to create dynamic content within a template. You can also use values assigned to variables within other liquid script markup. Liquid script values can be passed between templates and shared assets in both directions. You can also pass values from one shared asset to another as long as both are used within the same template.
Note: When using transaction data in your logic, the list, publication, or product you have starred in your advanced segment will be referenced. For more information, please see Creating Advanced Segments.
Using IF Statements
Code Block |
---|
|
{% if user_transaction.list_code == "ABC" %}
Show ABC content
{% elsif user_transaction.list_code == "XYZ" %}
Show XYZ content
{% else %}
Show default content or warning
{% endif %} |
Using SWITCH Statements
Code Block |
---|
|
{% case user_transaction.list_code %}
{% when "ABC" %}
Show ABC content
{% when "123" or "XYZ" %}
Show 123/XYZ content
{% endcase %} |
Using CAPTURE Statements
Code Block |
---|
|
{% capature introduction %}Hi {{ user.firstname }},<br /> Thank you for subscribing. <b>To login, visit our <a href="https://westora.io">website</a>.</b>{% endcapture %}
{{ introduction }} |
Output:
Hi Jane,
Thank you for subscribing. To login, visit our website.