summaryrefslogtreecommitdiff
path: root/archives.md
diff options
context:
space:
mode:
Diffstat (limited to 'archives.md')
-rw-r--r--archives.md23
1 files changed, 8 insertions, 15 deletions
diff --git a/archives.md b/archives.md
index 647633b..cfe07ce 100644
--- a/archives.md
+++ b/archives.md
@@ -5,23 +5,16 @@ title: Archives
# Archives
-* * *
-
-{% for post in site.posts %}
-{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
-{% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
-{% if forloop.first %}
-
-## {{ this_year }}
+---
-{% endif %}
+{% assign posts_by_year = site.posts | group_by_exp: "post", "post.date | date: '%Y'" %}
-- {{ post.date | date: "%Y/%m/%d" }} - [{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}]({{ post.url }})
+{% for year in posts_by_year %}
-{% if forloop.last %}
-{% else %}
-{% if this_year != next_year %}
+## {{ year.name }} (共 {{ year.items | size }} 篇)
-## {{next_year}}
+{% for post in year.items %}
+- {{ post.date | date: "%Y/%m/%d" }} - [{{ post.title }}{% if post.layout == "encrypt" %} [加密]{% endif %}]({{ post.url }})
+{% endfor %}
-{% endif %} {% endif %} {% endfor %}
+{% endfor %} \ No newline at end of file