Plate № 44 · UX · index-page model

A pattern from the gf.cx specimen book

One JSON blob, one sortable shelf

Source · Dan, 2026-09-10 · noticed while re-reading the /new pages

"I thought we built a sorting-mechanism with arrows up/down so it would toggle between last/first." … "This is a set of unified patterns for building sectional-JSON /new with sorting — we should add it to the library." … "Bundle up all the varying elements that make it digestable."

The problem

A surface earns a /new/ index the moment it has more than a handful of dated pieces — a "what's new" list the reader scans to find the latest. Each one is simple on its own: a little JSON of items, a couple of view/sort buttons, a render loop. So each surface grew its own copy, inlined in that page's <script>. And they drifted. Happiness and growth carried one flavour of the loop; brand a namespaced variant; patterns a third with an extra sequential sort and a plate badge; home a fourth that rendered a status pill per record. The sort affordance drifted worst of all — one page toggled newest/oldest with a text link, another had no direction control at all, and none matched the ▲/▼ direction arrow the sortable-table grids already used two clicks away. Four hand-rolled indexes is the opposite of a system.

The model, in-page

Collapse the four copies into one shelf. The page carries only its data and its buttons; the behaviour comes from two shared files. Three moves, applied together:

The demo below is the real thing — it loads the actual new-index.css and new-index.js from the shelf and drives them off an inline blob. Toggle the view, tap a sort, then tap it again to flip the arrow.

The sort — a direction toggle, per key

The affordance is the sortable-table grid header, brought to the index. Each sort key has a natural default direction, and the active key shows which way it currently runs:

KeySorts byDefault
recentlater of date and updated, so a revised piece re-floats▼ newest first
typesec (category), then newest within each category▲ A→Z of category
alphatitle▲ A→Z
sequentialplate number — only where the surface numbers its pieces▲ №01→N

Tap an inactive key to switch to it in its default direction; tap the active key again to reverse it. Direction is remembered per key (localStorage), so flipping recent to oldest-first doesn't disturb how alpha will run when you next reach for it. Only recent drops the evergreen section-landing hubs (sec:"page"); every other sort keeps them, because on an A–Z or by-category view a section hub is a legitimate destination.

The varying elements, bundled

The reason the four copies drifted is that each surface needed a little more than the last. The shelf ends the drift by carrying the superset — every field renders only when the item declares it, so one file serves all surfaces without any of them hand-rolling a variant:

Where it applies

Reach for this on any surface whose front matter is a running list of dated pieces the reader scans latest-first: an essay index, a changelog, a records board. Reference implementations, all now on the one shelf: happiness, growth, brand, patterns (with the plate badge + sequential sort), home (with the records status pills), and the two catalogue surfaces vault and library. Add a surface by writing its items-data blob and linking the two files — never by copying another surface's script.

Reusable elements

Named, copyable pieces — lift any one without the others:

Reference

Source
Dan, 2026-09-10 — while re-reading the /new/ pages ("I thought we built a sorting-mechanism with arrows up/down"; "bundle up all the varying elements that make it digestable").
In use / example
happiness · growth · brand · patterns · home · vault · library — all on the one shelf.
Reusable elements
new-index.js · new-index.css · the items-data blob · the grid-parity ▲/▼ direction toggle · data-cfasync="false" (all listed above).
Build cost
One <link> + one <script defer>, a #list div, the toolbar buttons for the sorts you want, and the items-data blob. The shelf caches portfolio-wide; a sort or render change propagates from the two files.