From c7b3d013b4cd2ee7e4da81d09763a5015b8089b0 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Sat, 18 Jan 2025 16:51:44 +0100 Subject: [PATCH] feat: display featured tags --- .vscode/settings.json | 3 + example_config.json | 11 +- templates/tag.html | 300 +++++++++++++++++++++++++++++++++++++++++ templates/threads.html | 51 +++++-- threads.py | 68 +++++++--- 5 files changed, 394 insertions(+), 39 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 templates/tag.html diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..da0fcb8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cSpell.words": ["masto"] +} diff --git a/example_config.json b/example_config.json index 9570538..d6a0267 100644 --- a/example_config.json +++ b/example_config.json @@ -2,13 +2,16 @@ "APPS": { "threads": { "site_name": "Thoughts", - "title":"Thoughts", + "title": "Thoughts", "description": "Hand-picked public posts from my social feed", - "server" : "https://social.ayco.io" + "server": "https://social.ayco.io", + "user": "user@mastodon.social", + "password": "ultraelectromagneticpassword", + "secret_file": "threads-masto-client.secret" } }, "ATTRIBUTION": { - "owner": "Author Name", - "year": "2024" + "owner": "Author Name", + "year": "2024" } } diff --git a/templates/tag.html b/templates/tag.html new file mode 100644 index 0000000..4690eac --- /dev/null +++ b/templates/tag.html @@ -0,0 +1,300 @@ + + + + + + + {{ app.title }} + + {% if threads|length == 1 %} + + + {% else %} + + + {% endif %} + + + + + + + + + + + + + + +
+ {% include "nav.html" %} +

{{ app.title }} / #{{ tag }}

+

{{ app.description }}

+
+
tag
+ + + + + \ No newline at end of file diff --git a/templates/threads.html b/templates/threads.html index 6caa49a..4577c5c 100644 --- a/templates/threads.html +++ b/templates/threads.html @@ -66,6 +66,17 @@ border-bottom-right-radius: 0; } + main { + & ul.tags { + list-style: none; + padding-left: 0; + + & li { + display: inline + } + } + } + main { display: grid; gap: 1em; @@ -266,24 +277,38 @@ {% include "nav.html" %}

{{ app.title }}

{{ app.description }}

+
+ {% if tags is defined%} + + {% endif %} - {% for thread in threads %} - {% with thread=thread, parent_id=thread.id, is_thread=threads|length > 1 %} - {% include "card.html" %} - {% endwith %} - {% if thread.descendants is defined %} - {% for descendant in thread.descendants %} - {% with thread=descendant, parent_id=thread.id %} - {% include "card.html" %} - {% endwith %} - {% endfor %} - {% endif %} - {% endfor %} - Top +
+ Featured threads: + {% for thread in threads %} + {% with thread=thread, parent_id=thread.id, is_thread=threads|length > 1 %} + {% include "card.html" %} + {% endwith %} + {% if thread.descendants is defined %} + {% for descendant in thread.descendants %} + {% with thread=descendant, parent_id=thread.id %} + {% include "card.html" %} + {% endwith %} + {% endfor %} + {% endif %} + {% endfor %} + Top +