Group all posts by year

master
Michael Rose 2014-02-26 15:48:56 -05:00
parent 31b07c1f55
commit d0bf3106c8
2 changed files with 23 additions and 13 deletions

View File

@ -6,17 +6,27 @@ description: "An archive of posts."
---
{% for post in site.posts %}
<article class="hentry">
<header>
<div class="entry-meta"><span class="entry-date date published"><time datetime="{{ post.date | date_to_xmlschema }}"><a href="{{ site.url }}{{ post.url }}">{{ post.date | date: "%B %d, %Y" }}</a></time></span><span class="author vcard fn"><a class="url fn" href="{{ site.url }}">{{ site.owner.name }}</a></span>{% if site.disqus_shortname and post.comments %}&nbsp; &bull; &nbsp;<span class="entry-comments"><a href="{{ site.url }}{{ post.url }}#disqus_thread">Comment</a></span>{% endif %}</div><!-- /.entry-meta -->
{% if post.link %}
<h1 class="entry-title"><a href="{{ site.url }}{{ post.url }}" rel="bookmark" title="{{ post.title }}"><i class="icon-double-angle-right"></i></a> <a href="{{ post.link }}">{{ post.title }}</a></h1>
{% else %}
<h1 class="entry-title"><a href="{{ site.url }}{{ post.url }}" rel="bookmark" title="{{ post.title }}">{{ post.title }}</a></h1>
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
{% if forloop.first %}
<article>
<h2 id="{{ this_year }}-ref">{{ this_year }}</h2>
<ul>
{% endif %}
<li class="entry-title"><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
{% if forloop.last %}
</ul>
</article>
{% else %}
{% if this_year != next_year %}
</ul>
</article>
<article>
<h2 id="{{ next_year }}-ref">{{next_year}}</h2>
<ul>
{% endif %}
{% endif %}
</header>
<div class="entry-content">
<p>{% if post.description %}{{ post.description }}{% else %}{{ post.content | strip_html | strip_newlines | truncate: 120 }}{% endif %} <a href="{{ site.url }}{{ post.url }}">Continue reading</a></p>
</div><!-- /.entry-content -->
</article><!-- /.hentry -->
{% endfor %}

View File

@ -20,7 +20,7 @@ description: "An archive of posts sorted by tag."
</ul>
{% for tag in site.tags %}
<article class="hentry">
<article>
<h2 id="{{ tag[0] }}">{{ tag[0] }}</h2>
<ul>
{% assign pages_list = tag[1] %}