Skip to content

Instantly share code, notes, and snippets.

@davatron5000
Last active November 25, 2020 17:09
Show Gist options
  • Save davatron5000/958cb52abe0766b74529e117add7083f to your computer and use it in GitHub Desktop.
Save davatron5000/958cb52abe0766b74529e117add7083f to your computer and use it in GitHub Desktop.
---
layout: default
title: Archives
---
<div class="archive archive--has-year container">
<header class="archive-header">
<h1 class="title">The Archives</h1>
<p class="tags">I like to talk about:
{% for tag in collections.tagList %}
<a href="/tag/{{ tag | | replace: '#', '' | downcase }}">{{ tag }}</a>{% unless forloop.last %}, {% endunless %}
{% endfor %}
</p>
</header>
<ul class="archive-list ">
{% assign year = 'now' | date: 'YYYY'| plus: 1 %}
{% assign posts = collections.posts | where_exp: "item", "item.rss_only != true" %}
{% for post in posts %}
{% assign postyear = post.date | date: 'YYYY' | plus: 0 %}
{% if postyear < year %}
{% assign year = postyear %}
<li class="archive-year">
<h2 class="archive-title">{{ year }}</h2>
</li>
{% endif %}
<li class="archive-{{ post.data.layout }}">
<a href="{{ post.url }}">
<h2 class="archive-title">{{ post.data.title }}</h2>
{% if post.data.tldr %}<p>{{ post.data.tldr }}</p>{% endif %}
<p class="meta">{{ post.date | date }}</p>
</a>
</li>
{% if forloop.index == 4 %}
<li class="advertisement">
{% include ad.html %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment