This will sort a collection by the front matter variable date
then iterate
through the sorted collection:
{% assign items_sorted = site.items | sort: 'date' %}
{% for item in items_sorted %}
<a href="{{ item.url }}">{{ item.title }}</a>
{% endfor %}
To sort in reverse order, use | reverse
:
{% assign items_sorted = site.items | sort: 'date' | reverse %}
{% for item in items_sorted %}
<a href="{{ item.url }}">{{ item.title }}</a>
{% endfor %}