diff options
author | Patrick Spek <p.spek@tyil.nl> | 2018-09-20 11:32:56 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2018-09-20 11:32:56 +0200 |
commit | e9365b34190c4a3c54385f963efcf56ecd705112 (patch) | |
tree | 5a0de5c3ae7024cafddf275c1b859699d17d2461 /_pages | |
parent | e847b05ae3bae9cc4134a7b5f5f66f0771edfa9e (diff) |
Add year subheadings in posts overview
Diffstat (limited to '_pages')
-rw-r--r-- | _pages/posts.html (renamed from _pages/posts.md) | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/_pages/posts.md b/_pages/posts.html index b99dec8..3bdf010 100644 --- a/_pages/posts.md +++ b/_pages/posts.html @@ -7,6 +7,7 @@ description: > usually programming, security or privacy related. --- +{% markdown %} ## Blog posts I sometimes write articles to refer to. It saves a lot of time compared to explaining the same thing over and over again. As such, most articles will @@ -29,13 +30,33 @@ I'd also like to note that these articles reflect my opinion, and only mine. Please refrain from accusing other people of holding my opinion for simply being referenced in my articles. -{% for post in site.posts %} -{% if post.wip %} - {% continue %} -{% endif %} -* [{{ post.title }}]({{ post.url }}) <small>{{ post.date | date: "%Y-%m-%d" }}</small> -{% endfor %} - [cc-by-sa]: https://creativecommons.org/licenses/by-sa/3.0/ [home]: / -[pgp]: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x9ACFE193FFBC1F50 +[pgp]: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x7A6AC285E2D98827 +{% endmarkdown %} + +{% for post in site.posts %} + {% if post.wip %}{% continue %}{% endif %} + {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} + {% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %} + + {% if forloop.first %} + <h3>{{ this_year }}</h3> + <ul> + {% endif %} + + <li> + <a href="{{ post.url }}">{{ post.title }}</a> + <small>{{ post.date | date: "%Y-%m-%d" }}</small> + </li> + + {% if forloop.last %} + </ul> + {% else %} + {% if this_year != next_year %} + </ul> + <h3>{{ next_year }}</h3> + <ul> + {% endif %} + {% endif %} +{% endfor %} |