summaryrefslogtreecommitdiff
path: root/templates/archives.html
diff options
context:
space:
mode:
authoreatradish <[email protected]>2022-04-09 19:34:05 +0800
committereatradish <[email protected]>2022-04-09 19:34:05 +0800
commit4165b2c0d86d1e3f47a7caf9a086798e51315f3b (patch)
tree095511e33c1eeab5a7888f73a41e06de1155478f /templates/archives.html
downloadSeje2-4165b2c0d86d1e3f47a7caf9a086798e51315f3b.tar.gz
Seje2-4165b2c0d86d1e3f47a7caf9a086798e51315f3b.tar.bz2
Seje2-4165b2c0d86d1e3f47a7caf9a086798e51315f3b.zip
init
Diffstat (limited to 'templates/archives.html')
-rw-r--r--templates/archives.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/templates/archives.html b/templates/archives.html
new file mode 100644
index 0000000..e691c86
--- /dev/null
+++ b/templates/archives.html
@@ -0,0 +1,28 @@
+{% extends "base.html" %}
+
+{% block content %}
+<section class="archive">
+ <ul class="post-archive">
+ {# Group the posts by year #}
+ {% set map = get_section(path="_index.md") | get(key="pages") | group_by(attribute="year") %}
+ {% set_global years = [] %}
+ {# Convert the years map to an array (since maps do not have determined order) #}
+ {% for year, ignored in map %}
+ {% set_global years = years | concat(with=year) %}
+ {% endfor %}
+
+ {% for year in years | sort | reverse %}
+ <div class="years">
+ {% set posts = map[year] %}
+ <div class="year">{{ year }}</div>
+ {% for post in posts %}
+ <li class="post-item">
+ <span class="post-date">{{ post.date | date(format="%m/%d") }}</span>
+ <a href="{{ post.permalink }}" class="post-title">{{ post.title }}</a>
+ </li>
+ {% endfor %}
+ </div>
+ {% endfor %}
+ </ul>
+</section>
+{% endblock %}