Skip to content

Commit

Permalink
Add archive page
Browse files Browse the repository at this point in the history
  • Loading branch information
hanju-jo committed Oct 6, 2017
1 parent fe1954d commit 25ea8eb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ navigation:
url: /
- name: About
url: /about
- name: Archive
url: /archive
- name: Tags
url: /tags
- name: Theme
Expand Down
37 changes: 37 additions & 0 deletions archive/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
layout: page
title: Archive
permalink: /archive/
---

<ul class="archive-list">
{% if site.posts.size == 0 %}
<h2>No post found</h2>
{% endif %}
{% for post in site.posts %}
{% unless post.next %}
<h3>{{ post.date | date: '%Y' }}</h3>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
<h3>{{ post.date | date: '%Y' }}</h3>
{% endif %}
{% endunless %}

<li class="archive-list-post">
{% if post.link %}
<a href="{{ post.link }}">
{% else %}
<a href="{{ site.baseurl }}{{ post.url }}">
{% endif %}
<span class="archive-list-post-title">
{{ post.title }}
</span>
</a>
<span class="archive-list-post-date">
<time>{{ post.date | date:"%b %d" }}</time>
</span>
</li>
{% endfor %}
</ul>

0 comments on commit 25ea8eb

Please sign in to comment.