Jekyll Cookbook

Working with Arrays

Define the array

---
layout: post
title:  "Universe"
date:   2019-06-17 10:00:00
planets:
    - mercury 
    - venus
    - earth

Access the array

{% for planet in page.planets %}
    <a href="https://{{planet}}.universe}">{{planet}}</a>
{% endfor %}

Liquid

Links

https://github.com/Shopify/liquid/wiki/Liquid-for-Designers#optional-arguments

Code Snippets

for-loop-sorted-collection

<ul>
    {% assign sorted = (site.collection_name | sort: 'date') | reverse %}
    {% for item in sorted %}
    <li>{{ item.title }}</li>
    {% endfor %}
</ul>
{% for item in site.collection_name reversed %}

Code Snippets and recieps