Skip to content

Commit cd9462d

Browse files
committed
Adds a Post Archive
Adds a simple page listing all posts on the site split into months
1 parent 14cf39c commit cd9462d

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

_layouts/default.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ <h1 class="site-name"><a href="{{ site.baseurl }}/">{{ site.name }}</a></h1>
3232
<a href="{{ site.baseurl }}/getting-started">Getting Started</a>
3333
<a href="{{ site.baseurl }}/search">Search</a>
3434
<a href="{{ site.baseurl }}/about">About</a>
35+
<a href="{{ site.baseurl }}/archive">Archive</a>
3536
</nav>
3637
</header>
3738
</div>

_pages/archive.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
layout: page
3+
permalink: /archive/
4+
title: Posts Archive
5+
---
6+
7+
8+
<div id="archives">
9+
<section id="archive">
10+
<h3>Most Recent Posts</h3>
11+
{%for post in site.posts %}
12+
{% unless post.next %}
13+
<ul class="this">
14+
{% else %}
15+
{% capture month %}{{ post.date | date: '%B %Y' }}{% endcapture %}
16+
{% capture nmonth %}{{ post.next.date | date: '%B %Y' }}{% endcapture %}
17+
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
18+
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
19+
{% if year != nyear %}
20+
</ul>
21+
<h2 style="text-align:left;">{{ post.date | date: '%Y' }}</h2>
22+
<ul class="past">
23+
{% endif %}
24+
{% if month != nmonth %}
25+
<h3 style="text-align:left;">{{ post.date | date: '%B %Y' }}</h3>
26+
{% endif %}
27+
{% endunless %}
28+
<p><b><a href="{{ site.baseurl }}{{ post.url }}">{% if post.title and post.title != "" %}{{post.title}}{% else %}{{post.excerpt |strip_html}}{%endif%}</a></b> - {% if post.date and post.date != "" %}{{ post.date | date: "%e %B %Y" }}{%endif%}</p>
29+
{% endfor %}
30+
</ul>
31+
<h3>Oldest Posts</h3>
32+
</section>
33+
</div>

0 commit comments

Comments
 (0)