[object Object]

← back to build-pages

home: linkify 'latest YYYY-MM-DD' to its commit detail page + 1 smoke

3d15f8543570570c4455e316009341965393fa9a · 2026-05-13 21:13:19 -0700 · SteveStudio2

Files touched

Diff

commit 3d15f8543570570c4455e316009341965393fa9a
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 21:13:19 2026 -0700

    home: linkify 'latest YYYY-MM-DD' to its commit detail page + 1 smoke
---
 server.js     | 7 ++++---
 test/smoke.js | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/server.js b/server.js
index 094026e..cfa0fc5 100644
--- a/server.js
+++ b/server.js
@@ -351,6 +351,7 @@ app.get('/', async (req, res, next) => {
       const bundle = await getProjectBundle(slug, p).catch(() => null);
       const count  = bundle ? bundle.commits.length : 0;
       const latest = bundle && bundle.commits[0] ? bundle.commits[0].dateISO.slice(0, 10) : '';
+      const latestHash = bundle && bundle.commits[0] ? bundle.commits[0].shortHash : '';
       const ideas  = bundle ? bundle.facets.ideas.length : 0;
       let today    = 0;
       if (bundle) {
@@ -360,7 +361,7 @@ app.get('/', async (req, res, next) => {
           else if (t < todayStartMs) break; // commits are newest-first
         }
       }
-      return { slug, p, count, latest, ideas, today };
+      return { slug, p, count, latest, latestHash, ideas, today };
     }));
     const totalCommits = entries.reduce((a, e) => a + e.count, 0);
     const totalIdeas   = entries.reduce((a, e) => a + e.ideas, 0);
@@ -395,10 +396,10 @@ app.get('/', async (req, res, next) => {
     const dayBuckets = fleetSpark.buckets;
     const last24 = fleetSpark.last24;
     const last7d = fleetSpark.last7d;
-    const rows = entries.map(({ slug, p, count, latest, ideas, today }) => `<li class="bp-card">
+    const rows = entries.map(({ slug, p, count, latest, latestHash, ideas, today }) => `<li class="bp-card">
         <a href="/p/${esc(slug)}"><h2>${esc(p.name)}</h2></a>
         <p>${esc(p.blurb)}</p>
-        <p class="bp-meta">${count} commits · ${ideas} ideas · latest ${esc(latest)}${today > 0 ? ` · <span class="bp-today" title="${today} commits today (PT)">${today} today</span>` : ''}</p>
+        <p class="bp-meta">${count} commits · ${ideas} ideas · latest ${latestHash ? `<a href="/p/${esc(slug)}/c/${esc(latestHash)}" title="open commit ${esc(latestHash)}">${esc(latest)}</a>` : esc(latest)}${today > 0 ? ` · <span class="bp-today" title="${today} commits today (PT)">${today} today</span>` : ''}</p>
       </li>`).join('\n');
     const jsonld = {
       '@context': 'https://schema.org',
diff --git a/test/smoke.js b/test/smoke.js
index 2562173..b60baaa 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -99,6 +99,7 @@ function check(name, cond, hint = '') {
   check('home: velocity line',     /last 24h: <strong>\d+<\/strong>/.test(r.body));
   check('home: delta arrow',       /class="bp-delta bp-delta-(up|dn|eq)"/.test(r.body));
   check('home: per-project today', /class="bp-today"/.test(r.body));
+  check('home: latest-date deep-link', /latest <a href="\/p\/[^"]+\/c\/[0-9a-f]+"/.test(r.body));
   check('home: load badge',        /class="bp-load (bp-load-ok|bp-load-warn|bp-load-hot)"/.test(r.body));
   check('home: 7-day sparkline',   /class="bp-spark"/.test(r.body));
   check('home: deepest rationale rail', /Deepest rationale/.test(r.body));

← f1d86db home: per-project today-PT chip on each project card + 1 smo  ·  back to build-pages  ·  gitignore: exclude *.bak / *.pre-* / *.orig snapshot files 50c56b7 →