Files
esh-pfi-infrastructure/stacks/news-digest/templates/digest.html.j2
T
vh 28cb96c087 news-digest: separated SOURCE / REDDIT THREAD action chips + archive page
Two requested polish items:

1. Reddit items now show TWO distinct action chips in the footer:

     [↗ SOURCE huggingface.co]  [⌥ REDDIT THREAD]      3h · u/foo

   Previously the external link was a tiny dot-separated text link
   that visually competed with the post metadata. Now: explicit
   labeled buttons, distinct colors (cyan for source, blue for
   thread), with hover states that match the Australis accent
   palette. Non-Reddit items get just the SOURCE chip.

2. Archive page at /archive.html — lists every edition-*.html on
   disk, newest-first, sorted PM-before-AM within a day. Each row
   is the date in editorial serif + an AM/PM chip color-coded
   (yellow morning / cyan evening) + a hover-affordance arrow.
   Header link from the main edition reads "ARCHIVE →".

   Generation: digest.py walks OUTPUT_DIR for the edition-*.html
   filename pattern on every run, sorts, renders archive.html.j2,
   writes atomically. Cheap (~1ms even with hundreds of editions).
   No retention cap — twice-daily for a year is ~700 small files,
   well under any reasonable concern.

CSS additions: .action chip styles (with per-action color variants),
.archive-link in masthead, full .archive-row + .archive-edition
treatment.
2026-04-26 13:48:58 -07:00

214 lines
8.7 KiB
Django/Jinja

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Daily Digest · {{ date_long }} · {{ edition_short }}</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
{# ────── header ────── #}
<header class="masthead" role="banner">
<div class="masthead-inner">
<div class="masthead-brand">
<span class="brand-glyph" aria-hidden="true">◢</span>
<span class="brand-mark">DAILY DIGEST</span>
</div>
<div class="masthead-edition">
<span class="edition-num">№ {{ generated_at.strftime("%j") }}</span>
<span class="edition-stamp">{{ edition|upper }} EDITION</span>
<a class="archive-link" href="archive.html">ARCHIVE →</a>
</div>
<div class="masthead-meta">
<div class="meta-row">
<span class="meta-label">FILED</span>
<span class="meta-value">{{ date_long|upper }} · {{ time_short }} {{ tz }}</span>
</div>
<div class="meta-row">
<span class="meta-label">DESK</span>
<span class="meta-value">SUBREDDITS · TECH FEEDS</span>
</div>
<div class="meta-row">
<span class="meta-label">CURATED BY</span>
<span class="meta-value">{{ model }}</span>
</div>
</div>
</div>
{# A thin aurora-glow rule under the masthead — the only sanctioned
Australis gradient. #}
<div class="aurora-rule" aria-hidden="true"></div>
</header>
{# ────── nav strip ────── #}
<nav class="jumpnav" aria-label="sections">
<ol>
{% if reddit_sources %}
<li><a href="#reddit"><span class="jump-num">01</span> REDDIT</a></li>
{% endif %}
{% if tech_sources %}
<li><a href="#tech"><span class="jump-num">02</span> TECH FEEDS</a></li>
{% endif %}
</ol>
</nav>
<main class="brief">
{# ────── REDDIT SECTION ────── #}
{% if reddit_sources %}
<section id="reddit" class="desk">
<header class="desk-head">
<span class="desk-num">01</span>
<h2 class="desk-title">Reddit</h2>
<span class="desk-sub">top of last {{ generated_at.hour < 14 and "12" or "12" }} hours · score-filtered</span>
<span class="desk-count">{{ reddit_total }} items</span>
</header>
{% for src in reddit_sources %}
<article class="source">
<header class="source-head">
<a class="source-name" href="{{ src.href }}" target="_blank" rel="noopener">
{{ src.name }}
</a>
<span class="source-count">{{ src.items|length }}</span>
</header>
<ol class="items">
{% for it in src.items %}
<li class="item" data-tag="{{ it.tag }}">
<div class="item-rail" aria-hidden="true">
{% if it.score %}
<span class="chip chip-score" title="upvotes">▲ {{ it.score }}</span>
{% endif %}
{% if it.comments %}
<span class="chip chip-comments" title="comments">{{ it.comments }} ⌥</span>
{% endif %}
{% if it.tag and it.tag != 'other' %}
<span class="chip chip-tag chip-tag-{{ it.tag }}">{{ it.tag }}</span>
{% endif %}
</div>
<div class="item-body">
<h3 class="item-title">
<a href="{{ it.url or it.permalink }}" target="_blank" rel="noopener">{{ it.title }}</a>
</h3>
{% if it.tldr %}
<p class="item-tldr">{{ it.tldr }}</p>
{% endif %}
<footer class="item-foot">
<div class="item-actions">
{% if it.url and it.url != it.permalink %}
<a class="action action-source" href="{{ it.url }}" target="_blank" rel="noopener">
<span class="action-arrow">↗</span>
<span class="action-label">SOURCE</span>
<span class="action-domain">{{ it.url|domain }}</span>
</a>
{% endif %}
<a class="action action-thread" href="{{ it.permalink }}" target="_blank" rel="noopener">
<span class="action-arrow">⌥</span>
<span class="action-label">REDDIT THREAD</span>
</a>
</div>
<div class="item-meta-row">
<span class="item-meta">{{ it.posted_at|humanago }} ago</span>
<span class="sep">·</span>
<span class="item-meta">u/{{ it.author }}</span>
</div>
</footer>
</div>
</li>
{% endfor %}
</ol>
</article>
{% endfor %}
</section>
{% endif %}
{# ────── TECH FEEDS SECTION ────── #}
{% if tech_sources %}
<section id="tech" class="desk">
<header class="desk-head">
<span class="desk-num">02</span>
<h2 class="desk-title">Tech Feeds</h2>
<span class="desk-sub">non-reddit · last {{ generated_at.hour < 14 and "12" or "12" }} hours</span>
<span class="desk-count">{{ tech_total }} items</span>
</header>
{% for src in tech_sources %}
<article class="source">
<header class="source-head">
<a class="source-name" href="{{ src.href }}" target="_blank" rel="noopener">
{{ src.name }}
</a>
<span class="source-count">{{ src.items|length }}</span>
</header>
<ol class="items">
{% for it in src.items %}
<li class="item" data-tag="{{ it.tag }}">
<div class="item-rail" aria-hidden="true">
{% if it.tag and it.tag != 'other' %}
<span class="chip chip-tag chip-tag-{{ it.tag }}">{{ it.tag }}</span>
{% endif %}
</div>
<div class="item-body">
<h3 class="item-title">
<a href="{{ it.url }}" target="_blank" rel="noopener">{{ it.title }}</a>
</h3>
{% if it.tldr %}
<p class="item-tldr">{{ it.tldr }}</p>
{% endif %}
<footer class="item-foot">
{% if it.url %}
<div class="item-actions">
<a class="action action-source" href="{{ it.url }}" target="_blank" rel="noopener">
<span class="action-arrow">↗</span>
<span class="action-label">SOURCE</span>
<span class="action-domain">{{ it.url|domain }}</span>
</a>
</div>
{% endif %}
<div class="item-meta-row">
<span class="item-meta">{{ it.posted_at|humanago }} ago</span>
{% if it.author %}
<span class="sep">·</span>
<span class="item-meta">{{ it.author }}</span>
{% endif %}
</div>
</footer>
</div>
</li>
{% endfor %}
</ol>
</article>
{% endfor %}
</section>
{% endif %}
{% if not reddit_sources and not tech_sources %}
<section class="desk empty">
<p class="empty-msg">
No items cleared the filters in the last window.<br>
Lower <code>DIGEST_MIN_SCORE</code> or widen
<code>DIGEST_REDDIT_HOURS</code> if this looks wrong.
</p>
</section>
{% endif %}
</main>
<footer class="colophon">
<div class="colophon-inner">
<div class="colophon-block">
<span class="meta-label">FILED</span>
<span class="meta-value">{{ generated_at.isoformat(timespec="seconds") }}</span>
</div>
<div class="colophon-block">
<span class="meta-label">NEXT EDITION</span>
<span class="meta-value">{{ next_edition|upper }} · 12 H</span>
</div>
<div class="colophon-block">
<span class="meta-label">PIPELINE</span>
<span class="meta-value">REDDIT JSON + MINIFLUX → {{ model }} → JINJA2</span>
</div>
</div>
</footer>
</body>
</html>