Lego2012
9/26/2016 - 11:32 PM

Jekyll Casts - Liquid: Looping

Jekyll Casts - Liquid: Looping

<!-- 
In this last example we’ll go over looping in liquid. We’ll create a cupcakes array in front matter then loop over it in liquid and output it in an unordered list. The syntax for a for loop in liquid is for variable in array, variable can named whatever you’d like and holds the item in the current iteration of the loop. 
-->

---
heading: I like cupcakes
show_heading: false
cupcakes:
  - chocolate
  - lemon
  - strawberry
---

<ul>
  {% for cupcake in page.cupcakes %}
    <li>{{ cupcake }}</li>
  {% endfor %}
</ul>