Skip to main content
Liquid
Carlos Solis avatar
Written by Carlos Solis
Updated over a week ago

Liquid is a language that we use in Modyo Platform to display content from the Content module in your Sites. You can generate templates for your entries that will display dynamically as users navigate your site, also you are able to control what to show using flow control and iteration commands.

In Liquid, like many programming languages, you have to use reserved words to display dynamic content. This calls are available “just-in-time” so you are only loading content when you need to. If you have a variable {{ name }} in a page, when a user enters this page, the variable will be replaced with the value for “name” during runtime.

Objects

An object is what contains the content that Liquid displays on the screen. You can display objects or variables using double curly braces {{ }}, for example:

To display the name of an entry in your page:

{{ entry.meta.name }}

Tags

With Tags you can add flow control and iteration to your pages. You need to encapsulate the language with a curly brace and percentage {% %} to make use of Tags.

If

You can use if to only show content if a condition is true, for example if a user enters the product “Digital Bank”, the following message is shown:

{% if product.name == "Digital Bank" %}
Download our digital bank app for all your banking needs!
{% endif %}

For

You can use a for to add iteration to your pages. For example if you want to display a list of all your entries, you can use:

{% for entry in entries %}
<p>{{ entry.meta.name }}</p>
{% endfor %}

Drops

Modyo extends the features of Liquid through the use of variables called Drops, created specifically for Modyo Platform. We offer drops in 20 different categories for all the platform’s modules.

You can find more examples on how to use Liquid in our documentation and to see all the drops we offer, see Drops.

Did this answer your question?