This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.html
47 lines (44 loc) · 1.87 KB
/
archive.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
layout: page
title: "Blog Archive"
site_title: The Adamant Programming Language
sitemap:
ignore: true
---
<div id="archive">
{% assign drafts = site.posts | where_exp: "post", "post.draft == true" %}
{% for post in drafts %}
{% if forloop.first %}<h1>Drafts</h1>{% endif %}
{% assign post_year = post.date | date: "%Y" | to_integer %}
{% assign post_month = post.date | date: "%B" %}
{% if post_year != current_year or post_month != current_month %}
{% unless forloop.first %}</section></ul>{% endunless %}
<section class="month">
<h2>{{post_month}} {{post_year}}</h2>
<ul>
{% endif %}
<li><a href="{{post.url}}" class="internal">{{post.title}}</a></li>
{% assign current_year = post_year %}
{% assign current_month = post_month %}
{% if forloop.last %}</section></ul>{% endif %}
{% endfor %}
<h1>Blog Archive</h1>
{% comment %} clear out current year and month, still set from drafts loop {% endcomment %}
{% assign current_year = null %}
{% assign current_month = null %}
{% assign posts = site.posts | where_exp: "post", "post.draft != true" %}
{% for post in posts %}
{% assign post_year = post.date | date: "%Y" | to_integer %}
{% assign post_month = post.date | date: "%B" %}
{% if post_year != current_year or post_month != current_month %}
{% unless forloop.first %}</section></ul>{% endunless %}
<section class="month">
<h2>{{post_month}} {{post_year}}</h2>
<ul>
{% endif %}
<li><a href="{{post.url}}" class="internal">{{post.title}}</a></li>
{% assign current_year = post_year %}
{% assign current_month = post_month %}
{% if forloop.last %}</section></ul>{% endif %}
{% endfor %}
</div>