Skip to content

Instantly share code, notes, and snippets.

@elliotekj
Created February 24, 2016 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotekj/b0f79a8abf4162e5af45 to your computer and use it in GitHub Desktop.
Save elliotekj/b0f79a8abf4162e5af45 to your computer and use it in GitHub Desktop.
Example of linkable months and years Typed archive.
{% extends 'partials/base.html' %}
{% block title %}
{{ super() }}
{{ meta.title }} · {{ site.title }}
{% endblock title %}
{% block content %}
{{ super() }}
<div class="row">
<div class="entry-single entry-page">
{% for year, year_posts in posts|groupby('published_at.year')|reverse %}
{% for month, month_posts in year_posts|groupby('published_at.month')|reverse %}
<p class="archive-month" id="{{ month_posts[0].published_at|date(format='%B%Y') }}">{{ month_posts[0].published_at|date(format='%B %Y') }}</p>
{% for post in month_posts %}
<article class="archive-item">
<h2 class="post-title"><a href="{{ post.url }}" rel="bookmark">
{% if post.title %}
{{ post.title }}
{% else %}
{{ post.published_at|date(format='%B %-d at %H:%M') }}
{% endif %}
</a></h2>
</article>
{% endfor %}
{% endfor %}
{% else %}
<p>No posts</p>
{% endfor %}
</div>
</div>
{% endblock content %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment