Plate № 44 · UX · index-page model
A pattern from the gf.cx specimen book
One JSON blob, one sortable shelf
"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 data is one inline blob. A single
<script type="application/json" id="items-data">holds every item —{title, desc, url, date, sec, …}. Nothing about rendering or sorting lives in the page. - The behaviour is one shelf.
new-index.jsreads the blob, renders#list, and wires the toolbars;new-index.cssrefines the pills. A change to either lands on every/new/at once — the edit-the-generator move applied to the index. - The sort is grid-parity. Every sort button is a direction toggle, exactly like the sortable-table headers. Tap an inactive sort to switch to it; tap the active one again to reverse. The active button carries a small ▲ (ascending) / ▼ (descending) glyph, and each key remembers its own direction.
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:
| Key | Sorts by | Default |
|---|---|---|
recent | later of date and updated, so a revised piece re-floats | ▼ newest first |
type | sec (category), then newest within each category | ▲ A→Z of category |
alpha | title | ▲ A→Z |
sequential | plate 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:
- View toggle —
lines(a dense timeline) orcards(a grid with the description showing). Remembered across visits. - Sort keys —
recent·alpha·type·sequential. A page offers only the buttons it wants; the shelf reads the offered keys off the buttons themselves. plate(optional) — a№ 04stamp on numbered pieces (patterns), and thesequentialsort it enables.updated(optional) — an upgraded pill, and the item re-floats to its revision date underrecent.status+tone(optional) — a colouredrec-pillfor records surfaces (home'sdesigned/shipped/gated), tone-keyed to the portfolio palette.sec:"page"— marks an evergreen section hub sorecentfilters it out of the timeline while the other sorts keep it.data-count+data-count-suffix— the item count, reworded per surface ("plates", "records", the default "so far").
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:
assets.gf.cx/new-index/new-index.js— reads#items-data, renders#list, wires the[data-viewbar]/[data-sortbar]toggles, and gives every sort key the ▲/▼ direction toggle with per-keylocalStoragememory. The superset render drawsplate/updated/statusonly when the item carries them.assets.gf.cx/new-index/new-index.css— the pill refinement (squarer corners, slimmer padding, the small.nsi-dirarrow glyph). Scoped.toolbar .pills …so it layers over the page's own base pill styling rather than replacing it.- The sectional-JSON blob —
<script type="application/json" id="items-data">with{title, desc, url, date, sec, plate?, updated?, status?, tone?}items. The one thing each surface actually owns. - The grid-parity direction toggle — the ▲/▼-on-the-active-button affordance, shared verbatim with the sortable-table grids so a sort reads the same whether it's a table or an index.
data-cfasync="false"— on the shelf<script>, so Cloudflare Rocket Loader can never bundle or cache a stale copy (see the shelf-asset discipline).
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· theitems-datablob · the grid-parity ▲/▼ direction toggle ·data-cfasync="false"(all listed above).- Build cost
- One
<link>+ one<script defer>, a#listdiv, the toolbar buttons for the sorts you want, and theitems-datablob. The shelf caches portfolio-wide; a sort or render change propagates from the two files.