#6: computed News read-time + per-page OG/canonical for hub detail pages
- News card "3 min read" → computed from our own gist (~200 wpm, floor 1). We summarize, so it's honestly ~"1 min read" — the good news in about a minute. - Generalized the build-time head patch (patch-play-head → patch-static-heads): now also rewrites build/word.html, quote.html, onthisday.html so each ships its own <title>/description/canonical/OG/Twitter tags instead of the homepage head + canonical="/". Non-JS scrapers and canonical dedup are correct before these pages are ever un-noindexed. Same fail-loud guard as before. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,11 @@
|
||||
// truncation handled by CSS (-webkit-line-clamp:2) — breaks on whole words, fills 2 full lines
|
||||
let headline = $derived(news?.title ?? 'What went right this week: the good news that actually matters');
|
||||
|
||||
// Honest read-time from our own gist (~200 wpm, floor 1). We summarize, so this is
|
||||
// usually "1 min read" — a feature, not a bug: the good news in about a minute.
|
||||
const readMins = (t) => Math.max(1, Math.round((t || '').trim().split(/\s+/).filter(Boolean).length / 200));
|
||||
let readTime = $derived(`${readMins(news?.summary)} min read`);
|
||||
|
||||
// small-joys shelf: 3 cells shown two at a time, rotated by the reader (no auto-motion)
|
||||
const JOY_ACCENTS = ['#4f7da8', '#b06a86', '#b06a45'];
|
||||
let joyIdx = $state(0);
|
||||
@@ -125,7 +130,7 @@
|
||||
<p class="summary">{news?.summary || "We read the week so you don't have to doomscroll it. Five quietly hopeful stories, summarised to the gist."}</p>
|
||||
</a>
|
||||
<div class="news-foot">
|
||||
<span class="meta">3 min read</span>
|
||||
<span class="meta">{readTime}</span>
|
||||
</div>
|
||||
<hr class="news-div" />
|
||||
<a class="news-more" href="/">Read more good news →</a>
|
||||
|
||||
Reference in New Issue
Block a user