feat: update posts page

This commit is contained in:
Devin Haska 2024-02-23 12:13:05 -08:00
parent 2d4ff7b11c
commit c4705a142c
2 changed files with 11 additions and 3 deletions

View file

@ -1,5 +1,5 @@
{% macro list(posts) %}
<ul class="[ list-none p-0 flow mt-1 mb-0 flow-space-0.25 ]">
<ul class="[ flow list-none m-0 p-0 flow-space-0.25 ]">
{% for post in posts %}
<li class="[ flex flex-wrap column-gap-1 row-gap-0 ]">
<div>

View file

@ -4,9 +4,17 @@ permalink: /posts/index.html
title: Posts
---
{% from "macros/posts.njk" import list %}
<h1>All posts</h1>
<p>
Browse all of my posts, or narrow things down <a href="/tags">via tags</a>.
</p>
{% set items = collections.post | reverse %}
{% include "partials/archive.html" %}
{% set itemsByYear = collections.post | reverse | organizeByDate %}
{% set years = itemsByYear | keys | sort("desc") %}
<section class="[ flow ]">
{% for year in years %}
{% set itemsInYear = itemsByYear[year] %}
<h2>{{ year }}</h2>
<div class="[ items ] [ flex-col gap-0.25 ]">{{ list(itemsInYear) }}</div>
{% endfor %}
</section>