Created
February 24, 2016 17:29
-
-
Save elliotekj/b0f79a8abf4162e5af45 to your computer and use it in GitHub Desktop.
Example of linkable months and years Typed archive.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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