summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorsoaos <soaos@soaos.dev>2025-11-25 08:30:53 -0500
committersoaos <soaos@soaos.dev>2025-11-25 08:30:53 -0500
commit27e2bc6928666ced9a402f589e56e8fbc9f78f81 (patch)
treeb6a024b530b43651884f4863193bb13051a977da /templates
parent53bbac67cfc300f86d8c836e5f6ce7be1afd7b0e (diff)
Album tree view on about page
Diffstat (limited to 'templates')
-rw-r--r--templates/blog.html10
-rw-r--r--templates/macros.html4
-rw-r--r--templates/shortcodes/album_list.html16
3 files changed, 22 insertions, 8 deletions
diff --git a/templates/blog.html b/templates/blog.html
index f659571..ff44e08 100644
--- a/templates/blog.html
+++ b/templates/blog.html
@@ -15,18 +15,16 @@
<h2>Latest Posts</h2>
<div class="sunken-panel">
<ul class="tree-view" style="height: 8rem; overflow-y: scroll">
- {% set current_year = now() | date(format="%Y") | int %} {% for i in
- range(start=0, end=current_year - 2024) %}
+ {% for year, posts in section.pages | group_by(attribute="year") %}
<li>
<details open>
- <summary><b>{{current_year - i}}</b></summary>
+ <summary><b>{{ year }}</b></summary>
<ul>
- {% for post in section.pages %} {% if post.year == current_year -
- i %}
+ {% for post in posts %}
<li>
<a href="{{post.permalink}}">{{post.title}}</a> - {{post.date}}
</li>
- {% endif %} {% endfor %}
+ {% endfor %}
</ul>
</details>
</li>
diff --git a/templates/macros.html b/templates/macros.html
index ce73ca7..5642fc2 100644
--- a/templates/macros.html
+++ b/templates/macros.html
@@ -50,9 +50,9 @@
</li>
{% endmacro endsubtree %}
-{% macro treelink(text, url, blank=false, wip=false, wip_tooltip="") %}
+{% macro treelink(text, url="", blank=false, wip=false, wip_tooltip="") %}
<li>
- <a href="{{ url }}" {% if blank %} target="_blank" {% endif %} {% if rel %} rel="{{ rel }}" {% endif %}>{{ text }}</a>
+ <a href="{{ url }}" {% if blank %} target="_blank" {% endif %} {% if rel %} rel="{{ rel }}" {% endif %}>{{ text | safe }}</a>
{% if wip %}
<span {% if wip_tooltip %}data-tooltip="{{ wip_tooltip }}" {% endif %}>
<span class="under-construction unselectable">⚠</span>
diff --git a/templates/shortcodes/album_list.html b/templates/shortcodes/album_list.html
new file mode 100644
index 0000000..521b4d1
--- /dev/null
+++ b/templates/shortcodes/album_list.html
@@ -0,0 +1,16 @@
+{% import "macros.html" as macros %}
+{% set data = load_data(path="data/albums.json") %}
+
+{{ macros::treeview(height="32rem") }}
+{% for genre, albums in data.albums | group_by(attribute="genre") %}
+
+{{ macros::subtree(name=genre, open=true) }}
+{% for album in albums %}
+ {{ macros::treelink(text=album.artist ~ " - <i>" ~ album.name ~ `</i><br>
+ <img class="album-thumb" src="/assets/music/` ~ album.cover ~ `"/>`,
+ url="https://musicbrainz.org/release-group/" ~ album.release_group, blank=true) }}
+{% endfor %}
+{{ macros::endsubtree() }}
+
+{% endfor %}
+{{ macros::endtreeview() }} \ No newline at end of file