From 33f76cdc3b8e95a1eee3330207af283930b8069a Mon Sep 17 00:00:00 2001 From: drjones Date: Mon, 3 Aug 2026 22:13:16 -0700 Subject: [PATCH] v2: Hero images, tag pages, 16 seed articles, FAL-generated visuals, nginx asset serving --- sites/_engine/app.py | 63 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/sites/_engine/app.py b/sites/_engine/app.py index 21503e5..889ef0d 100644 --- a/sites/_engine/app.py +++ b/sites/_engine/app.py @@ -408,6 +408,20 @@ def sitemap(): return Response(build_sitemap_xml(), mimetype="application/xml") +@app.route("/tag/") +def tag_page(tag): + """Aggregate all articles with a given tag.""" + db = get_db() + rows = db.execute(""" + SELECT * FROM articles WHERE status='published' AND keywords LIKE ? + ORDER BY published_at DESC LIMIT 30 + """, (f"%{tag}%",)).fetchall() + articles = [dict(r) for r in rows] + record_view(f"/tag/{tag}") + return render_template_string(TAG_TEMPLATE, **IDENTITY, + tag=tag, articles=articles, domain=DOMAIN, vertical=VERTICAL) + + # ─── Analytics Collector ────────────────────────────────────────── @app.route("/a/ping") def analytics_ping(): @@ -680,7 +694,8 @@ HOME_TEMPLATE = """ -
+
+

{{ tagline }}

{{ description }}

@@ -688,6 +703,7 @@ HOME_TEMPLATE = """ {{ total_views }} readers Updated daily
+
@@ -1010,6 +1026,51 @@ SEARCH_TEMPLATE = """ """ +TAG_TEMPLATE = """ + + + + {{ tag }} — {{ name }} + + + +
+
+

#{{ tag }}

+

{{ articles|length }} article{% if articles|length != 1 %}s{% endif %}

+ {% for a in articles %} + +

{{ a.title }}

+

{{ a.excerpt[:180] }}

+
{{ a.reading_time }} min read · {{ a.published_at[:10] }}
+
+ {% endfor %} + {% if not articles %} +

No articles tagged "{{ tag }}" yet.

+ {% endif %} +
+ + +""" + NOT_FOUND_TEMPLATE = """