Jekyll 将上使用 Liquid

根据属性过滤 page

1
{% assign newcars = site.my_collection | where: "category", "new" %}

根据属性排序 page

1
{% assign allcarssorted = site.my_collection | sort: "category" %}

依据属性对 page 分组

1
2
3
4
5
6
7
8
{% assign groups = site.my_collection | group_by: "category" | sort: "name" %}

{% for group in groups %}
    {{ group.name }}
    {% for item in group.items %}
        {{item.abbrev}}
    {%endfor%}
{%endfor%}

遍历所有 collection

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{% for coll in site.collections %}

label : {{ coll.label }} <br/>
output : {{ coll.output }} <br/>

  {% for doc in coll.docs %}

  &nbsp;&nbsp; - doc.title : {{ doc.title }}<br/>
  &nbsp;&nbsp; - doc.url : {{ doc.url }}<br/>
  &nbsp;&nbsp; - doc.path : {{ doc.path }}<br/>
  &nbsp;&nbsp; - doc.date : {{ doc.date }}<br/>

  {% endfor %}
<br/><br/>
{% endfor %}