Dynamic Expressions
Here are the most common uses of expressions
How to use variables in layouts ?
You must always precede the name of your variable with "page.".
<div>Your name {{ page.variables }}</div>Conditionals
<if condition="page.firstname">
<div>Hello {{ page.firstname }}</div>
</if><if condition="page.firstname === 'John'">
<div>Hello John</div>
</if>
<elseif condition="page.firstname === 'Joe'">
<div>Hello Joe</div>
</elseif>
<else>
<div>Hello</div>
</else>Loops
Arrays
Objects
Loop props
While inside a loop, you will have access to a special object called {{ loop }}. This object provides you with valuable information about the current loop iteration.
loop.index- the current iteration of the loop (0 indexed)loop.remaining- number of iterations until the end (0 indexed)loop.first- boolean indicating if it's the first iterationloop.last- boolean indicating if it's the last iterationloop.length- total number of items
Switches
Fetch
Raw
If you want to ignore expressions in a block of code
Last updated