Skip to content

Commit

Permalink
Create posts.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Error257 authored Jun 2, 2022
1 parent bd7426e commit 53c0fe5
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions posts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
layout: page
title: posts | Error257
---

<section>
{% if site.posts[0] %}

{% capture currentyear %}{{ 'now' | date: "%Y" }}{% endcapture %}
{% capture firstpostyear %}{{ site.posts[0].date | date: '%Y' }}{% endcapture %}
{% if currentyear == firstpostyear %}
<h3>This year's posts</h3>
{% else %}
<h3>{{ firstpostyear }}</h3>
{% endif %}

{%for post in site.posts %}
{% unless post.next %}
<ul>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
</ul>
<h3>{{ post.date | date: '%Y' }}</h3>
<ul>
{% endif %}
{% endunless %}
<li><time>{{ post.date | date:"%d %b" }} - </time>
<a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}">
{{ post.title }}
</a>
</li>
{% endfor %}
</ul>

{% endif %}
</section>

0 comments on commit 53c0fe5

Please sign in to comment.