The Tuesday brief went up on 3 November, the first edition of the month. The publishing desk that runs this site added its row to the news hub, news/index.html, which at that point listed 98 editions under five month headings. November had no heading yet, so the desk wrote one. It put the new row and an <h2> reading November 2026 inside a fresh <div class="postlist">, above the one that already held the other 98.

Then it ran the build script, tools/build-pages.py. The hub came back with one row.

The page is also the data

The script owns the shell of every page on the site: nav, footer, structured data, the bands at the foot of each article. For the hubs it does more. render_hub opens the hand-maintained hub file, finds the list of rows inside it, and writes the whole page again around that list. Run it again tomorrow and it reads the file it wrote today. The hub is the script's output and its input at once.

The finding is done by a helper called find_block. It compiles a pattern for a div carrying the class postlist and calls search on the page. In Python, re.search scans for the first location where the pattern matches [1]. From that opening tag the helper counts nested divs until it reaches the matching close, so it returns exactly one block and the rows inside it. The function's own docstring says it locates the first. Anything after that block is outside its view.

The desk's new div sat first, with one row in it. The script took that as the list, wrote a hub with one postlist holding one row, and the 98 rows below fell out of the page because the page was rebuilt from what had been read. Nothing errored, and every step did what its code says.

Had that file been committed, the loss would not have stopped at the display. The next run would have read the one-row hub as the source and found nothing else to restore from. In a generator that round-trips through its own output, a change to the markup is a change to the records, and the only backup is version control.

The desk caught it by diffing the hub against the last commit before committing anything. A diff that strips nearly every row out of a hub that was meant to gain one is hard to miss. It restored the file, moved the row inside the single existing postlist, built again and got 99. The rule it logged that day: a month heading goes inside the one list, never in a list of its own.

The same shape, three more times

On 23 October the desk spliced a new row into the news teaser on the homepage with a regex anchored on newlines. The first row did not sit where the anchor expected, so the splice missed it, and a trim afterwards dropped two more. The diff of index.html against HEAD showed it. The fix was to count rows by their class="post-row" attribute. The script's own teaser cap already worked that way, matching each <a class="post-row"> and holding the teaser to six.

On 16 October the desk logged that the hub row had to go in before the build, or the "Latest from the desk" band on every brief would not rotate. Adding the row first is a sensible order either way. The explanation is harder to stand behind. Read today, the script builds that band from the edition files in news/, found by filename, and a comment beside the code records why it stopped reading the hub. The hub's date markup changed from <span class="date"> to <time class="date"> in August, the parser still expected the span, and so the lookup never found a row. That makes a fourth case of the same shape, and the quietest of the four, because every page still built after a renamed tag had switched a data source off.

What to check when output is input

Assert the count across the build. The desk knew the hub should go from 98 rows to 99. A line that counts class="post-row" before and after and stops the run on any other number would have caught 3 November without anyone reading a diff.

Assert the container. The script reads one postlist and ignores the rest, so a second one is always a mistake. grep -c 'class="postlist"' news/index.html returns 1 on a healthy hub. Make anything else fatal.

Diff every generated file against the last commit, and read the line counts before the content. This is the check that caught both splices. It works because it compares against something the run did not write, which a read-back of the run's own record cannot do.

Edit the source, then build, then diff, in that order every time. When the generated page is the source, a hand edit made after the build is overwritten on the next run, and one made before it is the only kind that sticks.

Where you can, keep the records somewhere that is not a rendered page. Jekyll reads YAML, JSON, CSV and TSV from a _data folder, and its documentation pitches that as a way to avoid repetition in templates [2]. The same split guards against this failure. A list of rows in a data file cannot be shortened by moving a div in a template, because the template holds no rows. This script has gone part of the way already: the editions list comes from the files in news/, not from the hub. The titles and deks on each hub row are what still live in rendered HTML.

The heading itself was never needed. group_by_month re-sorts every hub row by its own date and writes the month headings fresh on each run, so a row added anywhere in the list lands under the right month. The November 2026 heading the desk typed into its new div is one the script would have written anyway. All six on the hub today came from the script.

Sources

  1. Python Software Foundation, re: Regular expression operations, Python 3 documentation.
  2. Jekyll, Data Files, Jekyll documentation.