From a0ba466b9e9b3fe02f55f83919210789eae399cb Mon Sep 17 00:00:00 2001 From: Mole Shang <135e2@135e2.dev> Date: Sun, 5 May 2024 00:12:46 +0800 Subject: templates/{archive,taxonomy}: refactor and enforce a coherent style --- sass/_partial/_archive.scss | 4 ++-- sass/_partial/_taxonomy.scss | 12 ++++++++++++ sass/style.scss | 1 + templates/taxonomy_list.html | 32 ++++++++++++++++++++++++++------ templates/taxonomy_single.html | 12 +++++++----- 5 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 sass/_partial/_taxonomy.scss diff --git a/sass/_partial/_archive.scss b/sass/_partial/_archive.scss index 49ac32e..6fce40a 100644 --- a/sass/_partial/_archive.scss +++ b/sass/_partial/_archive.scss @@ -1,6 +1,6 @@ .archive { padding: 0 10%; - border: 1px #ddd; + border: 1px #616161; border-style: solid none none none; .post-archive { list-style: none; @@ -8,7 +8,7 @@ .years { border: 1px #ddd; border-style: none none solid none; - padding-bottom: 0.5em; + padding: 0.5em 0; } .post-item { .post-date { diff --git a/sass/_partial/_taxonomy.scss b/sass/_partial/_taxonomy.scss new file mode 100644 index 0000000..631fb5f --- /dev/null +++ b/sass/_partial/_taxonomy.scss @@ -0,0 +1,12 @@ +.term-name { + color: #fff; + font-size: 125%; + font-style: italic; + text-decoration: none; +} + +.term-name-heading { + border: 1px #616161; + border-style: solid none none none; + padding: 0.5em 0; +} diff --git a/sass/style.scss b/sass/style.scss index 53e334f..38aa9b7 100644 --- a/sass/style.scss +++ b/sass/style.scss @@ -28,4 +28,5 @@ body { @import "_partial/_post"; @import "_partial/_archive"; @import "_partial/_normalize"; +@import "_partial/_taxonomy"; @import "_partial/_term" diff --git a/templates/taxonomy_list.html b/templates/taxonomy_list.html index 9182c43..222711c 100644 --- a/templates/taxonomy_list.html +++ b/templates/taxonomy_list.html @@ -1,12 +1,32 @@ {% extends "base.html" %} {% block content %} -
-

Tags

-
+
{% for term in terms %} -
#{{ term.name }}
+
    + {# Group the posts by year #} + {% set map = term.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 %} +
    + {% set posts = map[year] %} +
    {{ year }}
    + {% for post in posts %} +
  • + + {{ post.title }} +
  • + {% endfor %} +
    + {% endfor %} +
{% endfor %} -
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html index 9dbf19f..dec55cc 100644 --- a/templates/taxonomy_single.html +++ b/templates/taxonomy_single.html @@ -9,20 +9,22 @@ {% set pages = term.pages %} {% endif %}
-
{{ term.name }}
+
+ #{{ term.name }} +
{% for post in pages %}
{{ post.title }}
- {{ post.summary | safe }} - More + {{ post.summary | safe }} + More
{{ macros::post_meta(post=post, chinese_date=config.extra.seje_chinese_date, expand=false) }}
{% endfor %} -{# {{ paginator.next }} #} + {# {{ paginator.next }} #}
{% if paginator %} {% include "paginator.html" %} {% endif %} -{% endblock %} +{% endblock %} \ No newline at end of file -- cgit v1.2.3