Skip to content
all entries

Keeping My Now Page Current on a Static Site

I added a Now page, then asked how to keep Tinkering and Writing current without maintaining two more lists. They now select published content during the build. The useful distinction was between rebuilding the page and changing the work it describes: an automated rebuild should not make an old update look new.

I added a Now page to this website, then asked whether Tinkering could follow my recent work and Writing could preview recently published posts. Keeping separate lists by hand would give me two more places to forget an update.

Both sections now select from the site's existing content during the build. Tinkering takes the latest three devlogs; Writing takes the latest three blog posts, including their summaries and existing image previews. The filter happens before sorting and taking the first three:

posts.filter(({ draft, date }) => {
  const due = Date.parse(date) <= buildTime
  return draft !== true && due
})

That second condition matters on a static site. A future-dated post stays out of these lists until a build runs after its date. The browser is serving exported HTML, so crossing midnight alone does not refresh the page.1

I also kept the Updated label tied to the latest date among the manual update and the selected content. Rebuilding the same material should not make it look as though I did new work. The manual section remains editable; the content lists reuse what I already publish.

The change is merged. The production export checks covered list order, summaries, links and the new route. This does not turn publication dates into a live activity tracker: an edit that keeps its old content date will keep that date here too.

Footnotes

  1. Next.js static exports run Server Components during the build. ↩