2 Collate_posts helper. Collated posts by year and month.
4 1) assign the 'posts_collate' variable to a valid array of posts.
5 2) include JB/posts_collate
7 {% assign posts_collate = site.posts %}
8 {% include JB/posts_collate %}
11 Posts are displayed in reverse chronological order.
12 For normal chronological order:
13 1) Change the for loop to this:
14 => 'for post in site.posts reversed'
15 2) Next make sure to change 'post.previous.date' to:
20 {% if site.JB.posts_collate.provider == "custom" %}
21 {% include custom/posts_collate %}
23 {% for post in posts_collate %}
24 {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
25 {% capture this_month %}{{ post.date | date: "%B" }}{% endcapture %}
26 {% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
27 {% capture next_month %}{{ post.previous.date | date: "%B" }}{% endcapture %}
29 {% if forloop.first %}
30 <h2>{{this_year}}</h2>
31 <h3>{{this_month}}</h3>
35 <li><span>{{ post.date | date: "%B %e, %Y" }}</span> » <a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a></li>
40 {% if this_year != next_year %}
42 <h2>{{next_year}}</h2>
43 <h3>{{next_month}}</h3>
46 {% if this_month != next_month %}
48 <h3>{{next_month}}</h3>
55 {% assign posts_collate = nil %}