Introduction to Liquid
How to use Liquid to get the most from Siteglide
Written By Luke Wakefield
Last updated About 19 hours ago
What is Liquid and where can I learn about it?
Think of Liquid as the “recipe” that a server will use to make an HTML “cake”!
Liquid is a templating language (originally created by Shopify) that helps you build out Siteglide functionality. Being a templating language, the idea is not to give Liquid code directly to the browser, as the browser won’t understand it. Instead, think of Liquid as a template, or recipe to generate a document in another language; usually HTML (but in some cases, other useful document types, like CSVs).
Siteglide uses the platformOS implementation of Liquid which significantly improves the language by adding powerful new tags and filters. This makes the platformOS docs the ultimate reference for Liquid:
If our documentation does not yet cover any question you have about Liquid, always go to the platformOS documentation to learn more:
https://documentation.platformos.com/api-reference/liquid/introduction
Having said that, our intention of writing about Liquid here is to provide a user-friendly step-by-step guide to to help you really understand Liquid from the beginning. Once we have added more articles, we aim to get you to the point where you are confident enough to browse the platformOS and Siteglide Liquid references for the ingredients you need and know how to put them together yourself.
Why is it useful to learn and use Liquid?
While Siteglide allows you to write pages in pure HTML, here are some broad situations in which using Liquid will be beneficial:
Using the CMS (Content Management System), databases and other sources of data - Liquid can inject handles of data into the middle of HTML.
DRY (don’t repeat yourself) - If your website contains repeating elements, using Liquid can allow you to write re-usable sections of code, saving you time building and maintaining the site.
Personalisation, searching, querying and filtering - Liquid can deliver relevant information based on the visitor accessing your site.
Using the marketplace and themes - Liquid allows you to easily include code written by Siteglide and the Siteglide Community and modify settings to get the behaviour you need.
Where Can I use Liquid?
Liquid can be used in any of these environments:
Page Templates
Pages
Standard webpages
Processing Incoming Webhooks and API calls
Partials
Sections
Functions
Dynamic Module/WebApp Layouts
Automations
Emails
Sending Outgoing API calls
And more! As we continue to develop Siteglide, there will be more and more places to use Liquid.
Looking for a specific tag/function?
Check out our Siteglide Liquid Reference guide:
And the platformOS reference:
https://documentation.platformos.com/api-reference/liquid/introduction (explore the left hand menu to browse reference topics)
Tutorials
We are currently in the process of re-writing the existing tutorials to add better examples and activities and aim to add more soon.
Liquid Tutorial 1 - Recognising the syntax of tags, outputs and filters
Accessing Data in Liquid Variables - Tutorial 1 - Using Dot Notation
Accessing Data in Liquid Variables - Tutorial 2 - Iterating over Arrays and Objects
Using Collections with WebApps and Modules
Accessing Data from the Global Context Variable
Truthiness - Using Liquid to determine if a field is empty or blank