Loops and Conditionals
Loops and conditionals add tremendous power for your templates to behave differently in different situations. It’s important to understand exactly what tools you have available, so you can make your templates as efficient as possible.
Conditional statements are a foundation of basic programming. They allow you to react to varying circumstances in your websites data environment in a simple, flexible way.
Liquid provides many advanced ways to compare your objects and variables when using conditionals. Comparing items is a mix of conditions and contexts, and knowing all your options can give you lots of different ways to test and vary your templates.
Liquid allows you to loop over arrays or collections of data. Loop over children, labels, blog posts, or navigation elements easily.