caltoc
caltoc is a mediawiki gadget for my web that replaces the sidebar table of contents on 𝕐 month pages—July (2026) and its like—with a small calendar of the month.
The linear table of contents on such a page is thirty-one nearly identical lines, "1 July (2026)", "2 July (2026)", and so on, each carrying a single bit of information: the day number. A month grid says as much in a fraction of the room, and a few things besides that a list cannot say at all.
- A day that has a section links to it; a day that has none is greyed and inert—either nothing happened, or it has not happened yet.
- Cells are tinted by how many entries the day holds, so the busy stretches of the month show up at a glance. This was not the point of the exercise, but it turned out to be the nicest part of it: the month acquires a texture. There are twelve shades, one per entry up to ten, spaced evenly in lightness so that a day of nine entries is visibly darker than one of eight—blue online, amber here, the local wiki being read on cream.
- Today is ringed, when one is looking at the current month.
- The title reads « ‹ July 2026 › »: the single chevrons step to the neighbouring months, the guillemets to the first and the last month the year has so far, the year goes to 2026, and the month name opens a panel of all twelve months. Everything is checked against the wiki in a single query, so a month not yet written is greyed and does nothing rather than offering to create it.
- Clicking the title bar, anywhere off the links, folds the plain list back out for the occasions when one wants it.
Nothing is done to the wikitext. The calendar is built after render, from the day headings and from the Y-YYYYMMDD-HHMMSS anchors, which already carry their own dates and so give the per-day counts for nothing. Switching the gadget off restores the ordinary table of contents exactly.
One companion change was needed elsewhere: Template:MonthNav now carries . MediaWiki omits the table of contents below four headings, and the skin builds the sidebar only when there is one to put in it, so a thin month—May (2026) has two days—would have had no calendar at all.
Written with Claude Opus 5 on 26 July (2026), and taken up again on 6 August (2026). Version 2.4. The code is at MediaWiki:Gadget-caltoc.js, and it is switched on for everyone in MediaWiki:Gadgets-definition.
Version history
- 1.0 (26 July (2026)) — first version: the grid, the links, the tinting, today's ring, and the fold-back to the plain list.
- 2.0 — the title became navigation, « and » to the neighbouring months, checked against the wiki so that a month not yet written is inert. Layout made considerably more compact.
- 2.1 — flush against the content margin, the centring gap removed and the grid tightened again, so the sidebar costs the page as little width as possible.
- 2.2 (6 August (2026)) — the tinting rebuilt so that small differences show. It had been four buckets three entries wide, which put a day of one entry and a day of three in the same wash and flattened everything from ten upwards into a single shade; since a month here runs from one to sixteen entries a day, most of it was that top shade. Twelve levels now, one per entry up to ten, and the ramp spaced evenly in CIE lightness rather than in opacity, which is what makes consecutive steps tell apart.
- 2.3 — white numbers on the dark cells, which 2.2 had asked for and not obtained. A day one has clicked is a visited link, and the browser's own
a:visited colour outranks a class rule, so precisely the busiest days—the ones one actually goes to—kept a blue number on a near-navy cell. Every rule that paints a link is now written twice, plain and visited. The title bar rebuilt at the same time: ‹ and › for the neighbouring months, « and » for the ends of the year, and the month name opening a panel of all twelve rather than pointing at 2026#July.
- 2.3.1 — the small triangle after the month name removed; the panel opens on a click and does not need to advertise itself.
- 2.3.2 — « and » now go to the first and the last month the year actually has. They had been aimed at January and December, which in a year still being written are usually not there at all, so both guillemets sat greyed and did nothing.
- 2.4 — one palette per wiki. The online wiki keeps the blue; the local one, read on cream inside an orange border, gets the same twelve steps built in amber, from pale yellow to burnt orange. The gadget page is the same on both and the choice is made from the address when the page loads, so a push cannot carry one wiki's colours onto the other.