Skip to content

This is the multi-page printable view of this section.

Return to the regular view of this page

Design proposals and PRDs

OINK product requirements and designs under review, with the scope of each proposal.
Non-normative material

A proposal describes behavior that may not exist. The contracts, accepted decisions, implementation, and owning checkers define current behavior. Never use a proposal as a configuration reference.

This section contains the authoritative OINK product requirement documents, RFC-style designs, and unresolved maintainer proposals. Do not create a local plan/, plans/, proposal/, or parallel design tree in the theme repository or the documentation repository.

Active proposals

Proposal Current boundary
Local search without Lunr Accepted for v1.6.0. All three stages ship in v1.6.0 (scanning BM25 engine with CJK bigrams, split index with staged loading of page text, and fields as search entries) and now live in the Shell and Components contracts; open tuning questions and a later database backend remain non-normative
Backlinks and knowledge graph G1 (static backlinks) is accepted, implemented on the theme’s main branch, and ships with OINK 0.8.0; the local and global graphs (G2/G3) remain draft
Media convergence Partially implemented; the media-result contract and Landing resource metadata shipped, M3 resolved for native-image processing, retirement (M4) open
Theme roadmap: the Sass exit and the next product stage Draft for R1–R3, drafted 2026-11-21. R0 is accepted for v1.6.0: plain CSS assembled by Hugo with no compiler, SCSS hooks retired, and Bootstrap JS removed; no other stage accepted. Orders the exit from Hugo’s removed LibSass, small reader gaps, version lifecycle, and a static API reference
Content components expansion Accepted and shipped in v1.7.0. All six components — Timeline, Update, Social posts, Video, Audio, and Map — expand the catalog from 21 to 27 components with no new shortcode (quoted social posts use > [!SOCIAL] in v1.8.0), one fence (map), and branches in the image, blockquote, and heading hooks; normative behavior now lives in the Components and Architecture contracts
OINK CLI and the next product stage Independent Go repository and first-stage boundary accepted; local CLI candidate implemented, not publicly released; later theme, migration, adoption, versioning, OpenAPI, and platform stages remain proposals
Visual presets and appearance switching Paper/Slate ship in v1.2.0 and all six presets (paper, slate, github, ink, news, terminal) ship in v1.8.0 (see Ink and Terminal stabilization); GitHub, Ink, News and Terminal remain explicit opt-ins; see the accepted decision and dated acceptance record
Ink and News: the written page and the printed page Written 2026-11-28 and partly implemented in OINK v1.8.0. Ink is the written style (Kai and Fangsong, Palatino, headings at text weight, two inks) and News the printed style (newsprint, rules, one spot color), with gold-on-indigo and darkroom dark modes; Japanese and Korean stacks, a kicker and Blog list columns remain open
oink: preview and multi-version serving Draft PRD (v2 redesign), 2026-11-28. One lean oink binary orchestrating official Hugo for local preview, Git-aware multi-version serving behind Cloudflare CDN (with oink freeze for pre-breaking legacy versions, client-side versions.json, HTTP SEO headers, scoped SQLite FTS5, and Brotli-packed .oink archives for Crib); ACL/auth/comments deferred; would supersede the CLI contract if accepted; nothing is implemented
Spec boards: GitHub-aligned issues in Markdown Draft PRD, second revision, 2026-12-03. A spec content type that keeps GitHub-style issues as numbered Markdown files: GitHub’s seven issue statuses and their categories, issue types, issue fields, the nine default labels, milestones, sub-issues, dependencies and issue templates in front matter. A fixed board layout puts documents such as RULE and ARCH at the top and every issue in one flat issues/ directory; the four-digit number prefix is enforced at creation, on every build and optionally before a merge. Board, Table and Roadmap views are built statically. This Design section is the planned first board (42 numbered records); nothing is implemented
Roles: audience spaces, role switching and version comparison Accepted (v2 revision, 2026-12-04) with a local candidate implementation awaiting release. Native Hugo roles act as autonomous audience spaces: empty matrix sites drop out of navigation and redirect to the role entry, params.ui.roles configures labels, listing and indexing (including automatic empty sitemap.xml), C cycles roles, cross-role links support explicit /<role>/ paths and default-role fallback with unlisted-role leak warnings, roles filters menus/commands/links/versions, prefixed search indexes and unlisted browsing history stay confined, and V opens version Duo View with linked version/language menus; oink-cli mount validation follow-up remains open

Component refinement, unified diagram reading and local search refinement ship in 1.4.0 and now live under accepted decisions. Translation comparison ships in 1.5.0 as an accepted decision; its draft is retired.

The table-reading draft is also retired: the accepted decision and component contract define the narrower, .expand behavior released in OINK 1.4.0.

The bulk agent-index proposal was retired after its outputs were released. Architecture defines the accepted behavior. Agent-ready output gives the user steps. The Book publication proposal was retired after BookManifest and the EPUB/PDF tools were released. The accepted behavior is documented in Architecture and Writing a book; dated downstream adoption evidence is recorded in Consumer evidence. Pending consumer adoption does not keep an upstream design proposal active. Git history retains both proposal drafts.

The generated-configuration-schema proposal completed its lifecycle and was retired: Configuration defines the required behavior, the generated configuration schema decision records the accepted rationale, and Git history retains the draft text.

CLI workspaces and adapters

Explicit workspaces and optional adapters remain in the current reduced CLI. The current contract defines the command boundary, and the R1–R8 and A18 record preserves the historical acceptance evidence. The finite maintenance roadmap remains retired from active navigation.

Where a new PRD goes

Create one English-primary page and its Simplified Chinese peer:

content/docs/design/proposals/<slug>.md
content/docs/design/proposals/<slug>.zh.md

Use explicit, stable English heading IDs in both files. Keep code, keys, paths, versions, and API names unchanged in Chinese. A proposal begins with visible draft status and includes:

  1. status, owner, date, and affected contract surface;
  2. context and evidence;
  3. goals and explicit non-goals;
  4. proposed behaviour and output/accessibility/security boundaries;
  5. compatibility and migration impact;
  6. implementation and owning-checker plan;
  7. acceptance criteria and open decisions;
  8. a decision log for later changes to the proposal itself.

For a large experiment, you may add a dated page under ../research/. Keep temporary logs and generated artifacts outside Hugo content and Git.

Lifecycle

draft proposal
    ├── rejected/superseded → remove from the active tree; preserve Git history
    └── accepted
          ├── implementation + owning checker
          ├── affected EN/ZH contract
          ├── accepted Design decision when rationale is durable
          └── changelog, migration, and user docs when their audiences need them

Acceptance does not make the PRD a second contract. Move accepted behavior to the owning contract, stable rationale to Decisions, and user steps to the applicable guide, then retire the proposal from active navigation.

Review gate

Before implementation, confirm that the proposal does not duplicate an existing shell, resolver, component family, or data authority. If the design changes during implementation, update this bilingual proposal before changing the code. Acceptance requires the focused theme checker and the real documentation site. It also requires rendered EN/ZH, applicable outputs, accessibility checks, and responsive review.

Read-only Studio candidate

Studio is removed from the current CLI on 2026-10-04. Use oink dev, an ordinary editor, and structured inspect/check reports. The R7 record preserves historical acceptance of the earlier browser implementation.

Reviewed editing

General source editing is removed from the current CLI. Guarded new, move, review records, and baseline plans remain. Old editing plans are rejected. The R8 record remains historical evidence rather than the current command API.

1 - Backlinks and knowledge graph

A draft three-stage design to generate backlinks and local or global graph views from ordinary Hugo links.
G1 implemented; G2/G3 remain draft

On 2026-08-27, all G1 open decisions were resolved and G1 (static backlinks) was accepted. The theme’s main branch implements G1, which is included in OINK 0.8.0. The local and global graphs (G2/G3) remain drafts until G1 supplies real-world evidence. Their names and configuration are not public API until acceptance.

Premise

Reverse navigation and a view of connected pages come from the link graph, independently of [[wikilink]] syntax. Hugo already accepts ordinary Markdown links and ref / relref, so OINK can derive a graph from content authors already write, without another parser, Goldmark extension, or authoring syntax.

The first value is backlinks, not visualization. A static inbound-link list is useful without JavaScript and remains readable in print and Markdown, making an interactive graph an optional enhancement to an already complete list.

Goals and non-goals

Goals:

  • derive one language-local link index per build;
  • show deterministic inbound links on a page;
  • optionally show a bounded local neighborhood;
  • optionally publish a whole-site view and a machine-readable graph;
  • preserve ordinary preview when an edited link is stale or incomplete.

Non-goals:

  • introducing [[wikilink]] syntax;
  • indexing external, mailto:, same-page anchor, or self links;
  • executing JavaScript to discover links already present in content;
  • turning a visualization into the only way to navigate;
  • promising perfect extraction from arbitrary shortcode parameters or raw HTML.

Delivery stages

Stage Deliverable Runtime Independent value
G1 Language-local link index and backlink list None Reverse navigation in HTML, Print, and Markdown
G2 Local graph around the current page Existing ECharts plus a small local runtime Spatial view with G1 as the accessible fallback
G3 Global graph page and graph data output Same runtime Whole-site exploration and machine-readable edges

Each stage requires separate acceptance. G1 does not depend on G2. G2 does not require every page to load graph code.

Extraction contract

The proposed index scans source content once per language and records one edge per source/target pair. After removing fenced code and inline code, it extracts ordinary Markdown links and ref / relref, resolves internal pages, and removes fragments for page identity. Self-links are excluded, and repeated references produce only one edge.

The implementation must test at least:

  • duplicate links collapse to one edge;
  • fenced and inline code produce no edge;
  • external, protocol-relative, mail, same-page anchor, and self links are excluded;
  • ref and relref are included;
  • each language produces an independent graph;
  • an unresolved derived edge warns or is reported by the focused checker without making ordinary hugo server unusable.

Raw source scanning has known omissions: it may miss a URL in a custom shortcode parameter or raw <a href>. These omissions must be documented rather than hidden behind a claim of a complete semantic graph.

G1 renders an aside group in the right rail beside the table of contents and taxonomy clouds, placing what points to this page beside what is on this page. The group is expanded by default and shows the first eight entries, with the rest behind a native disclosure so a heavily referenced page cannot occupy the entire rail. The site key params.ui.backlinks is a bare boolean, off by default. A page overrides it with the prefix-free front matter key backlinks, which a section can cascade. Entries sort by stable page path: a language-independent order that naturally groups related paths without a second ordering authority. The group uses ordinary links and is omitted when there are no inbound pages.

G1 silently removes derived edges that it cannot resolve. This is a documented limitation of its role as a local navigation enhancement: site-wide broken-link reports would duplicate existing warnings.

Print and Markdown retain the readable list. RSS omits the list unless feed-level research shows that backlinks improve article feeds without adding unnecessary site navigation.

Interactive graph boundary

G2 uses the locally vendored ECharts graph series, with the current page at the center and its direct inbound and outbound neighbors forming the default depth. A hard node limit prevents unreadable or expensive views. Keyboard focus, text alternatives, reduced motion, forced colors, narrow screens, and print are acceptance requirements rather than later polish.

If JavaScript or ECharts is unavailable, G1 remains complete and visible. Only pages that render a graph load the runtime. The runtime must use the existing feature-bundle key to prevent asset-cache collisions between pages with different features.

Global output

G3 may add a dedicated graph page and an opt-in JSON output. The proposed JSON schema contains a version, language, nodes, and directed edges with stable URLs. It would not expose local file paths or unpublished pages. Generate this output from the same index as G1 and G2 so all three representations remain consistent.

Compatibility and migration

Ordinary Markdown remains unchanged and needs no content migration. Configuration names remain undecided until a prototype proves the minimum required surface. Every interactive or global output is off by default. A static backlink list may be considered separately because it supports local navigation without network access or browser state.

Acceptance criteria

Acceptance requires a focused graph checker, extraction fixtures, and HTML/Print/Markdown goldens. It also requires strict-build negative cases, browser accessibility and responsive tests, and a real bilingual-site build. Measure performance on a representative large site.

Open decisions

All G1 questions are resolved (see the decision log). G2/G3 must resolve these remaining questions:

  1. Does the local graph expose one depth or a tightly capped second depth?
  2. Which page metadata, if any, is useful enough to enter graph JSON?
  3. Is G3 useful enough to justify a new output format before G1 and G2 have production evidence?

Decision log

  • 2026-08-19: Drafted the three-stage design.
  • 2026-08-27: Resolved and accepted G1, scheduled for OINK 0.8.0. G1 is opt-in: the site key params.ui.backlinks is a bare boolean, off by default, and pages override it with backlinks. Shell types do not restrict this policy because it belongs to the site and page. A single stable-page-path sort replaces the section → weight → title chain: one deterministic authority is enough for reverse navigation, while a multi-level sort would introduce a second navigation authority. Unresolvable edges are silently removed, without warnings, as a documented limitation. G2/G3 and graph data output still require production evidence.
  • 2026-08-27: Design review moved the block from the page end to the right rail. Backlinks are page metadata and belong beside the table of contents, while the page end is the reader’s completion zone: share, feedback, provenance, pager, and comments. The rail group limits visible entries to eight, with the rest behind a native disclosure.

2 - Local search without Lunr

A draft that replaces Lunr with one scanning engine, ranks by BM25, and reads CJK text by script instead of by language tag.
Accepted for v1.6.0

Owner: OINK maintainers. Affected contracts: Shell and Components. All three stages are accepted for OINK v1.6.0 and defined normatively in the owning contracts. This page preserves the design rationale, benchmark evidence, and open follow-up questions.

Status and scope

Local search stays what it is: Hugo writes one JSON index per language, and the reader’s browser searches it. A site still turns it on with offline_search: true and needs nothing but the Hugo binary. This proposal changes the engine inside that boundary, in three stages delivered together in OINK v1.6.0.

Stage Change State
1 One scanning engine replaces Lunr and the substring fallback Accepted for v1.6.0
2 A large index is split: a small navigation index loads first, page text follows by size Accepted for v1.6.0
3 Definitions below heading level become searchable entries Accepted for v1.6.0

A database-backed search is a separate, later design. A database backend later states only what this proposal keeps open for it.

Evidence

Measured on 2026-11-23 with Node 26.13 on one machine. Browser numbers will differ.

The engine in 1.5.1 has two paths. Every term is matched as a substring of each field, and ASCII words also go through Lunr for English stemming and spelling. Lunr builds its index over the whole site on the first such word.

Problem in 1.5.1 Measurement
The first English query stalls 271–410 ms on two sites with 1.3–1.7 MB content indexes; 2.5–3.5 s and about 800 MB of heap on a 792-page PostgreSQL manual
Every query is slow on long pages 27–120 ms on those two sites, against an 80 ms input delay; up to 890 ms on the manual, spent mapping excerpt offsets over whole page bodies
Substring matches port returns five pages titled “… Support” first; 435 pages hold the substring, 70 hold the word
Unspaced Chinese finds nothing 7 of 16 queries such as 数据库连接池超时 return no result
A stemmed or corrected hit has no location vaccum finds the VACUUM page with no section and only the page description
Operators are dropped ->> yields no term
Ranking ignores rarity and length Each term weighs the same, and a page counts as one unit however long

Capacity is a second limit. The largest maintained consumers use summary scope because their content indexes exceed the budget; content indexes of 5–10 MB exist. Stage 2 addresses that. Stage 1 does not.

On a maintained 163-page site whose content index was 8.1 MB, stage 2 publishes a 609 KB navigation index (123 KB gzipped) and 7.5 MB of page text (2.4 MB gzipped). First results need the former instead of the whole index. In a browser, creating the engine again when the text arrives takes 64 ms, and a query then takes 3–8 ms.

For stage 3, an experimental conversion of the PostgreSQL manual was built unchanged. Its 7,790 fields per language became entries. A query for work_mem, shared_buffers or autovacuum_naptime opens the parameter’s own entry, and does so from the navigation index alone, before any page text is fetched. That index is 1.7 MB (335 KB gzipped) with the entries in it.

The stage 1 engine, on this site’s content index (166 pages and 1,443 sections per language, about 1.7 MB):

Measure 1.5.1 Stage 1
First English query 198–551 ms 8–19 ms
Median query 5.2–8.7 ms 1.6–2.1 ms
95th percentile 13.4–19.2 ms 3.4–4.1 ms
Expected page in the top five, both scopes 43 of 46 46 of 46

The last row counts the 46 curated queries that name a page, in the summary and content scopes together. Two more expect an empty result and pass in both engines. The three new passes are Chinese queries typed without spaces. On the PostgreSQL manual, creating the engine takes 65–112 ms, a query averages 10–16 ms with a worst case of 32 ms, and retained heap is 19–32 MB. A misspelt word costs about 140 ms once, to collect the site’s vocabulary.

A prototype of the bigram matching was compared with jieba segmentation plus BM25 on the Chinese manual. Over 35 Chinese and mixed queries the two agreed on 82% of the top ten pages. This measures agreement, not quality.

The engine source is 36.7 KB, or 11.6 KB gzipped. The 1.5.1 engine and Lunr together are 42.1 KB and 12.7 KB.

Goals and non-goals

Goals:

  • remove the Lunr dependency and the index it builds in the browser;
  • answer unspaced Chinese, Japanese and Korean queries without a dictionary;
  • match words at word boundaries, and keep identifiers and operators literal;
  • rank with the rarity of a term and the length of a section;
  • locate and highlight every match, including inflections and corrections;
  • add no configuration key, build step, download or language switch.

Non-goals:

  • a segmentation dictionary, WebAssembly, a Web Worker, or a build tool beside Hugo;
  • a synonym file; search_keywords remains the way to add synonyms;
  • folding Traditional and Simplified Chinese; this needs a vendored table and a separate decision;
  • loading part of an index by query; a Hugo-only build cannot shard by term;
  • a remote search provider.

Stage 1: the engine

No index is built. The engine joins all searchable text into one folded string and records where each field of each page and section starts. A query term is located by scanning that string. The scan yields the counts that BM25 needs.

Query analysis

Text is folded with NFKC, lowercased, and whitespace is collapsed. The query becomes pieces in the order typed:

Piece What it is Example
Word Letters or digits of a script that separates words port, репликация, 5432
Identifier A piece holding -, ., /, \, _, : or =; kept whole shared_buffers, --baseURL, /pg/data
Symbol run Two or more characters with no letter or digit ->>, ::
CJK run Consecutive Han, Hiragana, Katakana or Hangul characters 连接池, レプリケーション, 백업

A character’s Unicode script decides its class. The page language never does: an English page may quote Chinese, and a reader may type either. A piece is cut where a CJK character meets a letter or digit, so WAL归档 and WAL 归档 are the same query and pg_upgrade升级 is an identifier and a run. A path such as 文档/搜索.md stays one identifier.

A CJK run of one character is one term. A longer run becomes its overlapping bigrams: 连接池 is 连接 and 接池. Nothing decides where a word ends.

What a page must cover is counted in atoms: each word, identifier and symbol run, and each character of a CJK run. A query holds at most 30 atoms.

A short list of English function words and six Chinese question words still match, at a tenth of the weight, and no page is required to contain them. A query made only of such words is searched as written.

Matching

Every match is exact or loose.

Piece Exact Loose
Word The whole word A longer word it begins; another inflection; one part of an underscore name; the inside of a compound, for words of five or more characters; a correction
Identifier Bounded by non-identifier characters Inside a longer identifier
Symbol run Not next to another operator character Inside a longer operator
CJK bigram Any occurrence —

Inflection uses Porter’s English suffix rules for a–z words. Words of other alphabets match when they share at least four leading characters and differ by at most three trailing ones. A word that holds a digit does not inflect.

Spelling help applies only when the selected scope holds no form of the word. It covers a–z0–9 words of at least five characters, with one edit, or two from eight characters. A transposition is one edit. The three most frequent candidates in the site are searched as whole words. Identifiers are never corrected.

Ranking

A page is a complete match when it covers at least 90% of the query’s atoms by weight. An atom weighs the inverse document frequency of its commonest covering term. A bigram that occurs nowhere in the scope is not required while its characters are covered by other bigrams. An atom that no term can cover stays uncovered, so every page is then a partial match.

Pages are ordered by these keys:

  1. Complete matches hide partial ones. A page covered within one section, together with the page’s own fields, leads a page that needs several sections.
  2. Strength. Each atom takes the strongest match found for it: title 10, keywords 8, tags and categories 6, headings 5, description 3, body 1; a loose match counts 0.7 of its field. Strength is the weighted mean over atoms, multiplied by 1.5 when the pieces are adjacent and in order, and by the page’s search_boost.
  3. The BM25 score of the best section, multiplied by search_boost.
  4. Title, then URL.

Strength depends on where the query was found and never on how often. Repetition therefore reorders pages only within equal strength.

Partial matches are ordered by coverage in tenths, then by the same keys. They keep the matched/total label. A word counts once in it, and a CJK run counts by pairs of characters.

BM25 runs per section with k1 1.2 and b 0.5 over section length in characters. Occurrences are weighted by field, scaled by match quality, and capped at 24 per field. A bigram of a run of n characters weighs n / (2(n − 1)), because the run holds about n/2 words.

Each page still occupies one row and opens its best section.

Excerpts and highlights

The excerpt is the 160-character passage of the best section that shows the most different matches. A result carries the strings that were found, so an inflection or a corrected spelling is highlighted as written in the page. A word is not highlighted inside another word unless it could match there. Normalized matches still map back to the original text.

Stage 2: staged loading

The index template still writes every document with its body. What Hugo publishes depends on the size of that output:

Index size Published files Page text
Up to 2 MiB offline-search-index.<lang>.json, byte for byte as before Inside the index
Above 2 MiB, text up to 8 MiB The index without body, and offline-search-body.<lang>.json Fetched by itself after the index, then added to the results
Text above 8 MiB, or Save-Data The same two files Fetched when the reader chooses “Search page text”, which shows its size

2 MiB is the existing raw budget of one index, so a site within the budget sees no change. The split index holds everything that locates a page: titles, headings with anchors and byte offsets, keywords, taxonomies, descriptions. The body file is a list of {ref, body} entries. Both names are fingerprinted in production.

The palette requests the index on the first search keystroke, as before, and shows its results at once. While the text loads, the status line says so, and an empty result is reported as loading, not as no results. When the text arrives the engine is created again and the reader’s selected row is kept. A failed download offers the same row to retry. Opening the palette alone still requests nothing.

No key is added. offline_search_index remains a manual reduction, and a summary, heading or title index has no body to move. A site template that overrides assets/json/offline-search-index.json is split the same way. The byte budget applies to the index that is fetched first.

Stage 3: searchable entries

Parameters and functions are usually defined in lists, not headings, so the index could not target them. It now records search entries beside headings: any rendered element with an id and a non-empty data-td-search-entry title.

Every anchored field is an entry, from the fields shortcode and from a {.fields} table. Nothing has to be configured or rewritten. A site can mark its own elements the same way, from a shortcode or with a block attribute.

Entries join sections in document order with the same id, title and start, so the index format and the engine are unchanged. The page text is divided among headings and entries in that order. A section that holds entries keeps only the text before the first one, and text inside an entry opens that entry. headings still lists headings only.

field accepts id, so a reference page can keep an established anchor such as guc-work-mem instead of field-work_mem. An unusable value, or one another field already uses, warns and keeps the generated anchor. An id that equals a heading’s is not detected, as with any explicit id.

An entry carries no kind. Nothing displays or filters by one yet, and the field can be added to sections later without breaking a reader.

A database backend later

A later design may add a search provider backed by PostgreSQL. This proposal keeps two things open for it. The index file is complete enough to import as a corpus. The engine returns plain result rows through one call, which a remote provider can also produce once the palette awaits results. Nothing here adds a network request.

Compatibility and migration

Configuration and front matter keys do not change, and an index within 2 MiB keeps its fields. Indexes written by earlier releases still load.

  • The theme no longer ships or loads Lunr, and window.lunr is undefined on OINK pages. A site that used the theme’s copy must load its own.
  • OinkSearchEngine.create takes (documents, maxResults). The Lunr argument is gone.
  • Results add marks and strength. The scale of score and textScore changed.
  • A term no longer matches inside a short word. Queries that relied on port finding support return fewer pages.
  • A contiguous phrase is a multiplier, not a tier. A large search_boost can outrank it.
  • A CJK run no longer has to occur whole. Results that were empty may now be complete or partial matches.
  • An index above 2 MiB has no body in its documents. A tool that read page text from the index must read offline-search-body.<lang>.json and join it by ref.
  • The dialog gains data-td-body-src and data-td-body-bytes when the index is split. offline-search-index.html still returns the index URL.
  • Two strings are added to every locale: ui_search_body_load and ui_search_body_loading.
  • Rendered fields gain data-td-search-entry, and an index holds one more sections item per field. A section that contains fields no longer answers for text inside them; that text opens the field.

Implementation and checks

Owner Check
Theme tests/js/search-engine.test.js for analysis, matching, ranking, excerpts and the published Porter examples; check-search.py for the built index and ranking on it
Theme check-palette.py, check-navigation-contract.py and check-runtime-isolation.py assert that no page loads Lunr
Theme check-vendor.py after removing the Lunr artifact, license and tree entry
Theme check-search.py builds a probe above 2 MiB: one language is split, the other is not, section offsets address the separated text, and the dialog names the file and its size
Theme tests/js/command-palette.test.js for results before the text, the loading state, the reader’s request, Save-Data, and retry after a failed download; check-i18n.py for the two strings
Theme check-search.py for field and custom entries on the built index: order, titles, offsets, skipped invalid entries and their warning, and opening a field by name; check-content-primitives.py for the id parameter and its fallbacks
Site tests/search/queries.json with scripts/check-search-corpus.mjs, which can time an older engine with --baseline-engine and --baseline-lunr
Site Palette browser tests for composition, scope, partial state and keyboard use

User guides and the license table have been updated for v1.6.0 alongside the normative contracts.

Acceptance and open decisions

The stages are accepted for OINK v1.6.0: the theme checks, real-corpus checks in both summary and content scopes, and the documentation site’s check and browser targets pass against them. This site’s index is within the 2 MiB budget, so stage 2 is exercised by the theme’s probe and unit tests and by larger consumer corpora.

Open decisions (deferred beyond v1.6.0):

  1. Are the weights right? Field worth, the loose factor, the phrase multiplier, and b come from a 48-query set and one large manual, not from labeled relevance.
  2. Should partial matches follow complete ones when few pages are complete?
  3. Should offline_search default to on? Nearly every maintained consumer sets it.
  4. Should Traditional and Simplified Chinese fold together?
  5. Do Arabic and Hebrew prefixes need a rule of their own?
  6. Is 8 MiB the right limit for loading page text unasked? It is a first choice, not a measured one.
  7. Should an entry carry a kind, and should a result show it?

Decision log

  • 2026-11-23: Accepted all three stages for OINK v1.6.0; promoted behavior into the Shell and Components contracts and updated user guides and license inventory.
  • 2026-11-23: Drafted. Chose scanning over an inverted index after measuring 1–8 ms per term over 12 MB of text. Chose bigrams over Intl.Segmenter, which split 数据库连接池超时 into six fragments and varies by browser, and over a dictionary, whose 5 MB cannot ship with a theme. Rejected segmenting the query against the site’s own text after it proved unstable.
  • 2026-11-23: Implemented stage 3. An entry is one more item of sections, so neither the index format nor the engine changed. The marker is an attribute any markup can carry; fields set it themselves. The planned kind was left out because nothing would read it.
  • 2026-11-23: Implemented stage 2. The split happens at the existing 2 MiB budget, so compliant sites publish the same bytes. The index template stays the only author of documents, because five consumer sites override it; the split is derived from its output. Page text is not requested when the palette opens, which keeps the rule that commands never cost a download.
  • 2026-11-23: Implemented stage 1 in the theme’s working tree. Ranking moved from the weakest field needed to a weighted mean of field strengths after a curated query regressed. A phrase became a multiplier after it lifted low-scoring research pages over the canonical one.

3 - Media convergence

A draft for the remaining convergence between content images, numbered figures, Landing media, and featured-image selection.
Partially implemented

The theme’s main branch implements M1 (the shared media-result contract) and M2 (Landing resource metadata). M3 is resolved as option 2. Only native Markdown images support processing. The full fig source form remains a container. Its parameter list deliberately excludes command/options. M4 (compatibility retirement) remains open until consumers are inventoried. The sections below retain the original design record.

Current baseline

The content image hook, numbered fig, cards, and galleries resolve local page resources, section resources, global assets, static files, and explicit remote URLs through content/image-resolve.html. Raster resources can supply intrinsic dimensions and processed derivatives. data-td-image-zoom marks HTML Zoom eligibility, and the build-time detector checks only this theme-emitted marker.

Standalone Markdown images can combine a caption or Book numbering with processing and a link. Numbered image figures share td-figure and td-book-figure semantics. Landing media uses the shared URL trust policy, while featured images deliberately use a ranking resolver because they select a representative image rather than render one explicit source.

Remaining problem

The shared safety boundary is stronger than the shared media model. Landing media does not obtain the same page-resource metadata and processing result as body images. Featured-image selection and explicit image resolution return different result shapes, some compatibility class names remain in markup, and Book’s full fig form cannot express every processing option that the native image hook supports.

The design question is therefore no longer “replace seven image entry points,” but whether the remaining surfaces can share a small result contract without erasing their different semantics.

Goals and non-goals

Goals:

  • define one normalized media-result shape for URL, source URL, dimensions, alternative text, attribution, processability, and external status;
  • let explicit content images, Landing media, and representative images reuse that shape where their source semantics overlap;
  • keep figure markup and Zoom eligibility single-owned;
  • decide whether the full fig form needs processing or whether authors should use the native image form for processed numbered images;
  • retire compatibility markup only after consumer evidence and a release note.

Non-goals:

  • adding a third-party lightbox or remote image service;
  • changing image Zoom from opt-in to site policy by accident;
  • giving galleries a new caption, sequence, or carousel model;
  • merging non-image Book targets such as tables, equations, and examples into an image-only base class;
  • making featured-image ranking identical to explicit image resolution.

Proposed phases

M1 — Result contract

Document the fields that the content and representative-image resolvers return, then extract their shared fields into one internal media-result contract. Source ranking stays in the featured resolver and source resolution in the content resolver. This internal refactor must preserve output bytes.

M2 — Landing resource metadata

Allow Landing items to resolve eligible local resources through the media contract, gaining intrinsic dimensions and the shared URL/security decision. Explicit width and height in Landing data retain precedence. Remote and static sources remain valid without claiming metadata for a processable resource.

M3 — Full figure capability decision

Choose one of two answers:

  1. add processing arguments to the full fig source form and normalize them through the same processing helper; or
  2. keep processing exclusively on native Markdown images and document full fig as the container for arbitrary numbered block content.

No implementation should leave both options half-supported. In both forms, Markdown/LLMS must consistently link to the documented source or derivative.

M4 — Compatibility retirement

Before removing old image-element classes or attributes, inventory downstream CSS and JavaScript. If a compatibility name is still used, retain it for a documented release window. Alternatively, migrate the owning site in the same release.

Safety, output, and accessibility

  • Image URLs keep the shared scheme and remote-host policy.
  • Missing required alternative text warns and renders a decorative fallback only where the current contract permits it.
  • Width and height never claim metadata that an SVG, static file, or remote source did not provide.
  • Linked images are not Zoom targets; the runtime preserves dialog focus, keyboard close, reduced motion, and narrow-screen containment.
  • Print, Markdown, RSS, and LLMS strip interaction markers while retaining the intended image, caption, attribution, number, and link.

Acceptance criteria

For each phase, collect byte-level HTML and Markdown evidence. Run content and Landing resolver tests, URL/security checks, image-processing tests, and Book target checks. Run gallery/Zoom browser tests and real-site EN/ZH narrow-screen review. Acceptance requires an explicit M3 capability choice.

Open decisions

  1. Is one shared result struct enough, or would a common lower-level URL/resource record keep resolver ownership clearer?
  2. Should Landing consume resource attribution, or only dimensions and URL?
  3. Does full fig processing solve a real consumer need now that native images support numbering, captions, links, and processing together?
  4. Which emitted compatibility names are still used by real consumers?

4 - Theme roadmap: the Sass exit and the next product stage

A draft roadmap that puts leaving Hugo’s removed LibSass first, then closes small reader gaps, version lifecycle, and a static API reference.
Draft roadmap for R1–R3; R0 accepted for v1.6.0

This page proposes an order of work and records the evidence behind it. R0 is accepted for OINK v1.6.0: the stylesheet is plain CSS that Hugo assembles, with no compiler and nothing generated in Git; see R0. Beyond that, the page defines no configuration key, output, or component. Every name below is provisional until its stage is accepted and moved to the owning contract.

Record Value
Status R0 accepted for v1.6.0 (compiled-CSS delivery decided 2026-11-22, plain CSS verified 2026-11-23, Bootstrap JS removed 2026-11-23). R1–R3 remain draft and unaccepted
Owner OINK maintainers
Date 2026-11-21
Scope OINK theme and documentation site; the CLI only where a stage names it
Affected contracts Architecture (toolchain, styles, outputs), Components, Shell, and customization guides
Source snapshot Theme HEAD 49b5648 plus uncommitted work, documentation HEAD 3472785, local Hugo Extended 0.169.0

Recommendation

Make the next theme release about one thing: leaving LibSass without asking consumers to install Dart Sass. Hugo v0.170.0 removed LibSass and the extended edition. When this roadmap was drafted, OINK was pinned to 0.169.0, the last release that can build published v1.5.1, and its contract forbade the only upstream replacement. R0 shipped in OINK v1.6.0: the stylesheet is plain CSS, nothing compiles it, and no Hugo release is pinned.

After that, close what is half-built: first the small reader and author gaps that other frameworks treat as baseline, then version lifecycle, then a static API reference. Keep one content-model project active at a time, as the CLI roadmap already requires.

Stage Subject Why in this position
R0 Sass exit and the Hugo 0.170 baseline Forced by upstream. It blocks every later upgrade
R1 Small reader and author gaps Low cost and frequent use. No new authority
R2 Version lifecycle Already the default next content capability. Upstream changed its premise
R3 Static OpenAPI reference API content is absent from search and agent outputs
Continuing Agent output and engineering quality Finishes existing work. Adds no service

Context and evidence

Hugo 0.170 removes LibSass

Hugo v0.170.0, published on 2026-11-13, states that the extended edition is gone and that Dart Sass is the only transpiler. Setting transpiler to libsass returns an error. hugo.IsExtended always returns false, and module.hugoVersion.extended is deprecated and does nothing. Sass users must install Dart Sass separately.

Published v1.5.1 compiles two stylesheets through toCSS with the built-in compiler: scss/main.scss in head-css.html and scss/redoc.scss in scripts.html. The toolchain contract says that ordinary consumers must not install Dart Sass or another Sass executable, and that later changes must preserve that boundary. For v1.5.1, both statements cannot hold on Hugo 0.170.

According to the survey below, Docsy 0.17.0 and Doks 2.0 chose to require Dart Sass. This review did not build OINK on Hugo 0.170.

What the theme styles depend on

Measured on the theme checkout on 2026-11-21:

Fact Value
Theme-owned SCSS About 16,600 lines under assets/scss/
Distinct --td-* custom properties 185
Sass variable references 147, to 55 variables
Mixin calls 50, of which 39 are Bootstrap media-breakpoint-*
@extend rules 15
Bootstrap 5.3.8. The full SCSS is imported, and bootstrap.bundle.js is loaded for dropdowns

At that date the theme already expressed most of its design through custom properties. Its remaining Sass use was narrow, but Bootstrap’s palette was still computed by Sass at compile time.

Two local trials set the boundary of the options below:

  • Dart Sass 1.105.2 did not compile the SCSS source of that date. It stopped at the nested @import 'chroma/dark' in _chroma.scss and reported that every @import rule is deprecated and will be removed in Dart Sass 3.0.0. Changing the transpiler would therefore also have required source changes.
  • On Hugo 0.169.0, with neither Node nor Sass on PATH, css.Build bundled @import, expanded hugo:vars into :root custom properties, lowered native nesting for the given browser targets, and preserved @layer. Hugo alone can therefore bundle plain CSS.

How consumers use the SCSS hooks

bin/update-consumers.py inventories 51 primary checkouts, 45 of them on v1.5.1. Their hook files were measured on 2026-11-21:

Measure Checkouts
Carry a non-empty _styles_project.scss 46 of 51
Use no mixin, @extend, control rule, or Sass variable in it 38 of 46
Use // comments 44 of 46
Use nested rules 40 of 46
Use &-suffix selector concatenation 16 of 46
Call a mixin 6 of 46
Set Sass variables in a variables hook 18 of 51

The style hooks total about 26,000 lines; the largest has 1,893. None calls a Sass color function. The variables hooks mostly set $primary, $secondary, the four status colors, $line-height-base, and font families.

Most hook content is plain CSS written with Sass comments and nesting. It is still not valid CSS: // comments and &-suffix concatenation need a mechanical conversion. Eight files need real Sass semantics. Any Sass exit that ignores these hooks breaks nearly every consumer.

A later check found a second dependency. pgsty.com, pigsty.cc and pigsty.io compiled seven SCSS entries in their own templates that imported the theme’s partials directly.

What other frameworks ship

Capability Seen in OINK today
Per-page Markdown, llms.txt, full-text bundles, page actions Mintlify, Fumadocs, Rspress, Docsy 0.15 (experimental) Shipped, with NAVJSON and an agent-docs scorecard in CI
Nested or per-section llms.txt for large sites Mintlify, Fern One index per language; full text per top-level section
Blocks shown only to people or only to agents Mintlify, GitBook None
Copyable prompt block Mintlify, GitBook None
Page status badge in navigation Material for MkDocs, Starlight None
Inserted, deleted, and focused lines in code Expressive Code, Fumadocs, VitePress None; fences have title, copy, wrap, collapse, and line options
Glossary with hover definitions Material for MkDocs, Mintlify None
Dismissible site announcement Material for MkDocs, Hextra, Fumadocs None
Related pages Mintlify Backlinks only
Visible fallback for a missing translation Starlight The language switch targets the language home page
Version switch that stays on the equivalent page; outdated banner Mintlify, Docusaurus Docsy-style version menu and archived-version banner
One searchable page per API operation Mintlify, Fumadocs, Scalar Swagger UI or ReDoc embed; other outputs link to the specification
Output with no inline script Relearn 9 Inline startup scripts; the deployment guide explains hashes and nonces

The Hugo statements above were read from the release page and function reference, and the two trials were run locally. The other rows come from a survey of each project’s own documentation and changelog on 2026-11-21. They were read through a summarizing tool and not checked row by row, so confirm a row again before a stage depends on it.

Hugo itself added relevant capabilities since v0.153.0: a site matrix of languages, versions, and roles, with sites.complements to lend existing pages to another site without writing new output. Content adapters can generate pages from local data. R1 to R3 below must evaluate these before freezing a format.

What already works

As of OINK v1.7.0, the theme has 30 shortcodes (29 when drafted), 22 Landing sections, Book publication, Duo View, visual presets, static backlinks, and local search with mixed CJK and Latin terms. Its static agent outputs are more complete than most open-source frameworks in the survey. Community issues mostly ask for correctness and reading comfort, not for more component families. R1 therefore concentrates on those gaps.

Goals and non-goals

Goals:

  • build OINK with a current Hugo release and no other executable;
  • give every existing consumer a tested migration path for its style hooks;
  • close baseline reader and author gaps with static, semantic output;
  • complete version lifecycle and API reference so their content reaches search, Print, Markdown, and agent outputs;
  • keep every theme-owned network feature off by default.

Non-goals:

  • requiring Dart Sass, Node, or the OINK CLI for an ordinary build;
  • a hosted assistant, MCP server, analytics backend, or signed-in content;
  • a visual editor or a new reading shell;
  • type-aware code hover, page narration, or an API testing platform;
  • interactive graph views (G2/G3) before the stages above ship.

R0: the Sass exit

Options

Option What a consumer needs Assessment
A. Require Dart Sass A second executable on every machine, CI job, and container Rejected by the current dependency contract
B. Stay on Hugo 0.169.0 Nothing Not durable. No later upstream fix can be adopted
C. Publish compiled CSS; customize with custom properties and plain CSS Hugo only Chosen on 2026-11-22 and delivered first
D. Rewrite the theme source as plain CSS before anything else Hugo only Same consumer result as C. Doing it first would have delayed the upgrade, so it followed C as the next step and removed the maintainer-side compiler

Decision and delivered design

On 2026-11-22 the owner chose option C: ship compiled CSS, retire the SCSS hooks, and adjust the sites that compiled theme SCSS themselves. That first delivery kept SCSS as the source and committed the compiled bundles, so a maintainer still needed LibSass. The source was then converted to plain CSS, which is option D taken as the next step, and the compiler was removed. Both steps are accepted for OINK v1.6.0. The contract is Plain CSS stylesheet delivery.

Item State
Stylesheet source Done. Plain CSS layer files under assets/css/td/, listed in cascade order by layouts/_partials/css/layers.html. assets/scss/, the vendored SCSS, the compiled bundles under assets/oink/ and bin/build-css.py are deleted. Nothing generated is kept in Git
Consumer build Done. css/bundle.html concatenates the layers with resources.Concat; templates call no compiler and there is no build step. The stylesheet is not passed through css.Build: it needs no bundling, and css.Build would have to treat every font URL as external
Site layer Done. assets/css/project.css and assets/css/project/*.css, plain CSS, published as one stylesheet after the theme’s. Hugo minifies it and does not transform it
Sass variables Done differently from the draft. No token derivation was added. A site restates the values its variables produced as plain overrides in project.css. In the theme, values that were Sass variables are written out in the layers
Site-owned shells Added. A layout asks css/bundle.html for chrome, landing, search or compare by name. These replace the SCSS partials that pgsty.com, pigsty.cc and pigsty.io compiled in their own templates
Compiler Closed. There is no compiler, for a site or for a maintainer, so the question of replacing LibSass with Dart Sass no longer arises
Hugo 0.170 baseline Site builds verified on Hugo 0.170.1 on 2026-11-22 with only the Hugo binary, and again on 2026-11-23 after the conversion. No Hugo release is pinned: checks use the installed one, CI installs the current one, and any edition works. theme.toml and hugo.yaml still declare 0.169.0 as the minimum
Owning checker bin/check-stylesheets.py replaces bin/check-scss.py
Bootstrap reduction Script done, styles open. The theme no longer loads Bootstrap’s JavaScript; see the 2026-11-23 entry below. Reducing the styles is not part of this delivery. Each Bootstrap component is now its own layer file under assets/css/td/bootstrap/

Neither step changed how pages look. After the first delivery, for a site without style hooks, the production stylesheet equaled the previous one except for whitespace inside one @starting-style block. The conversion to plain CSS changed no rule: on 2026-11-23, with Hugo 0.170.1, the production main stylesheet was byte-identical (556,437 bytes) to the last one compiled from Sass, and the regression fixture’s 683 output files were identical apart from the stylesheet path. The four smaller stylesheets now reuse main’s layers, so they gained selectors, but no rule or declaration changed.

Compatibility and migration

The three SCSS hooks were public surface, so retiring them is a breaking change. This release ships as v1.6.0 on the v1 module path (github.com/pgsty/oink) with the breaking changes documented upfront in the changelog and upgrade guide.

  • Hooks are converted by hand; the upgrade guide lists the steps. A site’s rules now load after the theme, so they beat later theme rules of equal specificity, most visibly the visual presets. A converted site is therefore compared page by page.
  • A one-time converter was written during this delivery and then removed, together with the Sass override layer it compiled through, so the theme keeps no legacy Sass path. Before its removal, on 2026-11-22, a dry run over the 46 inventoried hook files reported no failed check, and each of the 51 inventoried checkouts was copied, converted where it still had hooks, and built against the new theme on Hugo 0.170.1 with only the Hugo binary: 50 built, 55,020 pages in all, with no stylesheet warning. The remaining one, pgsty.com, timed out fetching its own remote report manifest in that harness and built completely in a separate run.
  • pgsty.com, pigsty.cc and pigsty.io were adjusted by hand. After the first delivery, on 2026-11-22, their rebuilt stylesheets reproduced every declaration of the old compiled ones, and four of the seven were byte-identical after minification. They now ask for the smaller stylesheets by name.
  • Classic themes/oink consumers and vendored copies follow the same path and are reviewed separately, as the release process already requires.
  • The theme no longer contains SCSS that a site could compile for itself. A site that wants to change Bootstrap overrides the corresponding custom properties and rules in its project stylesheet. The theme does not invoke a compiler and keeps no legacy Sass path.

The remaining consumers convert when they adopt the release. Until then a site that still carries hooks builds with a warning and the theme’s default styles.

R1: small reader and author gaps

Each item is independent, opt-in where it adds markup, static in HTML, expanded in Print, and plain text in Markdown and agent outputs. Names are provisional.

Item Proposed behavior Main constraint
Page status A front matter value such as new, beta, or deprecated marks the sidebar row and article header Closed vocabulary, 32 locales. NAVJSON v1 is a closed schema and stays unchanged
Line markers in fences Fence attributes mark inserted, deleted, and focused lines Attributes, not in-source comments, so Copy still returns authored source
Glossary One data file per language defines terms; an explicit reference renders a definition on hover and focus, and a glossary page is generated No automatic scan of page text in the first stage
Announcement One site-level notice, dismissible, shown again when its text changes Visible without JavaScript; absent from Print, Markdown, and feeds
Related pages A page-end group from Hugo’s related-content index, or an explicit front matter list Sits beside backlinks without a second navigation authority
Missing-translation fallback A language may show the source-language page with a visible notice Never silent. The page declares its real language and canonical URL
Not-found suggestions The 404 page suggests near matches from the local search index Only when local search is enabled. No network
Sortable tables An author marker adds column sorting to the table reader Not a default; authored order stays in other outputs

Related pages cover most of what a local graph view would add. G2 and G3 in the knowledge-graph proposal therefore stay deferred.

R2: version lifecycle

The CLI roadmap keeps the detailed draft. This roadmap adds one requirement: before the manifest format is frozen, evaluate Hugo’s native version dimension against independent per-version builds.

The evaluation must answer:

  1. Can a version dimension coexist with the existing params.versions menu and external archives?
  2. What do build time and output size cost for several versions in two or more languages?
  3. Does the native dimension give page correspondence without a separate logical key?
  4. How are canonical URLs, search indexes, and agent bundles scoped to one version?
  5. Which new schema version carries version identity, given that NAVJSON v1 is closed?

Reader-side targets are unchanged from the CLI roadmap and gain two from the survey: switching version stays on the equivalent page, and an outdated or unreleased version says so on every page.

R3: static OpenAPI reference

Swagger UI and ReDoc render only in HTML. Print, Markdown, and feeds receive a link to the specification, and operations never reach local search or agent bundles. The accessibility suite excludes both embeds.

The CLI roadmap proposes a generator that writes Markdown. Before choosing, compare it with a Hugo content adapter that generates one page per operation from a local specification at build time. An adapter needs no CLI and no generated source in Git, but must resolve references and cycles in templates. Choose with a real specification, not a toy one.

Either way, the result is ordinary pages in the existing output pipeline. Interactive requests stay out of the first increment. If added later, credentials live only in session storage and no proxy is used.

Continuing work

Agent output

Item Proposed behavior
Sectioned llms.txt A large site splits its index by section so each file stays within the size check
Audience markers A block attribute keeps content in HTML only or in Markdown and agent outputs only, decided at build time
Prompt block A fence renders a copyable prompt and reuses existing page actions
Discovery files An opt-in experiment publishes a site-authored skill file and its well-known index. The conventions are still changing
Content negotiation Documented server recipes for Accept: text/markdown. Static hosting cannot do this, so it is a guide and not a theme feature

A hosted MCP server and a built-in assistant stay out of scope. The existing search-tail extension lets a site connect its own.

Engineering quality

  • Strict CSP. Move stable inline initializers to same-origin files with data configuration, and publish a hash manifest for what must stay inline. This closes F10.
  • Engine matrix. Run the core shell, navigation, content, and dialog suites on Firefox and WebKit, and publish a support matrix. This closes F11.
  • Navigation feel. Run the Speculation Rules experiment the performance rules already describe on one named production consumer, together with cross-document view transitions as a CSS-only enhancement.
  • Freshness. Optional review date, owner, and expiry in front matter, shown in the page annotation and reported by the CLI. A modification date is never presented as verification.
  • Social cards. Build-time images need a site-supplied font for CJK titles, so this comes last.

Sequencing

Order Delivery Exit evidence
1 R0 compiled CSS delivery, since superseded by the plain CSS source in row 3 Done on Hugo 0.169.0 and 0.170.1 with no Sass executable on PATH: theme checkers, the documentation site’s checks and browser suite, and a file-by-file comparison of the regression fixture
2 R0 migration tool, run dry on the 51 inventoried checkouts Done, then removed: every hook file converted, with no failed declaration check and one site to review. The tool was deleted with the Sass override layer it needed; hooks are now converted by hand
3 R0 plain CSS source, accepted for v1.6.0 Done on 2026-11-23 with Hugo 0.170.1: the production main stylesheet is byte-identical to the last one compiled from Sass, and the regression fixture is identical apart from the stylesheet path. No compiler and no generated file remain
4 OINK v1.6.0 release and consumer adoption Tag v1.6.0 verified on Go proxy; consumers upgrade pins and build with Hugo alone
5 R1 items, each on its own Owning checker, goldens for every output, bilingual contract
6 R2 evaluation, then one accepted design Two real repositories use it before compatibility promises
7 R3 comparison, then one accepted design A real specification is fully accounted for

Agent-output and quality items fit between stages when they do not compete with the active one. Bootstrap reduction was cut from R0. Its script has since been removed; reducing its styles stays open.

Implementation and owning checkers

Stage Theme owner Site and CLI
R0 check-stylesheets.py owns the layers and their assembly; check-presets.py and check-font-tokens.py Browser, appearance, and visual review in EN/ZH
R1 check-shell.py, check-components.py, check-code-blocks.py, check-goldens.py, check-i18n.py, check-params.py Content, keyboard, and accessibility suites; guides in both languages
R2 check-shell.py, check-navigation-contract.py, check-agent-indexes.py; a new navigation schema version CLI inspection and correspondence checks
R3 check-output.py, check-components.py, check-search.py Real-specification fixture; accessibility with no embed exclusion

Each stage moves its accepted behavior to the owning contract in both languages and then leaves this page.

Acceptance criteria

  • R0: an unmodified consumer renders the same pages on Hugo 0.170.1 or later with only Hugo installed; the stylesheet checker fails when the layer lists and the layer files disagree or a layout calls a compiler; the upgrade guide tells a site how to convert its hooks.
  • R1: each item has HTML, Print, Markdown, and RSS behavior covered by goldens, strings in all 32 locales, and keyboard, forced-colors, RTL, and narrow-screen review.
  • R2 and R3: a named real consumer, a bilingual contract accepted before any compatibility promise, and no second navigation or Markdown authority.
  • Every stage: ordinary hugo server stays usable with invalid input, and a normal build downloads nothing.

Open decisions

  1. Resolved on 2026-11-23: ship as v1.6.0 on the v1 Go module path (github.com/pgsty/oink) with deliberate breaking changes documented in CHANGELOG.md and the upgrade guide, keeping module paths stable for existing consumers.
  2. Closed: the theme source is plain CSS, verified on 2026-11-23. There is no maintainer build, so no Dart Sass release has to be chosen and its 11 selector changes do not arise.
  3. Resolved on 2026-11-22: no legacy path for sites that install Dart Sass themselves.
  4. Resolved for now: brand and semantic colors are custom properties in site CSS. A configuration key remains possible later.
  5. Is the page-status vocabulary closed?
  6. Is glossary linking ever automatic?
  7. Do line markers drop out of Markdown output or become a diff fence?
  8. Does version lifecycle use Hugo’s native dimension or independent builds?
  9. Is the API reference generated by a content adapter or by the CLI?
  10. Which production consumer measures Speculation Rules?

Decision log and sources

  • 2026-11-21: Drafted from a review of the theme, its active proposals and community issues, a survey of other frameworks, and local trials of Dart Sass and css.Build.
  • 2026-11-22: The owner decided on compiled CSS delivery, retirement of the SCSS hooks, and hand adjustment of the three sites that compiled theme SCSS. Implemented on the theme’s main branch with the documentation site and those three sites; not committed, tagged, or deployed. The R0 design section now records what was built, which differs from the draft in three places: no css.Build, no token derivation, and bundles for site-owned shells.
  • 2026-11-22: Verified on Hugo 0.170.1 after upgrading the local Hugo. With only the Hugo binary on PATH, the theme checkers pass, the regression fixture’s 686 output files match the previous pipeline apart from the main stylesheet, the documentation site passes its checks and 546 browser tests, and 50 of 51 consumer checkouts build after conversion. Published v1.5.1 fails on that Hugo because it needs Dart Sass. At that point the maintainer-side compiler was still the LibSass in Hugo Extended 0.169.0.
  • 2026-11-23: The stylesheet source is plain CSS, assembled by Hugo from the layer files under assets/css/td/. assets/scss/, the vendored SCSS of Bootstrap, Font Awesome, Inter and IBM Plex Sans, the compiled bundles under assets/oink/, bin/build-css.py and the CI job that recompiled the bundles are deleted. bin/check-stylesheets.py replaces bin/check-scss.py, and stylesheets are published under /css/ instead of /scss/. Verified with Hugo 0.170.1: the production main stylesheet is byte-identical (556,437 bytes) to the last one compiled from Sass, and the regression fixture’s 683 output files are identical apart from the stylesheet path. The maintainer-compiler question is closed because there is no compiler. No Hugo release is pinned. On the theme’s main branch; no tag contains it.
  • 2026-11-23: The theme no longer loads or vendors Bootstrap’s JavaScript, and Popper went with it. Only two controls used the script: the version menu of the bottom bar and the phone drawer, and the Landing download channels. The first is now the hover popover the navbar version menu already was, placed by CSS; the second switches in the Landing runtime. Both keep their markup classes and look. The core script every page loads, js/core.js, went from 92,443 to 8,740 bytes minified. A site that uses a Bootstrap script component in its own markup must load the script itself; none of the 48 inventoried module consumers does. On the theme’s main branch working tree; no tag contains it.
  • 2026-11-27: Removed the sentence “add no new component family” from the summary and from R1’s rationale. It had been drafted by an agent and never decided by the owner. New content components proceed under their own proposals.

Sources read on 2026-11-21:

5 - Content components expansion: review and shared design

The reviewed plan for six new content components (Timeline, Update, offline X, Video, Audio, and Map), the shared decisions behind them, and their delivery order.
Accepted in OINK 1.7.0

All six components ship in OINK v1.7.0, are documented in the component guides, and are governed by the Components contract. This proposal is preserved as design rationale.

Record Value
Status Accepted and shipped in OINK v1.7.0 (implemented 2026-11-27)
Owner OINK maintainers
Scope OINK theme; this documentation site; one optional oink-cli helper (separate proposal)
Affected contracts Components, Architecture, the component guides, configuration reference
Evidence snapshot Theme 9738dcf, site b749ba4, Hugo 0.170.1, local consumer checkouts under ~/www and ~/pgsty

The six proposals

Component Final form New public API Runtime Proposal
Timeline Definition list + {.timeline} None (author marker) None Timeline component
Update Heading + {.update date="…" tags="…"} Two heading attributes None Update component
Social posts > [!SOCIAL] callout + block attributes (a shortcode in v1.7.0) One callout type None Social post component
Video ![name](demo.mp4) and platform URLs Media attributes on the image hook; params.video_embeds Shared media.js for file players and enabled embeds Video component
Audio ![name](episode.mp3) Media attributes on the image hook Shared media.js for file players Audio component
Map map data fence One fence; params.map Vendored Leaflet, only when enabled Map component

The documented component catalog grows from 21 to 27. In v1.7.0 the shortcode count grew from 29 to 30 (social); the later callout form returns it to 29. The image and heading render hooks gain branches, and one fence hook (map) is added.

Review verdict

All six components close real gaps, and the first draft understood OINK’s infrastructure well. Its weakness was shape: it gave nearly every component a new shortcode, a long parameter list, and a runtime. Taken together that was 7 new shortcodes, about a hundred parameters, fields, and configuration keys, 3 new runtime chunks, and 16 locale keys. The final design has one new shortcode, about 35 parameters and keys (most of them existing figure and fence attributes), one small chunk plus one vendored engine, and six locale keys. The accepted Markdown-first decision requires a proposal to show first why Markdown plus an existing hook is insufficient. Applied to each component, that test removes most of the surface:

Draft element Final decision Main reason
timeline + event shortcodes, .timeline list marker Definition list + {.timeline} only A timeline is marker/event pairs; Markdown already has pairs
{{%/* update */%}} with seven parameters and a sticky rail .update heading marker with date and tags A heading already carries outline, anchor, search, and Print IDs; the rail duplicates the TOC
x with metrics, verified badges, image lists, quote parameters, data files, and an author registry social with six parameters and a Markdown body Images, galleries, and quoted posts compose from existing syntax; snapshots rot
video shortcode with about twenty parameters Image syntax for video files and platform URLs The image hook already resolves, captions, numbers, and degrades media; it drops .mp4 today
audio shortcode with chapters, speed, mutex, and transcript body Image syntax; transcripts use a folded callout Native controls cover playback; single-active playback ships in shared media.js for 2+ players, while chapters wait for evidence
map fence plus single-point shortcode, named styles, CARTO default One fence; no default tile provider One form; the theme must not choose a commercial tile service for every site
New file-resolve.html copying the image lookup order Extract the existing lookup and share it One lookup order, not two

The review also found two facts the draft could not have known without probes:

  • Overriding Hugo’s built-in x with a shortcode that takes a body turns the legacy unclosed form {{</* x user="…" id="…" */>}} into a build failure (shortcode "x" must be closed or self-closed, Hugo 0.170.1). A template warning cannot run first. The owner then renamed the component social, which leaves Hugo’s x untouched. See Social posts.
  • Image.Exif was removed in Hugo 0.155. Image.Meta returns GPS coordinates only when the site’s imaging.meta.fields includes GPS, which Hugo’s defaults exclude. Photo auto-pinning therefore needs a site-level opt-in. See Map.

Evidence

Probe or survey Result Used by
Definition list followed by {.timeline} Goldmark emits <dl class="timeline">; a definition keeps several paragraphs Timeline
Heading with {.update date="2026-11-23" tags="Breaking, Performance"} render-heading receives class, date, and tags; the TOC shows only the heading text Update
![Install demo](demo.mp4) and ![Episode](ep.mp3) in a page bundle The image hook receives IsBlock, attributes, and resources typed video/mp4 and audio/mpeg Video, Audio
Current content/image-resolve.html A non-image resource warns and is dropped Video, Audio
Percent shortcode that emits a Markdown heading The heading enters .TableOfContents Update alternatives
Built-in x overridden by a body-taking template Unclosed legacy calls fail to parse Social posts (the rename)
Image.Meta on a JPEG with GPS EXIF Coordinates only after enabling GPS fields in imaging.meta.fields Map
Leaflet on npm, 2026-11-27 latest 1.9.4; 2.0 in beta (beta.5, 2026-11-19) Map
Consumer Markdown under ~/www and ~/pgsty No use of Hugo’s x, tweet, youtube, or vimeo shortcodes; raw Bilibili <iframe> embeds on two blogs; raw <video>; autoplay loop muted GIF replacements pointing at expiring signed URLs Social posts, Video

The probes ran against a minimal Hugo site with OINK’s required Goldmark settings. They confirm Hugo behavior, not OINK output. Each implementation stage repeats them as fixtures.

Shared design rules

Authoring entry points

Every component uses an entry point that already exists or one new, narrowly justified one:

Entry point Today Gains
Goldmark block attributes on lists .steps, .cards, .filetree .timeline on a definition list
Heading render hook id, class pass-through .update with date and tags
Image render hook Images, figures, Book numbering, Zoom, Draw.io candidates Video files, audio files, recognized video platform URLs
Data fence gallery, filetree, echarts, … map
Blockquote alert hook Callout types, fold markers, {icon=} [!SOCIAL] with avatar, date, url, platform (the v1.7.0 social shortcode, revised)

No component adds a percent-delimited shortcode. steps remains the only one.

Resource lookup

Video, audio, posters, subtitle tracks, post avatars, and map thumbnails all need the lookup that content/image-resolve.html performs today: page bundle, branch bundle, global assets/, then static/ or an explicit HTTP(S) URL. The implementation extracts that lookup into one partial that both the image resolver and a media resolver call. The image resolver keeps its image-only rules (processing, alt metadata, byline). Image output must stay byte-identical across the refactor; the existing goldens prove it.

Remote URLs are never fetched at build time. A remote media URL is the author’s explicit choice, as it is for images today.

Network policy

The architecture contract requires network-capable features to be explicitly and completely configured. Two of the six components have such features:

Feature Default Enabled by Incomplete configuration
Video platform players Static link card; no third-party request params.video_embeds: [youtube, bilibili, vimeo] (any subset) Unknown names warn and are ignored
Map tiles Place list with coordinate links params.map.enable plus tiles and attribution Warns and stays off, as Draw.io does without a server

Neither feature has a theme-chosen default provider. Timeline, Update, Social posts, and local or object-storage media need no configuration.

Runtime budget

Component HTML runtime Loaded when
Timeline, Update, Social posts None —
Video or Audio js/chunks/media.js Page has a file player or an enabled platform card
Map content-components.js adapter plus vendored Leaflet and its CSS params.map is complete and the page has a map

Markdown, Print, and RSS set none of these flags.

Styles, accessibility, and locales

New rules live in plain CSS layer files under assets/css/td/, listed in layouts/_partials/css/layers.html before rtl, the presets, accessibility, and print. They use --td-* tokens, logical properties, and preset geometry (flat Ink and Terminal surfaces), and cover forced colors, reduced motion, narrow screens, long tokens, and print. Author markers (.timeline, .update) stay unprefixed; generated classes use td-.

The six components together add six locale keys (Social posts: one; Video: two; Map: three, with its zoom buttons reusing the diagram keys), in all 32 locale files with native translations, checked by bin/check-i18n.py.

Answers to the first draft’s questions

Question Answer
Default tiles once params.map.enable is true None. As with Draw.io, maps stay off until tiles and attribution are set (Map)
TOC text when an update has both a label and a title The heading text; there is no separate label or title (Update)
When to extract GPS coordinates from photos A later stage after explicit coordinates, as a site imaging.meta opt-in (Map)
Bilibili comment overlay Off (danmaku=0), with no option in S4 (Video)
Book numbering for video and map Video accepts num natively as a figure; a map is wrapped in fig, like other diagram fences; audio is not numbered (Audio)

Delivery order

Stage Scope Why here
S1 Timeline and Update CSS plus one heading-hook branch; no runtime, no configuration
S2 Video and Audio files, shared lookup extraction, media.js for autoplay Highest observed use; replaces raw <video> and GIFs
S3 Social posts One shortcode, one locale key
S4 Video platform cards and opt-in players (params.video_embeds) Third-party iframes; needs CSP and privacy review
S5 Map: vendored Leaflet, params.map, the fence The only new vendored engine
Later Map photo pins from GPS metadata; audio chapters; oink fetch social Each waits for its own evidence

Each stage ships with fixtures under tests/site/, intentional golden updates, EN/ZH guides under /docs/components/, contract updates, and browser review on this site. Stages are independent; a later one can be dropped without reworking an earlier one.

Open decisions

  1. Acceptance and release (resolved). All six components ship in OINK v1.7.0; normative behavior now lives in the Components contract.
  2. Demo media in Git. The guides’ video and audio demos add about 600 KB of binary files to this site’s repository. Keep them in the page bundles, or move them to object storage and reference them by HTTPS URL, which the media form supports.

Decision log

  • 2026-11-27 (first draft). Requirements and architecture for six components in one page: timeline/event, {{%/* update */%}}, offline x with a platform enum, audio, video, and opt-in OpenStreetMap map.
  • 2026-11-27 (review). Split into six proposals plus this overview. Reduced the public surface to one shortcode (x), one fence (map), and branches in the image and heading hooks. Recorded the probe evidence above, the x parse finding, the EXIF configuration requirement, and the roadmap conflict.
  • 2026-11-27 (owner). Renamed the offline post component social so it no longer conflicts with Hugo’s x. Removed the theme roadmap’s “add no new component family” sentence, which had never been an owner decision; the roadmap conflict section of this page went with it.
  • 2026-11-27 (implementation and acceptance). All six components were implemented on main with fixtures, goldens, invalid-input cases, and runtime unit tests, accepted for OINK v1.7.0, and documented with guides and demos on this site. Deviations from the drafts are recorded in each component’s decision log.
  • 2026-11-28 (owner). Applied the Markdown-first test to Social posts as well: the shortcode becomes the > [!SOCIAL] callout, so no component in this set needs a new shortcode. See the Social post decision log.

6 - Timeline component

A native definition-list timeline for dated or ordered events in prose, with no shortcode and no runtime.
Accepted in OINK 1.7.0

Shipped in OINK v1.7.0, documented in the Timeline guide, and governed by the Components contract. Shared decisions are in the overview.

Record Value
Status Accepted and shipped in OINK v1.7.0 (implemented 2026-11-27)
Owner OINK maintainers
Delivery stage S1, with Update
Form Native: a Markdown definition list followed by {.timeline}
New public API The author marker .timeline; no shortcode, attribute, or configuration key
Runtime None
Affected surface Component contract, a new stylesheet layer, a new guide at /docs/components/timeline/

Summary

A timeline is a sequence of pairs: a marker (a date, a time, a version, “Day 2”) and what happened. Markdown already has a construct for pairs, the definition list. OINK styles a definition list marked {.timeline} as a vertical axis with a marker column and an event column. Nothing else is added.

2024-05
: **First prototype.** The theme renders its own documentation.

2025-08
: **Markdown-first authoring.** Native forms replace most shortcodes.

2026-11
: **Plain CSS.** The stylesheet needs nothing but the Hugo binary.
{.timeline}

Problem

Prose pages often narrate events in order: incident postmortems, project milestones, a product’s history, a conference agenda, a biography. Authors write these today as bullet lists with a bold date, as tables, as steps (whose generated numbers misstate the meaning), or as raw HTML. None of them shows time as a visual axis, and none has a stable structure.

The visual grammar already exists. The Landing timeline section (layouts/_partials/landing/sections/timeline.html) renders date, title, and description on an axis, but only from Landing data on a landing page. Prose cannot reach it.

Design principles

  1. The structure is a pair. Each entry has exactly one kind of marker and a body. A definition list encodes that directly (<dt>/<dd>); a bullet list with a bold first word only imitates it.
  2. Native first. The Markdown-first decision prefers a native form when Goldmark can keep the meaning. It can: Goldmark attaches the class to the <dl>, and a definition keeps full block content.
  3. The marker is free text. “2024-05”, “09:02”, “v1.6.0”, “Day 2”, and “Q3 2026” are all valid. The component does not parse dates, so it never rejects a real-world marker.
  4. One visual grammar. The prose timeline uses the same axis, node, and marker-column vocabulary as the Landing section, expressed with article tokens.

Goals and non-goals

Goals

  • A readable chronological axis in HTML from ordinary Markdown.
  • Rich event bodies: paragraphs, lists, code, images, callouts.
  • Identical meaning in Print, RSS, Markdown, and LLMS, with no new output branch.
  • Zero JavaScript and zero configuration.

Non-goals

  • A timeline/event shortcode pair, per-event icons, tones, badges, or links as parameters.
  • Date parsing, sorting, grouping by year, or relative times (“3 days ago”).
  • Horizontal, zoomable, or Gantt-style timelines (Mermaid already offers Gantt and timeline diagrams for schedules).
  • Entries in the page outline; that is the Update component.
  • Replacing the Landing timeline section or steps.

Proposed behavior

Authoring

  • Each term (a line without a leading colon) is a marker. Terms are inline Markdown on one line; plain text is recommended.
  • Each definition (: …) is an event body. Continuation paragraphs, lists, and fences are indented as for any definition.
  • A marker may have several definitions; they render as consecutive events under one marker.
  • {.timeline} sits on the line directly after the last definition, with no blank line. As with every Goldmark block attribute, a blank line detaches it and the marker is silently lost; the guide states this next to the example.
  • The conventional event title is a leading bold phrase. It is a writing convention, not syntax.

The native form requires Goldmark definition lists (markup.goldmark.extensions.definitionList), which Hugo enables by default. The component contract’s prerequisite list gains this line.

Rendering

Goldmark produces the markup; the theme adds only CSS, scoped to .td-content dl.timeline so a site’s unrelated .timeline rules do not collide:

Condition Layout
Wide column Two-column grid: a marker column sized to its content and capped (about 10rem), and an event column. An axis line runs along the start edge of the event column, with a node on each marker row
Narrow column One column: marker above body, axis and nodes on the start edge
Ink, Terminal Flat surfaces; square nodes (0px in Ink, 2px radius in Terminal); preset --td-meta-font-family (Inter sans-serif in Ink, IBM Plex Mono in Terminal) with tabular numerals
Forced colors Axis and nodes use system colors; no meaning carried by color
Print Axis as a thin border; no backgrounds; short entries avoid page breaks inside
RTL Logical properties mirror the axis
Long tokens Markers wrap rather than widen the column

Outputs

Output Result
HTML <dl class="timeline"> from Goldmark, styled by the theme; no runtime
Print The same markup with print rules
Markdown / LLMS The authored source (native forms keep source)
RSS The <dl> as rendered; feed readers show terms and definitions

Accessibility

Screen readers announce a definition list with term/definition pairs in source order. Markers are text, so nothing depends on the axis graphics, which are decorative pseudo-elements.

Trade-offs and alternatives

Option Decision Reason
First-draft timeline + event shortcodes with time, title, badge, icon, tone, link Rejected for the first stage Two shortcodes and a parent/child collector for decoration, not a missing capability. A plain-text title parameter is weaker than a Markdown body, and the Markdown output would have to be synthesized
Bullet list with a bold date and {.timeline} Rejected The marker is not structurally separate; CSS would depend on li > p:first-child > strong:first-child and break when an item starts differently
A steps variant Rejected Steps generate numbers; a timeline marker is authored text
Reusing the Landing section through a data file Rejected for prose A data file per timeline moves prose out of the page. The visual tokens are shared instead
<ol> semantics Not chosen An ordered list announces order but not the marker/body pair. Order is still the source order in a <dl>

Costs of the chosen form:

  • Definition-list syntax is less familiar than bullets. The guide leads with a copyable example.
  • GitHub and some editors do not render definition lists. The source still reads as a marker line followed by : event lines.
  • Per-event decoration is out of reach. If evidence shows it is needed, a later proposal can add a full form; the native form stays the primary one.

Compatibility

Purely additive. The theme gives .timeline no meaning today. A local consumer scan found one site stylesheet using .timeline, scoped under its own application class, so the scoped theme selector does not collide with it.

Implementation plan

  1. Add a stylesheet layer (for example assets/css/td/timeline.css) and list it in layouts/_partials/css/layers.html before the RTL, preset, accessibility, and print layers.
  2. Add a fixture page to tests/site/ covering single and multiple definitions per marker, rich bodies, a marker with long tokens, and an RTL page; record HTML, Print, Markdown, and RSS goldens with bin/check-goldens.py --update.
  3. Owning checks: bin/check-stylesheets.py, bin/check-goldens.py, and hugo --source tests/site --printPathWarnings.
  4. Update the bilingual component contract (native form and prerequisite) and add EN/ZH guides with the cheatsheet row.
  5. Review on this site: four presets, light and dark, desktop and mobile, RTL, forced colors, and browser print.

Acceptance criteria

  • A definition list with {.timeline} renders the axis layout with no template change and no runtime.
  • Markdown and LLMS outputs equal the authored source.
  • A definition list without the marker renders exactly as before.
  • Reviews pass for all presets, both color schemes, narrow screens, RTL, forced colors, and print.

Open decisions

  1. Marker column width. Recommended: content-sized with a cap. A fixed width, as on the Landing section, aligns better but truncates “Q3 2026 – Q1 2027”.
  2. A compact modifier. Recommended: none in S1; add {.timeline .td-timeline-compact} only if fixtures show a need.
  3. Shared CSS with Landing. Recommended: share tokens and proportions, not selectors; the two contexts have different containers.

Decision log

  • 2026-11-27 (first draft). timeline/event shortcodes plus a .timeline list marker.
  • 2026-11-27 (review). Native definition list only; shortcodes, icons, tones, and badges removed from the first stage.
  • 2026-11-27 (implementation). Implemented as specified: assets/css/td/timeline.css (a content-sized marker column capped by fit-content(10rem)), the .timeline author marker registered in bin/check-namespace.py, and the timeline-update fixture with HTML, Markdown and Print goldens.

7 - Update component

Changelog entries as ordinary headings marked .update, with a date and tags, so every entry joins the outline, search, and Print without a shortcode.
Accepted in OINK 1.7.0

Shipped in OINK v1.7.0, documented in the Update guide, and governed by the Components contract. Shared decisions are in the overview.

Record Value
Status Accepted and shipped in OINK v1.7.0 (implemented 2026-11-27)
Owner OINK maintainers
Delivery stage S1, with Timeline
Form Native: a Markdown heading with {.update date="…" tags="…"}
New public API The author marker .update and two heading attributes, date and tags
Runtime None
Affected surface layouts/_markup/render-heading.html, component contract, a stylesheet layer, a new guide at /docs/components/update/

Summary

An update entry is a heading. Marking it .update adds a metadata line with a machine-readable date and neutral tag chips, and gives the entry its visual rhythm. Because the entry is still an ordinary heading, it joins the TOC, keeps its self-link, keyboard heading navigation, and search section, and is namespaced in multi-page Print — all with no new mechanism.

## v1.6.0 — Plain CSS stylesheets {.update date="2026-11-23" tags="Breaking, Performance"}

Stylesheets now assemble from plain CSS layers with only the Hugo binary.

### Highlights {#v1-6-0-highlights}

- SCSS hooks retired in favor of `assets/css/project.css`.
- Bootstrap JavaScript removed.

## Unreleased {.update}

Work merged after the latest tag.

Problem

Single-page changelogs, “What’s new” pages, weekly notes, and policy-change logs are a sequence of dated sections. Authors write them today as headings followed by an ad-hoc date line and badges. The date has no <time> semantics, every site invents its own layout, and badges written inside a heading leak into the TOC and anchor.

Mintlify’s <Update> shows the demand. OINK already has layout: releases, but it serves a different case: one content page per GitHub release, with its own URL, feed item, and assets. A product that wants one readable stream on one page has no component.

Design principles

  1. An entry is a heading. Membership in the outline is the essential property; everything that already works for headings must keep working.
  2. Native first. The heading hook already receives block attributes; the probe confirmed class, date, and tags arrive intact and the TOC shows only the heading text.
  3. The page is the authority. An update page is the source of truth for its own entries. A version that already has a release page is not described a second time here, following the rule that facts stay outside presentation strings.
  4. Do not compete with the TOC. The docs shell already shows the outline with scroll tracking in the right rail.

Goals and non-goals

Goals

  • Dated, tagged entries from ordinary Markdown headings.
  • Unchanged TOC, anchors, self-links, keyboard navigation, search sections, Print namespacing, and footnotes.
  • Identical meaning in Print, RSS, Markdown, and LLMS.
  • Zero JavaScript and zero configuration.

Non-goals

  • A {{%/* update */%}} shortcode, a container, or a two-column sticky rail.
  • Separate label and title fields, a level parameter, or a link parameter; the heading text, heading level, and body already express them.
  • Tag color vocabularies (for example “breaking” → red).
  • Per-entry URLs, feed items, or GitHub release binding; those belong to layout: releases.
  • Generating entries from data, sorting, or filtering.

Proposed behavior

Authoring

Attribute Rule Invalid input
.update Author marker on any heading level; usually ## for entries —
date Optional. String YYYY, YYYY-MM, or valid calendar YYYY-MM-DD Non-string or invalid calendar date warns and drops the date; the entry and valid tags stay
tags Optional. String of , or , separated plain text; items are trimmed, empty items skipped Non-string warns and drops the tags
id Existing heading rule; explicit #id recommended for version headings Existing behavior

date and tags on a heading without .update warn and are dropped. That is the heading hook’s existing rule for unsupported attributes, so no new diagnostic path is needed. An entry without a date (for example “Unreleased”) is valid.

The heading text is the entry’s label and title: ## v1.6.0, ## v1.6.0 — Plain CSS stylesheets, or ## 2026-11 weekly notes. Subsections inside an entry are ordinary lower-level headings and nest under it in the TOC.

Rendering

<h2 id="v160--plain-css-stylesheets" class="update">v1.6.0 — Plain CSS stylesheets<a class="td-heading-self-link" …></a></h2>
<div class="td-update-meta"><time datetime="2026-11-23">2026-11-23</time><span class="td-update-sep">, </span><span class="td-update-tag">Breaking</span><span class="td-update-sep">, </span><span class="td-update-tag">Performance</span></div>

The metadata line sits after the heading, not inside it, so heading text, the accessible name, the self-link, and the search section title stay clean. The date shows the authored ISO string, which already matches OINK’s default date format in every locale.

Styling, scoped to the article:

  • An entry heading gets extra space above it and a separator rule, which give a long stream its rhythm.
  • The date uses the metadata font with tabular numerals.
  • Tags are neutral chips sharing badge geometry. Presets own their colors.
  • Ink and Terminal keep flat, square geometry; forced colors use system colors; print drops backgrounds and keeps the separator.

Outputs

Output Result
HTML Heading plus metadata line; no runtime
Print The same; multi-page Print namespaces the heading ID as for any heading
Markdown / LLMS The authored source, including the attribute block
RSS Heading plus metadata line as static HTML

Choosing between Update and release pages

Need Use
One readable stream on one page .update headings
One page per version, its own URL and feed item, release assets, GitHub binding layout: releases
A short dated sequence inside other prose Timeline

Trade-offs and alternatives

Option Decision Reason
First-draft {{%/* update label date title tags level id link */%}} with a sticky two-column rail Rejected It works in Hugo (a percent shortcode that emits a heading does enter the TOC), but seven parameters re-encode what heading syntax already says; the label must be escaped into generated Markdown; the Markdown output must be synthesized; and it would be the second percent shortcode after steps
The sticky rail itself Rejected In the docs shell the left navigation, right TOC, and a rail would leave about 38rem for code and tables, and the rail repeats what the TOC already tracks. A per-entry wrapper is also required for position: sticky, so the rail forces the shortcode
One {{%/* updates */%}} container with headings inside Rejected Sticky children share one containing block and pile up; a grid cannot make a heading span its section. The visual gain does not justify a container
A front-matter page mode that turns every ## into an entry Deferred Implicit; mixes introduction headings with entries. Revisit only if pages show the explicit marker is tedious
Keyword-to-color tag mapping Rejected A hidden English vocabulary that never matches Chinese tags, and colored chips compete with presets
Badges inside the heading text Rejected They leak into the TOC, anchors, and search titles

Costs of the chosen form:

  • No Mintlify-style rail. The look is a clean entry stream, not a clone.
  • Attribute syntax on headings is less discoverable than a named shortcode; the guide and the cheatsheet lead with it.
  • The Markdown output keeps {.update …} on the heading line. Agents read it easily; it is the same trade-off every native form makes.
  • render-heading.html runs for every heading on every page, so the new branch must stay cheap: test for the update class before any other work.

Compatibility

Additive. A heading without .update renders byte-identically. Today date and tags on a heading already warn and are dropped, so no existing page can depend on them.

Implementation plan

  1. In render-heading.html, when the validated class list contains update, allow date and tags, validate them, and emit the metadata line after the heading.
  2. Add a stylesheet layer (or a section of an existing content layer) and list it in layers.html.
  3. Fixtures: entries with and without dates, invalid dates, tags with whitespace and empty items, nested subsections, an entry inside a multi-page Print section, and a heading with date but no marker. Record HTML, Print, Markdown, and RSS goldens.
  4. Owning checks: bin/check-content-primitives.py (attribute policy), bin/check-output.py, bin/check-goldens.py, bin/check-stylesheets.py. Confirm search/sections.html keeps the heading text as the section title.
  5. Update the bilingual component contract and add EN/ZH guides with the cheatsheet row.

Acceptance criteria

  • TOC entries, anchors, keyboard heading jumps, and search sections are unchanged by the marker.
  • <time datetime> appears only for valid dates; invalid input warns and keeps the entry.
  • Headings without the marker are byte-identical to the current output.
  • Multi-page Print namespaces update headings like any other heading.
  • Preset, color-scheme, narrow-screen, RTL, forced-colors, and print reviews pass.

Open decisions

  1. Visual weight. Recommended: separator and metadata line only. A start-edge axis per entry would need a wrapper and is deferred.
  2. Date in the TOC. Recommended: no; the TOC stays compact and authors can put a date in the heading text when it is the label.
  3. Locale key for tags. Recommended: none; tag chips carry no extra label. If an accessible group name proves necessary, reuse the existing taxonomy label.

Decision log

  • 2026-11-27 (first draft). Percent-delimited update shortcode with a sticky rail and seven parameters.
  • 2026-11-27 (review). Replaced by the .update heading marker with date and tags; rail, tone mapping, and per-entry links removed.
  • 2026-11-27 (implementation). Implemented in render-heading.html and assets/css/td/timeline.css. Headings without the marker stay byte-identical (the theme goldens prove it); invalid input is covered by check_update_headings in bin/check-content-primitives.py. No locale key was needed.
  • 2026-11-27 (post-review hardening). Extracted styles to assets/css/td/update.css; added visually hidden , separators inside .td-update-meta to fix search-index, RSS, screen-reader, and copy token gluing; added rich-copy.js support; fixed dark-mode print contrast (--td-print-*) and h2.update bottom-border sandwich; replaced negative margin with :has(+ .td-update-meta) and tightened first-entry / h2+h3.update spacing; aligned Ink top border and tag surface; added if not .Attributes fast path, printf "%T" string type guards, real calendar date checks via time.AsTime, and full-width , tag splitting.
  • 2026-11-27 (acceptance review). Firefox still copied the tags glued (FixDocs) and WebKit put each comma on its own line, because flex items are blockified and user-select: none removed the separators from the selection. The metadata line is now inline flow with <span class="td-update-sep">, </span> separators at font-size: 0, and all three engines copy 2026-11-23, Fix, Docs. The if not .Attributes fast path never ran, since Goldmark gives every heading an id; it now applies when that id is the only attribute, roughly halving the heading hook’s template time on the documentation site with byte-identical output. The fixture goldens record the separator markup and the new word count.

8 - Audio component

Audio through ordinary Markdown image syntax — a titled player with the theme’s control row for podcasts, voice samples, and recordings, with transcripts in a folded callout and shared single-active playback when multiple players appear on a page.
Accepted in OINK 1.7.0

Shipped in OINK v1.7.0, documented in the Audio guide, and governed by the Components contract. Shared decisions are in the overview.

Record Value
Status Accepted and shipped in OINK v1.7.0 (implemented 2026-11-27)
Owner OINK maintainers
Delivery stage S2, with video files
Form Native: a block Markdown image whose destination is an audio file
New public API None beyond accepting audio destinations; attributes caption, id, and preload
Runtime Shared js/chunks/media.js for the control row and single-active playback
Affected surface The media partial shared with Video, a stylesheet section, a new guide at /docs/components/audio/

Summary

![Episode 12: Leaving Sass for plain CSS](episode-12.mp3)
{caption="OINK Radio · 24 minutes · recorded November 2026"}

> [!DETAILS]- Transcript
> Welcome back. This week we removed the last Sass compiler …

An audio file renders as a figure: the bracket text as a visible title, the browser’s native <audio controls>, and an optional caption. The transcript, show notes, or lyrics are ordinary content after it; a folded callout keeps them out of the way in HTML and expanded in Print.

Problem

Podcast episodes, text-to-speech and voice-model samples, pronunciation guides, music excerpts, and recorded talks need a player inside prose. Today ![](episode.mp3) warns and drops, and raw <audio> has no title, caption, Print, or RSS form. A bare player tells the reader nothing about what it plays.

Design principles

  1. Same syntax and branch as video. One media partial owns detection, lookup, and static outputs for both.
  2. The name is visible. A video shows its picture; audio has none, so the bracket text doubles as the visible title and the player’s accessible name.
  3. The page owns the controls; the browser owns playback. The native <audio controls> is the no-JavaScript player. With the runtime, one theme control row with a single seek bar replaces it in every browser (revised 2026-11-28; the native strip first stood as the player).
  4. Compose, don’t absorb. A transcript is content, and OINK already has a folded container that prints expanded. The component does not grow a body.

Goals and non-goals

Goals

  • Local, bundle, global-asset, static/, and object-storage audio files.
  • A visible, accessible title; an optional caption.
  • Static Print, RSS, Markdown, and LLMS forms with a usable link.
  • Native playback works without JavaScript. The shared runtime draws the control row and pauses other audible players.

Non-goals

  • An audio shortcode or a transcript body inside the component.
  • Hand-typed metadata that can drift from the file: duration, artist.
  • Codec fallbacks (mp3=, ogg=, m4a=).
  • In the first stage: cover art, chapters, waveforms.
  • Podcast feeds or RSS <enclosure> elements; podcast distribution is a site concern.

Proposed behavior

Detection

A block image is audio when its destination ends in mp3, m4a, aac, oga, ogg, opus, wav, or flac in any letter case (a page or global resource, a static/ path, or an HTTPS URL), or is a resource whose Hugo media type is audio/*. Hugo defines no audio/* type by default, so the media type only matters when a site declares one. Resolved local resources preserve query strings and fragments (such as Media Fragments #t=30,60) with their percent-encoding as written. An inline audio destination renders as a plain link.

Attributes

Attribute Rule
caption Plain text below the title, linked via aria-describedby
id Validated like other figure IDs; an ID that another unnumbered audio or video figure or a numbered Book target already uses warns and is dropped from whichever comes second. Heading and plain image IDs are not compared
preload metadata or none; defaults to metadata for the first 6 audio players on a page and none from the 7th onward

num, poster, autoplay, track, width, height, link, command, and options warn and are dropped. Book numbering is left out because OINK’s numbered kinds are figures, tables, equations, and examples; calling a recording a figure would mislabel it. An empty bracket text warns and the file name becomes the title.

Rendering

<figure class="td-media td-media--audio">
  <figcaption>
    <span class="td-media__title" id="td-audio-…-a0-title">Episode 12: Leaving Sass for plain CSS</span>
    <span class="td-fig-caption" id="td-audio-…-a0-caption">OINK Radio · recorded November 2026</span>
  </figcaption>
  <audio controls preload="metadata" src="…/episode-12.mp3"
    aria-labelledby="td-audio-…-a0-title" aria-describedby="td-audio-…-a0-caption">
    <a href="…/episode-12.mp3">Episode 12: Leaving Sass for plain CSS</a>
  </audio>
  <p class="td-media__url"><a href="…/episode-12.mp3">https://…/episode-12.mp3</a></p>
</figure>

Audio is always a figure (without .td-figure, so its header stays start-aligned), because it always has a visible title. The player spans the reading width; consecutive audio figures and an immediately following .td-callout--details transcript use :has() positive margins so each audio-transcript pair groups tighter than adjacent pairs: 8px between a recording and its transcript, 16px between consecutive recordings, and the ordinary media margins, 1.5rem above and 1.75rem below, around each group (:where(.td-media):not(.td-figure), one class of weight above Bootstrap’s figure reset). Presets style the frame and title (the card takes --td-code-radius like callouts; Paper and Ink align its surface with adjacent callouts; Terminal uses --td-brand-line-strong and --td-ui-font-family); the control row follows the preset and color mode in every browser (see Components), and the no-JavaScript native player keeps the browser’s look.

preload="metadata" lets the browser show the duration without downloading the file; switching the default to preload="none" from the seventh audio player onward prevents connection bursts on long sample pages.

Outputs

Output Result
HTML <audio controls>, replaced by the theme control row from js/chunks/media.js
Print Title, caption, and the file URL as a visible .td-media__link on screen and paper (paper-palette overrides in @media print)
Markdown / LLMS The authored source; a following transcript callout stays readable text
RSS Title as a direct link to the file (absolute URL) and the caption
Rich copy Start-aligned figure preserving title, caption, and clickable URL link

The callout hook already renders folded callouts as static, expanded blocks in dedicated Print and RSS, and Markdown keeps their source. A transcript written as > [!DETAILS]- is therefore complete in every static output without any audio-specific rule.

Large files

The Video guidance applies: prefer object storage for long recordings; page-bundle audio is committed to Git.

Trade-offs and alternatives

Option Decision Reason
First-draft {{</* audio */>}} with src, mp3, ogg, m4a, title, artist, cover, duration, chapters, caption, preload, loop, download, compact, and a transcript body Rejected Codec fallbacks are obsolete, duration and artist are facts that drift from the file, cover and compact create two layouts, and the body duplicates a folded callout
A runtime for a speed toggle and chapters Speed adopted 2026-11-28; chapters deferred The theme control row cycles speed in every browser; chapters need WebVTT evidence before growing the UI. The shared media script handles single-active playback
Hidden bracket text, as for images Rejected A bare player is unlabeled for sighted readers
Numbering as a Book figure Rejected A recording is not a figure; a numbered audio kind would need its own Book index, which nothing requests

Costs of the chosen form: no podcast-style card with cover art, and the player looks slightly different in each browser. Both are acceptable for a first stage whose job is to make audio publishable at all.

Later candidates

Each needs its own evidence and adds to js/chunks/media.js, which video already introduces:

  • Chapters: from a WebVTT chapters track (the standard carrier) rather than a parameter mini-language.
  • Cover art: poster on audio, if podcast pages ask for it.

Compatibility

Additive; today an audio destination warns and renders nothing.

Implementation plan

Audio lands with video files in S2 and reuses the same lookup extraction, media partial, and fixtures. Specific work:

  1. Audio detection, the figure layout, and static outputs in content/media.html.
  2. Fixtures: each source kind, an empty bracket text, an unsupported attribute, inline audio, consecutive samples, and a transcript callout in each output.
  3. Owning checks: check-media-primitives.py, check-output.py, check-output-security.py, check-goldens.py, check-stylesheets.py, tests/js/media.test.js, tests/js/rich-copy.test.js, and tests/browser/audio.spec.mjs. No locale key is needed.
  4. EN/ZH guide and cheatsheet row; contract update.

Acceptance criteria

  • A single player shows elapsed time in the page accent. Starting a second audible player pauses the first.
  • Each audio figure has a visible title and an accessible name via aria-labelledby (plus aria-describedby when captioned).
  • Print, RSS, Markdown, and LLMS contain no <audio> element and keep a usable link (visible on screen and paper in Print; linked title in RSS).
  • A following > [!DETAILS]- transcript is expanded in dedicated Print and pairs tightly with its player on screen.

Open decisions

  1. Title placement. Resolved: above the player, start-aligned.
  2. Single-active playback in S2. Resolved: the same runtime handles progress for every file player and coordinates multiple audible players.

Decision log

  • 2026-11-27 (first draft). audio shortcode with chapters, speed control, mutex runtime, cover, duration, and transcript body.
  • 2026-11-27 (review). Native image syntax with caption and id; transcripts composed from a folded callout; runtime features deferred.
  • 2026-11-27 (implementation). Implemented in the shared media partial and assets/css/td/media.css; no runtime and no locale key. Two invalid-input cases were added to bin/check-media-primitives.py.
  • 2026-11-27 (review revision). Addressed deep-review findings: dedicated Print now uses visible .td-media__link; @media print resets audio cards to paper-palette tokens in dark mode; removed .td-figure from audio and enforced start alignment; switched <audio> accessible naming to aria-labelledby/aria-describedby (with render-block.html ID rewriting); preserved query strings and #t= Media Fragments on local resources; replaced negative margins with :has() positive margins for consecutive cards and Audio+Transcript pairing; aligned Paper and Terminal frame/title styling; preserved audio URL and start alignment in rich-copy.js; added preload attribute with 6-player auto-threshold (none from 7th onward); added unnumbered duplicate #id detection and accurate audio: warning prefix; enabled single-active playback in js/chunks/media.js only when 2+ players exist on a page; added nested <a> guard in check-output.py, expanded check-media-primitives.py, JS unit tests, and tests/browser/audio.spec.mjs.
  • 2026-11-27 (adversarial review fixes). Restored the 24px/28px margins that :where(.td-media) had lost to Bootstrap’s figure { margin: 0 0 1rem } (now :where(.td-media):not(.td-figure)), so the 8px/24px pairing holds; single-active playback now treats any muted or zero-volume player as silent and also reacts to volumechange, so unmuting a playing loop pauses other audio and an author’s own muted loop is left alone; book/register-target.html checks unnumbered media IDs, making the duplicate-ID check two-way; local fragments keep their percent-encoding (EscapedFragment); preload warns only in HTML; the audio card takes --td-code-radius in every preset and Ink’s callout surface. The browser suite asserts absolute spacing and uses real play(); check_audio_matrix() covers upper-case extensions, a site-defined audio/* media type, encoded fragments, Book-target ID clashes in both orders, and a subpath baseURL.
  • 2026-11-28 (control row). The owner judged the native strip plus the theme’s separate accent strip as two progress bars and asked for one bar that tells played and loaded time apart by color, styled per preset. Firefox and Safari do not expose their native track, so js/chunks/media.js now removes controls and draws one control row (play, time, a single seek bar, speed, mute and volume) with eight ui_media_* labels in all 32 locales; the native player remains the no-JavaScript fallback. Played, buffered and unloaded time keep at least 3:1 between played and each neutral in every preset and mode.

9 - Video component

Video through ordinary Markdown image syntax — local or object-storage files, muted looping demos that replace GIFs, and privacy-first cards for YouTube, Bilibili, and Vimeo.
Accepted in OINK 1.7.0

Shipped in OINK v1.7.0, documented in the Video guide, and governed by the Components contract. Shared decisions are in the overview.

Record Value
Status Accepted and shipped in OINK v1.7.0 (implemented 2026-11-27)
Owner OINK maintainers
Delivery stages S2 (files, autoplay), S4 (platform cards and players)
Form Native: a block Markdown image whose destination is a video file or a recognized video-platform URL
New public API Image attributes poster, track, autoplay for video; configuration params.video_embeds
Runtime Shared js/chunks/media.js for file players and enabled platform cards
Affected surface render-image.html, the shared resource lookup, a media partial, a stylesheet layer, the configuration schema, a new guide at /docs/components/video/

Summary

Video uses the syntax authors already use for images:

![Installing OINK in one command](install.mp4)
{caption="One-command setup" poster="install.webp" track="install.vtt"}

![Switching visual presets](presets.webm)
{autoplay=true caption="Paper, Slate, Ink, and Terminal"}

![OINK architecture talk](https://www.bilibili.com/video/BV1xx411c7mD?t=42)
{poster="talk.webp" caption="Conference talk, 2026"}

The image hook recognizes a video destination and hands it to a shared media partial. A file becomes a native <video> with controls. autoplay=true turns it into a muted, looping demo that plays only while visible and never under reduced motion. A YouTube, Bilibili, or Vimeo URL becomes a static card that links to the platform; when the site lists that platform in params.video_embeds, clicking the card loads the platform’s player in place.

Problem

  • ![](demo.mp4) warns and drops today, because the image resolver accepts only image resources.
  • Authors fall back to raw <video> with no caption, numbering, Print, or RSS form, and to raw <iframe> players that load third-party scripts and cookies on page view, shift the layout, fail where the platform is blocked, and rot when videos disappear.
  • Animated GIF demos are large and cannot be paused; the usual replacement is a hand-written autoplay loop muted video that ignores reduced motion.

Evidence from local Markdown under ~/www and ~/pgsty (2026-11-27): two blogs embed the same Bilibili <iframe> directly; a travel post uses raw <video controls>; repository READMEs in the same corpus use autoplay loop muted videos whose URLs carry expiring signatures. No checkout uses Hugo’s built-in youtube or vimeo shortcode.

Design principles

  1. A video is a figure. It has a source, an accessible name, an optional caption, and an optional Book number, exactly like an image. The image hook already owns all four, so video extends it instead of adding a shortcode.
  2. Precedent exists. GitLab Flavored Markdown renders image syntax that points at a video or audio file as a player, and Obsidian embeds YouTube videos written with image syntax. OINK’s own Draw.io component is a native image form.
  3. The URL is the identity. A platform URL is what readers, feeds, and agents understand, and it carries the start time. The theme derives player URLs from it at build time; nothing is fetched.
  4. No third-party request without consent. By default nothing leaves the page. With a site opt-in, the platform is contacted only after a reader clicks.
  5. Progressive enhancement. Every form works without JavaScript; the runtime replaces native file controls with the theme control row, coordinates audible players, gates autoplay on visibility, and opens enabled embeds in place.

Goals and non-goals

Goals

  • Local, page-bundle, global-asset, static/, and object-storage (HTTPS) video files.
  • Poster, one subtitle track, caption, Book numbering, and layout without shift when a size is known.
  • A GIF replacement that is small, pausable, and respects reduced motion.
  • YouTube, Bilibili, and Vimeo without third-party requests by default.
  • Static, readable Print, RSS, Markdown, and LLMS forms.

Non-goals

  • A video shortcode, or overriding Hugo’s built-in youtube and vimeo.
  • Codec fallbacks with several <source> elements; MP4 (H.264) plays everywhere OINK supports.
  • Streaming (HLS/DASH), custom player chrome, playlists, chapters.
  • Remote platform thumbnails, oEmbed, or any build-time request.
  • Platforms beyond the three, or arbitrary iframe URLs.

Proposed behavior

Detection

A block image is a video when its destination is one of:

Destination Recognized by
Page, branch-bundle, or global resource Hugo media type video/*
static/ path or HTTPS URL Extension mp4, m4v, webm, ogv, or mov
Platform URL A strict pattern below

An inline image with a video destination renders as a plain link to the file or watch page, with the bracket text as link text. Anything else keeps today’s image behavior.

Attributes

Attribute Applies to Rule
caption, num, id All video The shared figure contract; num registers a Book fig target
poster All video Image path through the shared image resolver. A local raster also supplies width/height
track Files One WebVTT file through the shared lookup. srclang is the page language; the label is the language name
autoplay Files true or false; see below. Warns and is ignored for platform URLs
width, height All video Positive integers; intrinsic size or aspect hint, overriding the poster’s

link, command, and options warn and are dropped. The bracket text is the accessible name. Without width/height or a local poster, the box reserves 16:9 until metadata loads.

Files

<figure class="td-figure td-media td-media--video">
  <video controls preload="metadata" playsinline src="…/install.mp4" poster="…/install.webp" width="1280" height="720" aria-label="Installing OINK in one command">
    <track kind="subtitles" src="…/install.vtt" srclang="en" label="English" default>
    <a href="…/install.mp4">Installing OINK in one command</a>
  </video>
  <figcaption><span class="td-fig-caption">One-command setup</span></figcaption>
</figure>

Unlike a block image, a video always renders inside a <figure>, with or without caption or num.

autoplay=true emits muted loop playsinline and a data-td-media-autoplay marker, but not the autoplay attribute. The runtime starts playback when at least half of the video is visible, the page is visible, and the reader has not asked for reduced motion; it pauses when the video leaves the viewport. The control row stays, so the motion can always be paused. Without JavaScript the reader sees the poster or first frame and plays it by hand.

Platform URLs

Platform Accepted URLs Derived player
YouTube youtube.com/watch?v=<id>, youtu.be/<id>, youtube.com/shorts/<id> with an 11-character ID; t or start https://www.youtube-nocookie.com/embed/<id>?start=…&autoplay=1
Bilibili bilibili.com/video/BV<id> or /video/av<number>; p and t https://player.bilibili.com/player.html?bvid=…&p=…&t=…&autoplay=1&danmaku=0
Vimeo vimeo.com/<number>, optionally /<hash> for unlisted videos https://player.vimeo.com/video/<number>?h=…&dnt=1&autoplay=1

IDs are validated against these patterns before any URL is built; author text never enters a player URL. A b23.tv/BV… short link resolves to the player; only an opaque short link that cannot be resolved offline, such as b23.tv/abc, renders the card without a player and warns with the full-URL form.

Default output is a card: the poster or a neutral surface, a play glyph, the bracket text, and the platform name, all inside one link to the canonical watch URL. No iframe, script, or thumbnail request.

With the platform listed in params.video_embeds, the card also carries the derived player URL. On click, the runtime replaces the card with an iframe that has the bracket text as title, allow="autoplay; picture-in-picture; fullscreen", sandbox="allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox", allowfullscreen, and referrerpolicy="strict-origin-when-cross-origin", and moves focus into it. Without JavaScript the link still opens the platform.

Configuration

params:
  # Platforms whose player may load in place after a reader clicks.
  # Any of: youtube, bilibili, vimeo. Empty: cards only link out.
  video_embeds: []

A non-list warns and keeps cards only; unknown names warn and are ignored. A list (rather than a boolean) lets a site enable Bilibili without YouTube when part of its audience cannot reach YouTube. Sites with a Content Security Policy add the enabled player hosts to frame-src; the guide lists them.

Outputs

Output Result
HTML File players and enabled platform cards load the shared media.js
Print Poster when present, caption and Book label, and the file or watch URL as visible text; no <video> or <iframe>
Markdown / LLMS The authored source
RSS Poster (absolute URL) when present and a link with the bracket text; no <video> or <iframe>

Ordinary browser printing of HTML shows the poster or current frame; print rules reveal the URL beneath it.

Large files

A video in a page bundle is committed to Git. The guide recommends an object-storage or CDN URL for anything beyond a few megabytes, in line with the repository rules for binary assets. The theme does not measure file sizes at build time; a size report belongs to oink-cli checks.

Trade-offs and alternatives

Option Decision Reason
First-draft {{</* video */>}} with src, youtube, bilibili, vimeo, webm, mp4, controls, muted, loop, gif, ratio, and more Rejected About twenty parameters restate what image syntax and figure attributes already express, and a shortcode would be a second way to place video
Overriding Hugo’s youtube and vimeo Rejected Hugo’s vimeo can fetch from Vimeo at build time (its simple mode); each override widens divergence from Hugo (see the X parse finding); a URL is clearer than an ID
gif=true that removes controls Renamed and changed autoplay describes the behavior. Removing controls fails WCAG 2.2.2 (pause, stop, hide)
The autoplay HTML attribute Rejected It ignores reduced motion and keeps playing off-screen; the runtime gate is the accessible form
Remote platform thumbnails Rejected A third-party request on every view
A boolean params.video_embeds Rejected Reachability differs by platform and region

Costs of the chosen form:

  • Image syntax for video is a convention, not CommonMark semantics. Renderers other than GitLab show a broken image; the Markdown output keeps the URL, so agents still understand it.
  • Discoverability shifts from a shortcode’s parameter list to the image guide; the cheatsheet gets its own Video row.
  • render-image.html gains a dispatch. The media branch lives in its own partial so the image path stays readable and its goldens unchanged.

Compatibility

Additive. A video destination produces a warning and no output today, so no page depends on that behavior. Image output must stay byte-identical, which the existing goldens verify. params.video_embeds is a new key.

Implementation plan

  1. Extract the lookup from content/image-resolve.html into a shared partial; image goldens must not change.
  2. Add content/media.html (detection, attributes, outputs) and dispatch to it from render-image.html before image-only work.
  3. Add assets/js/media.js as the stable chunk js/chunks/media.js, selected from a Page Store flag in scripts.html; unit tests under tests/js/ with mocked IntersectionObserver and matchMedia.
  4. S4: platform patterns, params.video_embeds in hugo.yaml, bin/check-params.py, and the generated configuration schema.
  5. Locale keys in all 32 files: ui_video_play (“Play video”) and ui_video_open (“Open on the video site”), checked by bin/check-i18n.py.
  6. Fixtures: files from each source kind, poster with and without size, subtitles, autoplay, inline video, each platform pattern, invalid IDs, short links, and each output. Owning checks: check-media-primitives.py (the image hook and shared resolution), check-runtime-isolation.py (the chunk flag), check-output.py, check-output-security.py, check-goldens.py, check-stylesheets.py, check-params.py, check-i18n.py, node --test.
  7. Browser review on this site: keyboard, focus after the player loads, reduced motion, presets, mobile, and print.

Acceptance criteria

  • Pages with only plain platform links omit the media runtime.
  • With video_embeds: [], the HTML contains no player host URL.
  • Autoplay never starts under prefers-reduced-motion: reduce and pauses off-screen.
  • Print, RSS, Markdown, and LLMS contain no <video>, <iframe>, or runtime marker.
  • Existing image goldens are byte-identical.

Open decisions

  1. Uncaptioned video (resolved). The shipped implementation always wraps videos in <figure class="td-media"> for a uniform frame and consistent print and typeset-copy output.
  2. Subtitles. Recommended: one track per page; each language page names its own file. A list form is deferred.
  3. Bilibili comments. Recommended: danmaku=0 with no option in S4.
  4. Unknown size. Recommended: reserve 16:9; vertical videos set width/height or a poster.

Decision log

  • 2026-11-27 (first draft). video shortcode with source modes, about twenty parameters, gif=true, and opt-in facades.
  • 2026-11-27 (review). Moved to native image syntax with three media attributes, an accessible autoplay gate, platform URLs as identity, and a per-platform params.video_embeds list.
  • 2026-11-27 (implementation). Implemented in content/media-detect.html, content/media.html, content/video-embeds.html, assets/js/media.js and assets/css/td/media.css, with the lookup extracted into content/resource-lookup.html. Differences from this draft: the configuration key is the flat list params.video_embeds (the parameter contract flattens single-key maps); a video without caption or number keeps a td-media wrapper without a figcaption; Print and RSS name the video beside its URL; the locale keys are ui_video_play and ui_video_open. Both network settings are validated on every page. Eight invalid-input cases were added to bin/check-media-primitives.py, and tests/js/media.test.js covers the runtime.
  • 2026-11-27 (review hardening). Fixed decimal parsing for leading-zero timestamps (08s, 010), expanded platform URL parsing (youtube-nocookie.com, music.youtube.com, player.vimeo.com, Vimeo ?h= and #t=, uppercase AV, b23.tv/BV…, trailing slashes, and 9:16 default ratio for YouTube Shorts), decoupled poster image dimensions from paired width/height aspect ratios, replaced setTimeout(0) autoplay event tracking with a FIFO expected-event queue, added iframe sandbox and tightened allow and the runtime player-URL regex, excluded .td-media-card__poster from Draw.io detection, fixed dark-mode play-button contrast, poster scrim contrast, narrow-screen card grid overlap, portrait 80vh symmetry, forced-colors styling, RTL play-icon alignment, and Print/RSS watch URLs (including browser print after iframe replacement). Added zero-binary media-type and video matrix checks in bin/check-media-primitives.py, video_embeds item enum generation in bin/generate-config-schema.py, and tests/browser/video.spec.mjs.
  • 2026-11-27 (acceptance review fixes). Cards carry their ratio as --td-media-ratio and cap their width at min(100%, 80vh × ratio) (card and player), because WebKit does not narrow a box whose aspect-ratio height max-block-size clamps; where container units exist the ratio is a minimum height measured from the figure, because WebKit also keeps an aspect-ratio box at its ratio height and clipped wrapped titles. Browser print gives poster-less card text the paper ink in dark mode. Draw.io skips only images inside a.td-media-card again, leaving other linked diagrams editable. Bilibili’s embed-code src, player.bilibili.com/player.html?bvid=…|aid=…, is recognized instead of rendering as a remote image. Covered by the video matrix and a stylesheet contract in bin/check-media-primitives.py, tests/js/drawio.test.js and tests/browser/video.spec.mjs.
  • 2026-11-28 (control row). File videos share audio’s theme control row: one seek bar whose colors tell played, buffered and unloaded time apart, speed, a captions toggle for the one track, mute and volume, and full screen on the figure with the row kept under the picture (iPhone falls back to the native player). Clicking the picture toggles playback. Native controls remain the no-JavaScript fallback.

10 - Map component

A map data fence whose place list is always the content, progressively enhanced with an opt-in OpenStreetMap-ecosystem map through vendored Leaflet and a site-chosen tile service.
Accepted in OINK 1.7.0

Shipped in OINK v1.7.0, documented in the Map guide, and governed by the Components contract. Shared decisions are in the overview.

Record Value
Status Accepted and shipped in OINK v1.7.0 (implemented 2026-11-27)
Owner OINK maintainers
Delivery stage S5; photo pins from GPS metadata later
Form Data fence: ```map with a YAML or JSON list of places
New public API The map fence and its fields; configuration params.map
Runtime None by default; vendored Leaflet through content-components.js when maps are enabled
Affected surface layouts/_markup/render-codeblock-map.html, scripts.html, content-components.js, VENDOR.json, a stylesheet layer, the configuration schema, three locale keys, a new guide at /docs/components/map/

Summary

```map {caption="Kyoto in three days" route=true}
- name: Kinkaku-ji
  lat: 35.0394
  lng: 135.7292
  text: Quietest right after opening.
  image: kinkakuji.webp
  link: "#day-1"
- name: Kiyomizu-dera
  lat: 34.9949
  lng: 135.7850
```

HTML, Print and RSS render a numbered list with names, notes, thumbnails and OpenStreetMap coordinate links. Markdown and LLMS preserve the authored fence. When a site enables maps and names its tile service, an interactive map with matching numbered markers appears above the list in HTML. Nothing is enabled, and no tile service is chosen, by default.

Problem

Travel writing, photo essays and Expo pages, event and office locations, field trips, and site visits need places on a map. Authors use screenshots (static, no links, stale), Google Maps iframes (API keys, billing, terms, regional blocking, third-party scripts), or nothing. OINK has no way to say “these places, in this order” that also survives Print, feeds, and agents.

Design principles

  1. The list is the content; the map enhances it. A reader without the map (Print, RSS, no JavaScript, a blocked tile host) gets the same places, in the same order, with working links.
  2. Network only after complete configuration. Tiles are third-party requests from the reader’s browser. As with Draw.io, the theme ships no default server and stays off until configured (architecture contract).
  3. The site chooses the tile service. Tile services have usage policies, quotas, keys, and attribution terms. A theme default would make that legal and operational choice for every site.
  4. One form. A fence holds one place as easily as twenty; there is no second shortcode.
  5. WGS 84 coordinates. The system used by GPS, photo metadata, and OpenStreetMap.

Goals and non-goals

Goals

  • A static list in HTML, Print and RSS and the original place data in Markdown and LLMS, with zero configuration.
  • An opt-in interactive map: numbered markers, popups with name, note, thumbnail, and link, an optional route line, and dark tiles when provided.
  • No page scroll hijacking, keyboard operation, and localized controls.
  • Vendored engine, loaded only on pages that need it.

Non-goals

  • Google Maps, Mapbox SDKs, or any API-keyed engine bundled by the theme.
  • A theme-chosen default tile service.
  • A single-point map shortcode, named tile styles, custom marker icons or tones, or a static fallback image parameter in the first stage.
  • GPX or GeoJSON tracks, clustering, search, routing, or geocoding.
  • Coordinate transforms for GCJ-02 or BD-09 tiles (see limitations).
  • Map tiles or images generated at build time.

Proposed behavior

Places

The fence body is a YAML or JSON list. Each item:

Field Rule Invalid input
name Required, plain text Item skipped with a warning
lat Required number, −90 to 90 Item skipped with a warning
lng Required number, −180 to 180 Item skipped with a warning
text Optional plain text —
image Optional image through the shared image resolver; a local raster is resized for the list and popup Unresolvable: warns, no thumbnail
link Optional URL through the shared URL policy; a same-page #anchor is the common case Invalid: warns and is dropped

Unknown fields warn. A fence with no valid place warns and renders nothing. Explicit lat/lng keys avoid the latitude/longitude order confusion of GeoJSON’s [lng, lat] arrays.

Fence attributes

Attribute Rule
caption Plain text figure caption
route true connects places in list order with a line
zoom Integer 1–22 (implemented range; drafted as 1–19). Default: 15 for one place; fit all places otherwise
height A positive px, rem, em, vh or vw length; a percentage or zero warns and keeps the default, a responsive frame capped below the viewport height
id Validated element ID
tab, group, value The shared adjacent-tab behavior; the map resizes when its panel is shown

num is not supported, as for other diagram fences; wrap the fence in fig when a Book number is needed.

Static form

HTML, Print and RSS use this static list.

<figure class="td-map">
  <ol class="td-map__places">
    <li>
      <span class="td-map__name">Kinkaku-ji</span>
      <span class="td-map__text">Quietest right after opening.</span>
      <a href="https://www.openstreetmap.org/?mlat=35.0394&amp;mlon=135.7292#map=16/35.0394/135.7292" rel="external">35.0394, 135.7292</a>
    </li>
    …
  </ol>
  <figcaption>Kyoto in three days</figcaption>
</figure>

Coordinates are shown as authored. The OpenStreetMap link is an ordinary outbound link, not a request.

Configuration

params:
  map:
    enable: false
    tiles: ""        # required: HTTPS template with {z}, {x}, {y}; {s} and {r} allowed
    attribution: ""  # required: the plain-text attribution the tile service demands
    dark_tiles: ""   # optional: used while the page is in dark mode
    max_zoom: 19     # optional

enable: true with a missing or invalid tiles or attribution warns and leaves maps off. The guide shows configuration examples — OpenStreetMap’s standard tiles (light use under the OpenStreetMap Foundation tile usage policy, attribution required), a commercial service with a domain-restricted key, and a self-hosted server — without making any of them a default. A key in a tile URL is public; the guide says so.

Interactive map

When params.map is complete and the output is HTML:

  • The figure gains a canvas and a JSON copy of the validated places; hasMap selects the content-components.js adapter and registers the leaflet engine in data-td-component-engines. Leaflet’s stylesheet is linked only on those pages, as the Asciinema player’s is.
  • The adapter mounts each map within 320px of the viewport, like the other engines.
  • Markers are numbered HTML markers matching the list numbers, styled with preset tokens; no marker images.
  • Popups are built with DOM APIs (textContent, element creation) from the JSON: name, note, thumbnail, link. No innerHTML.
  • Scroll-wheel zoom is off, so reading never zooms the map. Zoom buttons, keyboard control, and pinch remain. On narrow screens the frame stays shorter than the viewport so the page can always be scrolled past.
  • With dark_tiles, tiles follow the color scheme; without it, light tiles stay (no color inversion of map imagery).
  • Size is recomputed on resize, when a tab panel is shown, and when a disclosure opens.
  • Attribution uses Leaflet’s attribution control with the configured text.
  • If the engine or tiles fail, the canvas hides and the list remains.

The list stays visible under the map as its legend and as the accessible alternative.

Outputs

Output Result
HTML, maps off Static form only; no canvas, script, or tile URL
HTML, maps on Map above the static form
Browser print Print rules hide the canvas; the list prints
Dedicated Print Static form
Markdown / LLMS The authored fence
RSS Static form with absolute thumbnail URLs

Engine

Leaflet (BSD-2-Clause) is small, needs no WebGL, and supports HTML markers and keyboard control. On 2026-11-27 npm lists 1.9.4 as latest and 2.0 in beta (2.0.0-beta.5, 2026-11-19). Vendor the current stable release at implementation time, with license, version, source, and checksums in VENDOR.json. If 2.0 is stable by then and is distributed only as an ES module, the engine loader (a classic script with a readiness check) needs a matching change first.

MapLibre GL with vector tiles or a single PMTiles file on object storage is the stronger long-term route to self-hosted maps, at a larger size and with WebGL. The fence format is engine-neutral, so a later proposal can switch or add an engine without changing content.

Photo pins from GPS metadata

A place with a local photo and no coordinates could take its position from the photo. Verified on Hugo 0.170.1:

  • Image.Exif was deprecated in Hugo 0.155 and is now removed.
  • Image.Meta returns Lat/Long only when the site’s imaging.meta.fields includes the GPS fields. Hugo’s default field filter excludes GPS, and a theme cannot change a site’s imaging configuration.
  • Published original photos keep their GPS data unless stripped, which can reveal private locations.

This is therefore a later stage: explicit coordinates first, then GPS-derived pins as a documented site opt-in with a privacy note.

Accessibility and privacy

The numbered list conveys everything the map does. Map controls get localized names. Tile requests send the reader’s IP address and the viewed area to the tile service, only after the site enables maps and only when a map comes into view.

Limitations

Coordinates are WGS 84. Map services in mainland China commonly use GCJ-02 (or BD-09), so WGS 84 markers on those tiles appear offset by hundreds of meters. The first stage documents this and supports only WGS 84 tiles. A later params.map option could convert markers for GCJ-02 tiles if a site needs it.

Trade-offs and alternatives

Option Decision Reason
Google Maps Rejected Keys and billing, terms that restrict caching, regional blocking, third-party scripts
First-draft single-point {{</* map */>}} shortcode Removed A second form for what a three-line fence expresses
CARTO light/dark tiles as the default Removed A commercial service with its own usage terms; the theme should not choose it for every site
styles, center, marker icon and tone, fallback image, full Removed for now Numbered markers tie the map to the list; a fallback image duplicates the list
Hiding the list when the map mounts Rejected The list is the legend, the accessible alternative, and the print form
Static map images rendered at build Rejected Needs tiles at build time, contradicting offline builds
Click-to-load maps Shipped as loading: click Lazy loading on approach is the engine norm and stays the default; params.map.loading: click waits for an explicit button where privacy review or touch scrolling demands it

Costs: a vendored engine to maintain, a configuration step before any map appears, and no default look out of the box. These follow directly from the network policy.

Compatibility

Additive. map is a new fence language and params.map a new key. With maps off, a page with a map fence is fully readable.

Implementation plan

  1. Vendor Leaflet under assets/third_party/leaflet/ with VENDOR.json entries.
  2. render-codeblock-map.html with a parse partial (validation, thumbnails via the image resolver and processing), static form, and enabled form.
  3. params.map in hugo.yaml, the resolver with Draw.io-style completeness warnings, bin/check-params.py, and the generated configuration schema.
  4. A leaflet adapter in content-components.js; scripts.html engine and stylesheet registration; unit tests with a stubbed engine.
  5. Locale keys in all 32 files: ui_map_label and ui_map_open_osm; the zoom controls reuse ui_diagram_zoom_in and ui_diagram_zoom_out.
  6. Fixtures: maps off and on, one and many places, invalid places, route, thumbnails from each source kind, tabs, and each output. Owning checks: check-components.py (data fences), check-runtime-isolation.py, check-vendor.py, check-output.py, check-output-security.py, check-goldens.py, check-stylesheets.py, check-params.py, check-i18n.py, node --test.
  7. Browser review on this site with a configured tile service: keyboard, touch scrolling, dark tiles, tabs, presets, print.

Acceptance criteria

  • With maps off, no output contains a tile URL, the Leaflet script, or its stylesheet.
  • With incomplete configuration, the build warns and behaves as maps off.
  • The list is identical with maps on and off.
  • Scroll-wheel input over a map scrolls the page.
  • Popups contain no author HTML.

Open decisions

  1. List presentation under the map. Recommended: always visible, compact. Alternative: collapsible for long lists.
  2. Marker style. Recommended: numbers only in S5; icons later on request.
  3. Engine version. Recommended: decide between 1.9.4 and 2.x when S5 starts.
  4. GCJ-02 support. Recommended: out of scope until a site asks.

Decision log

  • 2026-11-27 (first draft). map fence plus single-point shortcode, CARTO default tiles, named styles, marker icons and tones, fallback images, and EXIF pins in C3.
  • 2026-11-27 (review). One fence; no default tile service; the list is always rendered; EXIF pins moved to a later stage after verifying Hugo’s Image.Meta defaults.
  • 2026-11-27 (implementation). Implemented with vendored Leaflet 1.9.4 (VENDOR.json), render-codeblock-map.html, content/map-config.html, a leaflet adapter in content-components.js and assets/css/td/map.css. Differences from this draft: the fence is parsed as YAML by resource name, because Hugo’s content sniffing reads a YAML list written as - {name: …} as JSON; the zoom controls reuse ui_diagram_zoom_in and ui_diagram_zoom_out, so only ui_map_label and ui_map_open_osm are new; params.map is validated on every page. Invalid input is covered in bin/check-content-primitives.py and bin/check-params.py; tests/js/content-components-map.test.js covers the adapter.
  • 2026-11-27 (review hardening). Fixed {s} subdomain tile validation and YAML .nan coordinate build crash; raised selector specificity in map.css to outrank body-end leaflet.css, aligned popups/controls/focus rings across all four presets and dark mode, fixed popup close-button overlap, dark-mode print ink, slate dark --td-on-link, RTL popup/coordinate direction, forced-colors popup border, and print pagination; added touch single-finger scroll pass-through, keyboard-nav.js map-focus yield, complete tile-failure canvas hiding, prefers-reduced-motion support, marker aria-label, Escape popup dismissal, localized close label, tabs.js-first ordering for hidden tabs, list-click panning, and rich-copy.js canvas exclusion; added optional attribution_url (OSM copyright link compliance), subdomains, and loading: click (32-locale ui_map_load), plus Playwright regression coverage in tests/browser/map.spec.mjs.
  • 2026-11-27 (adversarial review). A non-string params.map.loading (a list or map) stopped the build, because cond evaluated strings.TrimSpace on it; it now warns and keeps lazy. Tile templates may use only {s}, {z}, {x}, {y}, {-y} and {r}: any other placeholder, in the host, path or query, warns at build time, since Leaflet throws on one it cannot fill and left an empty map. When every first tile fails, the map is removed only after Leaflet finishes dispatching the layer’s load, which otherwise threw a TypeError; failing dark_tiles fall back to the dimmed light tiles instead of removing the map for good. The loading: click button names every host the map may contact, {s} as * and the dark_tiles host included. tests/browser/map.spec.mjs runs in test:content-components. Minor follow-ups: a pen drags the map like a mouse; a popup opened with Enter takes focus and returns it to its marker when closed from inside; a load button activated from the keyboard hands focus to the map; params.map.subdomains is documented as empty by default (Leaflet’s abc); ui_map_load reads “Завантажити мапу” in Ukrainian and “טעינת המפה” in Hebrew.

11 - Social post component

A static, offline card for quoting a post from X or another social platform, written as a > [!SOCIAL] callout — author, handle, avatar, date, link, and a Markdown body — with no build-time fetch and no runtime.
Shipped in OINK 1.8.0 as > [!SOCIAL]

The > [!SOCIAL] callout form ships in OINK v1.8.0. The Social posts guide documents it, the Components contract governs it, and shared decisions are in the overview.

Record Value
Status Accepted and shipped in OINK v1.8.0 (> [!SOCIAL] callout form, 2026-11-28)
Owner OINK maintainers
Delivery stage S3
Form Callout with a Markdown body: > [!SOCIAL] Name `@handle` plus a block attribute line
Public API Callout type social; title as the identity line; attributes avatar, date, url, platform; locale key ui_social_view_original
Runtime None
Implementation layouts/_markup/render-blockquote-alert.html, layouts/_partials/content/social.html, assets/css/td/social.css, fixture tests/site/content/fixtures/social.md, migration bin/migrations/oink06/transforms/social.py

Summary

> [!SOCIAL] OINK Example `@oink_example`
>
> The post text, in ordinary **Markdown**, with its line breaks and links.
>
> ![The screenshot attached to the post](demo.webp)
{avatar="/logo.svg" date="2026-02-15" url="https://example.com/oink_example/status/1" platform="x"}

The card shows the avatar, name, handle, platform icon, body, attached images, date, and a link to the original. Everything comes from the page; nothing is fetched at build or view time. platform (default none) selects the icon for X, Bluesky, Mastodon, Threads, Weibo, Zhihu, Telegram, or LinkedIn posts with the same layout. Outside Hugo the source is an ordinary blockquote, so GitHub, an editor preview, or Obsidian shows the name, text, images, and any quoted post.

Problem

Hugo’s built-in x shortcode requests oEmbed data from X at build time (Hugo caches the response locally, so a clean build such as CI fetches it again), and the resulting embed loads widgets.js in the reader’s browser. For OINK that means:

  • the build needs the network, contradicting the rule that a normal build downloads nothing, and fails where X is unreachable;
  • readers load a third-party script with tracking and layout shift;
  • the quote disappears when the post is deleted, made private, or the account is renamed;
  • the card ignores OINK’s presets, color schemes, Print, Markdown, and RSS.

The v1.7.0 social shortcode solved those, but its source read poorly outside Hugo: in plain Markdown the opening tag and the first line of the post merge into one paragraph, the closing tag hangs off the last one, and a parameter avatar never shows. Its Markdown output also needed a second, hand-built attribution renderer.

The common workaround, a screenshot, is inaccessible (text in pixels), not searchable, and absent from LLMS output.

Design principles

  1. A quoted post is a quotation. It renders as <figure> + <blockquote cite> + attribution — an editorial card that reads as a citation, not a pixel copy of the platform.
  2. The page holds the content. The author saves the text and media once; the theme renders what is there and never fetches.
  3. Compose the body. Images, galleries, and quoted posts are written with syntax OINK already has, so the card needs no parameters for them.
  4. The platform identifies, it does not restyle. One layout for all platforms; platform changes only the icon.
  5. Leave Hugo’s names alone. The component has its own name, so Hugo’s embedded x keeps working exactly as Hugo documents it.
  6. Markdown first. A quoted post is a blockquote with attribution, which Markdown already writes. The callout title is the one slot Goldmark hands over separately, so it carries the identity line, and block attributes carry the facts Markdown has no syntax for.

Goals and non-goals

Goals

  • A recognizable, accessible post card with zero network use and zero JavaScript.
  • Text, links, images (with Image Zoom), multi-image grids, and one level of quoted post.
  • The same static card in Print, the author’s own blockquote in Markdown and LLMS, and a blockquote with attribution in RSS.
  • A source that reads as a quotation in any Markdown viewer.

Non-goals

  • Fetching anything, at build time or in the browser; the theme never calls a platform API.
  • Overriding or changing Hugo’s built-in x shortcode.
  • Engagement counts (likes, reposts, replies, views) and verification badges.
  • Per-platform skins, brand colors, or imitation of a platform’s interface.
  • Threads, replies, polls, or video playback inside the card. A post’s video is written as a Video in the body.
  • GitHub issues, Hacker News, Reddit, or link-preview “bookmark” cards; their data shapes differ.
  • A data-file form or an author registry in the first stage.

Behavior

Title and attributes

Part Rule Invalid input
Title The identity line, rendered as written with inline Markdown. Each code span becomes the handle (<span class="td-social__handle" dir="ltr">); the rest is the name Missing: see below
avatar Image path through content/image-resolve.html (parameter="avatar"); decorative (alt="") because the name is adjacent Unsafe scheme or non-image resource: warns naming avatar and drops; a static path missing from the project’s own static/ (checked only when that directory exists, after decoding and cleaning the path): warns with the ID social:avatar-static, which a site using module mounts or a custom staticDir can list in ignoreLogs, and keeps the path; a static path that climbs above the site root with ..: warns (social:avatar-static), is dropped, and the card draws the initial; remote HTTPS URLs are never fetched
date Plain text. YYYY-MM, or YYYY-MM-DD optionally followed by T or a space, HH:MM, optional :SS, and an optional Z or ±HH:MM, on a real calendar day, becomes <time datetime> (the space written as T); anything else renders as <span class="td-social__date"> —
url Original post, through the shared URL policy (HTTP/HTTPS with rel="external", or site-internal path without rel="external"). Optional, so a deleted post can still be quoted Invalid: warns and is dropped
platform x, bluesky, mastodon, threads, weibo, zhihu, telegram, linkedin, none (default at every depth) Unknown or empty: warns, uses none

content/attributes.html validates the attribute line: class, data-* and aria-* pass to the figure, and any other name warns. Attribute values are strings, so the shortcode’s type warnings have no counterpart. A + or - fold marker warns and is ignored.

A title is required. Without one, the callout warns and renders the body as a plain blockquote (or a blockquote link when the body is empty and url is valid), so the quoted words are not lost. With a body, url survives only as the quote’s cite attribute; date, platform and avatar are ignored. Without an avatar, a circle shows the first grapheme cluster of the title’s plain text after leading @, spaces, and invisible format characters are removed, falling back to a person icon if nothing visible remains; no default avatar or Gravatar is requested.

The render hook cannot see an enclosing callout, which is why the default platform is the same at every depth instead of x on top-level cards.

Body

The body is the callout’s own Markdown, rendered with the page:

Content Written as
Text, line breaks, links, code Ordinary Markdown
One attached image A Markdown image; it gets Image Zoom when eligible
Several images A gallery fence inside the body (compact grid matching the card radius)
A quoted post A nested > [!SOCIAL], whose attribute line carries one >; it is styled by the .td-social .td-social descendant selector
A video A Video image line

Footnotes in the body resolve like any page footnote. An empty body warns; with a valid url the card renders as a link-only card (or a blockquote link without a title), otherwise it renders nothing.

Rendering

<figure class="td-social td-social--x">
  <figcaption class="td-social__author">
    <img class="td-social__avatar" src="/logo.svg" alt="" loading="lazy" decoding="async">
    <span class="td-social__names" dir="auto">OINK Example <span class="td-social__handle" dir="ltr">@oink_example</span></span>
    <i class="td-social__platform fa-brands fa-x-twitter" aria-hidden="true"></i>
    <span class="visually-hidden"> · X</span>
  </figcaption>
  <blockquote class="td-social__body" cite="https://example.com/oink_example/status/1">…</blockquote>
  <p class="td-social__meta"><a href="https://example.com/oink_example/status/1" rel="external"><time datetime="2026-02-15">2026-02-15</time> · View original<span class="visually-hidden"> — OINK Example @oink_example</span></a></p>
</figure>
Platform Icon (vendored Font Awesome 7.3.1)
x fa-brands fa-x-twitter
bluesky fa-brands fa-bluesky
mastodon fa-brands fa-mastodon
threads fa-brands fa-threads
weibo fa-brands fa-weibo
zhihu fa-brands fa-zhihu
telegram fa-brands fa-telegram
linkedin fa-brands fa-linkedin
none None

The icon is decorative and monochrome; the platform name is available to assistive technology as visually hidden text when present. The card uses elevated surface tokens (--td-brand-elev) with --bs-body-bg for nested quotes, keeps body typography independent of blockquote’s Kai rule, and follows each preset’s geometry (0px in Ink, 2px and square avatar in Terminal). Print maps the card to --td-print-* tokens regardless of screen color mode and prints the original URL after the link. RTL mirrors through logical properties while isolating LTR handles and ISO timestamps; long handles and URLs wrap.

Outputs

Output Result
HTML The card; no runtime. Body images opt into the shared Image Zoom as usual
Print The static card on the paper palette with the URL visible
Markdown / LLMS The callout exactly as written, with its attribute line; a nested post stays a nested blockquote
RSS A <figure> with <blockquote cite> (omitted on link-only cards) and an attribution line using absolute URLs, the handle as plain text; no avatar

Hugo’s own x

Hugo’s embedded x shortcode remains available and unchanged: it fetches oEmbed data at build time and loads X’s script in the browser. OINK does not intercept it. The guide recommends the [!SOCIAL] callout for offline, permanent quotes.

Overriding x was the first plan and was rejected after a probe on Hugo 0.170.1: a shortcode template that reads .Inner makes Hugo’s parser require every call to be closed or self-closed, so Hugo’s documented unclosed form {{</* x user="…" id="…" */>}} would fail to build (shortcode "x" must be closed or self-closed) before any template could warn.

Rights and archiving

The theme stores nothing by itself. Authors decide what they may quote and which avatars and media they may keep; the guide says so. A card persists after the original is deleted, which is the point of offline quoting; url is optional so the author can drop a link that no longer resolves.

Trade-offs and alternatives

First-draft element Decision Reason
The name x, replacing Hugo’s built-in Renamed social (owner, 2026-11-27) No conflict with Hugo, no parse failure for existing x calls, and the name reads naturally for every platform
likes, reposts, replies, views Removed Snapshots that go stale and mislead; four locale keys
verified (blue, gold, gray) Removed Platform-specific, changes over time, and implies verification the theme cannot perform
images and image_alts lists Replaced by body images and gallery Alt text stays next to each image; Zoom, processing, and resolution come for free
quote_author, quote_handle, quote_date, quote_url, quote_text Replaced by a nested social Same parameters, same rules, no parallel set
data= file form Removed A data file per post is a second authority; a helper can write shortcode text
data/x_authors.yaml registry and automatic assets/avatars/<handle>.* lookup Removed for now avatar="avatars/name.jpg" already shares one global file; implicit file lookups are hard to discover
github, hackernews, reddit platforms Removed Titles, threads, and missing avatars are a different component
Automatic handle prefixes per platform Removed Handles are shown as written
Per-platform styles One layout Presets own color; platform redesigns would otherwise date the theme
The social shortcode with six parameters (shipped in v1.7.0) Replaced by the [!SOCIAL] callout (owner, 2026-11-28) The source reads as a quotation in any Markdown viewer, Markdown and LLMS output is the source itself, and footnotes, Image Zoom and other hooks apply to the body without a block renderer
A plain blockquote with a closing — Author line and {.social} Rejected The hook would have to parse the attribution out of rendered HTML to lay out the header and the date line
An avatar written as a Markdown image in the title Rejected A probe on Hugo 0.170.1 shows that an image ends the alert title: text after it moves into the body, and a trailing image leaves an empty paragraph
The date link written in the title Rejected It would hide the date and URL in a presentation string and lose <time>, cite, and the RSS absolute URL
Reusing [!QUOTE] with social attributes Rejected Attributes would decide whether one type renders as a callout box or a card

Companion helper

Writing the parameters by hand is the main friction. A future oink fetch social <url> in ../oink-cli could, once at writing time, download the avatar and media into the page bundle and print a ready [!SOCIAL] callout. It is outside this proposal and needs its own oink-cli proposal, because the endpoints it would use are unofficial, may change or be restricted, and raise terms-of-use questions. The theme never depends on it.

Compatibility

  • v1.7.0 added the social shortcode, taking the count from 29 to 30.
  • The callout form removes it again (30 back to 29) and adds the social callout type. A page that still calls the shortcode fails to build with template for shortcode "social" not found.
  • bin/migrations/oink06.py migrate --only social rewrites every call: author becomes the title text, handle a code span, the other parameters the attribute line, and a nested call a nested callout. It writes platform="x" on top-level cards that relied on the shortcode’s default and reports calls it cannot express. On vonng.com it converted 492 calls (89 nested) in 149 files with no findings, and 88 cards rendered from four converted bundles matched the v1.7.0 cards in platform, nesting, images, links, dates and visible text.
  • Block attributes need markup.goldmark.parser.attribute.block: true, which OINK already requires.

Implementation and checks

Part Where
Template layouts/_partials/content/social.html, reached from the social branch of layouts/_markup/render-blockquote-alert.html (shared attribute, URL and image partials; static Print and RSS branches)
Styles assets/css/td/social.css
Locale ui_social_view_original in all 32 catalogs
Fixture tests/site/content/fixtures/social.md and its Chinese peer, pinned by HTML, Markdown, Print and RSS goldens
Invalid input Thirteen social-* cases plus check_social_posts() and template/CSS contract checks in bin/check-content-primitives.py; bin/check-components.py keeps the shortcode deleted and failing as missing; Playwright coverage in tests/browser/social.spec.mjs
Migration bin/migrations/oink06/transforms/social.py, frozen by tests/migrations/test_oink06.py
Guide Social posts

Acceptance criteria

  • A build with network access disabled renders every fixture.
  • No social page requests anything from a platform host, at build or view time.
  • Markdown and LLMS contain the source callout and no component HTML.
  • A plain Markdown viewer shows the name, handle, body, images and quoted post as a blockquote.
  • Invalid input warns and keeps the quoted words whenever a body exists.
  • Preset, color-scheme, narrow-screen, RTL, forced-colors, and print reviews pass.

Open decisions

  1. Platform list. Expanded to x, bluesky, mastodon, threads, weibo, zhihu, telegram, linkedin, and none. Add another platform only with a vendored icon and an author request.
  2. Author registry. Recommended: not yet; reconsider after real pages show repeated metadata.

Decision log

  • 2026-11-27 (first draft). Offline x with a platform enum of eight, metrics, verification badges, image and quote parameter sets, a data-file form, and an author registry.
  • 2026-11-27 (review). Reduced to six parameters and a composed Markdown body; recorded the verified parse failure for legacy x calls.
  • 2026-11-27 (owner). Renamed to social to avoid conflicting with Hugo’s x; platform keeps the other platforms.
  • 2026-11-27 (implementation). Implemented as specified, with the platform name added as visually hidden text and the print rule showing the original URL after the link.
  • 2026-11-27 (deep review & hardening). Fixed dark-mode print cutout, nested CSS specificity, RTL BiDi isolation, nested platform SR symmetry, anonymous empty+url output, HTML5 <time> validation, grapheme initial slicing, compact card gallery layout, CJK body font isolation, forced-colors avatar border, offline static/ avatar warning, and context-aware Markdown inline escaping; added zhihu, telegram, and none platforms and Playwright regression coverage.
  • 2026-11-27 (adversarial review). Initials skip invisible leading characters (zero-width space, BOM, bidi marks, any Unicode space); the static avatar check decodes and cleans the path, warns on .. above the site root, and makes its missing-file warning suppressible as social:avatar-static; Markdown ends every card with a blank line so adjacent cards stay separate quotations; the guide’s date, avatar-resolution and anonymous-card wording now matches the implementation.
  • 2026-11-28 (owner). Markdown first: what Markdown can present is not converted. The shortcode’s source read poorly in plain Markdown, so the card becomes the > [!SOCIAL] callout; the title is the identity line with the handle as a code span, and avatar, date, url and platform become block attributes. Probes on Hugo 0.170.1 confirmed that the title keeps inline Markdown, that attributes attach directly under a callout and under a nested one with a single >, and that an image cannot sit in the title.
  • 2026-11-28 (implementation). The shortcode and content/markdown-escape-inline.html are deleted; the card renders from content/social.html; platform defaults to none at every depth because the hook cannot see a parent; nested styling moves to a descendant selector and the deeper-nesting warning is dropped; Markdown and LLMS keep the source; the migration toolkit gains a social transformation.

12 - OINK CLI and the next product stage

The accepted independent CLI boundary and local first-stage scope, with later adoption, theme, migration, and content-model work still proposed.
Local first-stage candidate; later roadmap remains draft

The independent Go repository pgsty/oink-cli and first-stage development were authorized on 2026-09-29. Its six commands now have a local 0.1.0-dev implementation, with final local acceptance recorded separately. Current behavior belongs to the CLI decision and result contract and CLI introduction. Theme 1.2, its tooling descriptor, Docsy migration, version lifecycle, OpenAPI, MCP, and Studio remain proposals.

Record Value
Status Repository choice and first-stage scope accepted. Local candidate implemented and validated. Later roadmap remains draft
Owner OINK maintainers
Date 2026-09-29
Scope OINK theme, independent CLI, existing Starter, and documentation site
Affected contracts Architecture, configuration/diagnostics, outputs, migration, and later version navigation/API content
Source snapshot Theme HEAD 3a18234, documentation HEAD 85f16bf, Starter HEAD 137843b, plus the explicitly identified local work below

Recommendation

Create a separate oink-cli repository, publish one executable named oink, and keep OINK as the single product identity. The theme renders content. The CLI helps users initialize, inspect, validate, upgrade, and eventually migrate their sites. The documentation site continues to own public guides, bilingual design records, and integration acceptance.

The CLI contract owns first-stage behavior, while the dated acceptance record lists executed checks and remaining limits. This roadmap stays active for its later stages and adoption targets.

The first release should improve the path from an existing repository to a reliable publication. Its four main workflows are doctor, check, init, and upgrade. dev and build may provide small, transparent Hugo shortcuts. A supported Docsy migration path follows evidence from actual input repositories. Version lifecycle and OpenAPI generation come after that first usable release, with one major content-model project active at a time.

Keep the theme usable without the CLI. Commit or otherwise deliver generated Hugo inputs. After you remove the CLI, ordinary Hugo must still be able to build the site. Regenerating those inputs remains a separate operation.

Product position and target user

Recommended public description:

OINK is a local-first documentation toolkit built on Hugo, publishing engineering knowledge for readers and agents.

Retain “Hugo theme” in installation and discovery pages because it describes what users install, while “knowledge compiler” describes the internal architecture. A new name should keep the current Markdown/Hugo workflow clear.

Prioritize Git-oriented maintainers of open-source infrastructure, developer tools, and multilingual technical documentation. They need to get a site working, diagnose failures, upgrade safely, and move content without losing URLs or meaning.

For the first stage, non-goals include a visual CMS, hosted accounts, a deployment control plane, a package marketplace, an LLM runtime, a semantic-search service, and a new rendering engine. Books, blogs, and landing pages remain supported, but their feature catalogs do not drive this roadmap.

Evidence and changes to the research recommendation

This proposal considers the supplied strategy report and checks it against the local implementation, bilingual Design section, Starter, and current primary documentation.

Observation Product consequence
OINK already has a public Starter, generated configuration schemas, migration scripts, publication tools, and focused theme checkers Provide selected workflows as product features. Do not create a second implementation of every tool
The front-matter schema deliberately omits type constraints Strict checks must follow the owning resolvers and actual Hugo output
Existing version support includes a cross-site menu, archive banners, and optional path concatenation Focus on lifecycle and reliable page correspondence
Current version documentation explicitly uses independent Hugo builds Preserve that model initially. Do not silently add a multi-version renderer to one build
OpenAPI widgets become specification links outside HTML and have documented accessibility exclusions Static, accessible endpoint content is a concrete future improvement
Backlinks are implemented. G2/G3 remain draft Graph visualization remains a draft proposal
bin/update-consumers.py exists in this working tree as local maintenance tooling Its release-resolution and preservation rules serve as design input for oink upgrade

The supplied report emphasizes adoption and an optional tools layer. Four changes make its recommendations implementable:

  1. Put safe upgrades alongside initialization and diagnosis. Existing users have an immediate, testable maintenance need.
  2. Separate maintainer regression checkers from consumer checks. A synthetic-fixture checker is not automatically a general-purpose site validator.
  3. Treat migrations as supported input profiles with explicit boundaries rather than complete Docsy or arbitrary MDX conversion.
  4. Replace the simultaneous versioning/OpenAPI/graph/platform program with sequential decisions.

Existing tools illustrate the workflow tradeoffs. Mintlify’s CLI exposes preview, validation, and link checking. Nimbus combines scaffolding and agent-readable output while remaining pre-1.0. Docusaurus makes version snapshots explicit and warns about their maintenance/build cost. Copying Nimbus’s full source-owned UI model would move upgrade work to OINK consumers. Use that pattern for small generated recipes. Keep the upgradable theme module.

Why a separate repository

Option Benefit Cost Decision
Extend Python scripts under theme bin/ Fastest small maintenance improvements. Tests accompany the change Difficult installation and distribution. No unified public command contract Retain for internal and historical tooling
Put cmd/oink in the theme’s root Go module One checkout and atomic source edits Mixes a Hugo asset module with application dependencies, binary releases, and consumer support Do not choose for the public CLI
Use an isolated Go submodule in the theme repository Atomic repository changes without sharing Go dependencies Separate module tags and releases still need management. Code can more easily depend on unpublished theme internals Viable fallback for a prototype with a fixed time limit. Not the preferred product repository
Create pgsty/oink-cli Clear executable boundary, independent releases, no need for users to clone theme internals Requires explicit compatibility and cross-repository acceptance Accepted. Local Go repository created

This decision assigns release and maintenance responsibilities rather than claiming that a monorepo is technically impossible. A nested module can isolate dependencies, and separate repositories still require coordination: a renderer change may need two pull requests, paired contracts, and a compatibility test. OINK already operates a theme/site/Starter split, so that cost is acceptable if the public boundary stays small.

Theme and CLI releases must not share a forced version number. A proposed oink CLI 0.1.x should work with a tested OINK 1.1.0 baseline and the next supported theme release. Declare compatibility per capability. Report unsupported functionality. Do not assume that every schema from the newest theme is valid for every older site.

Do not create separate repositories for the linter, migration engine, OpenAPI generator, or a shared SDK now. They can begin as internal CLI packages. The binary can be built in Go without importing Hugo’s internal Go packages or making the theme module depend on the CLI.

Responsibility map

Surface Owner Boundary
Layouts, components, style, navigation, search, accessibility, output semantics pgsty/oink Executes inside Hugo and the static site
Theme defaults, owning resolvers, generated schemas, output schemas pgsty/oink Authoritative theme behavior and its projections
Theme implementation checks and narrow invalid-input fixtures pgsty/oink Remain maintainer tools, even if implemented in Python or JavaScript
Environment diagnosis, consumer checks, initialization, upgrade; later migration transformations pgsty/oink-cli Initial commands implemented locally; migration remains proposed
OpenAPI parsing and generated source, later version snapshot orchestration Proposed later pgsty/oink-cli capabilities Produces ordinary Hugo inputs; does not own final rendering
Small official site skeleton and language profiles pgsty/oink-starter Single source for CLI initialization. Pinned snapshots can be embedded in CLI releases
Guides, examples, PRDs, accepted rationale, EN/ZH integration/browser review pgsty/oink.pgsty.com Continues as the canonical public documentation and regression site
Hosting credentials, account setup, deployment authorization Consumer workflow Existing CI/provider tools. The first CLI release does not deploy
                          optional oink CLI
                  init / doctor / check / upgrade
                      later migrate / generate
                               |
                               v
              user-owned Markdown + Hugo config + data
                               |
                     Hugo Extended + OINK theme
                               |
               HTML / Print / Markdown / search / indexes
                               |
                  readers / agents / optional adapters

The CLI reads Hugo’s effective configuration, the resolved theme’s published contract artifacts, and rendered outputs. It must not guess the final page tree from filenames or maintain a second navigation resolver. Hugo config exposes effective configuration. Module inspection must also account for replacements, workspaces, and vendoring.

Next theme release: proposed OINK 1.2

This section remains draft. The local CLI candidate works against published OINK v1.1.0. The first-stage CLI decision neither accepts nor requires a 1.2 release or a new tooling descriptor.

Set an adoption objective for this release: a site can explain its configuration and output capabilities to tools, and upgrade without adopting a new authoring model. The release should be small enough to ship independently of the broader roadmap.

Priority Requirement Acceptance
P0 Package a small, versioned tooling descriptor beside existing schemas, describing available schema/output contracts and supported toolchain boundaries Check the descriptor against its owning implementation. The CLI can inspect it from the resolved module. No extra per-page output or runtime request
P0 Make selected high-value configuration diagnostics actionable: parameter, invalid value, expected form, fallback, and owning guide Cover actual onboarding failures such as Goldmark/output/language configuration. Retain ordinary preview warnings and strict publication failure
P0 Preserve one navigation and Markdown authority across reader and machine outputs Existing output and navigation checks continue to cover language, ordering, subpath, and opt-in behavior. No duplicate CLI renderer
P0 Release with a tested Starter snapshot and a reviewed downstream adoption record Validate published module resolution separately from sibling replacement builds. Record consumer pins and deployments independently
P1 Add stable identifiers to the small set of diagnostics consumed by tooling, if the prototype shows they are necessary A focused owning checker verifies each identifier. The CLI never depends on parsing all human warning prose

The descriptor contains release metadata without becoming a configuration authority. Configuration schemas remain generated from current authorities, whose resolver/checker continues to own optional shape validation. A generic renamed-key registry would conflict with the current diagnostic decision. Migration transformations therefore belong to explicit CLI profiles rather than a permanent compatibility path in templates.

No new visual component family is required for 1.2. Correctness, accessibility, and already-demonstrated regressions can still justify changes. Existing media work keeps its own acceptance scope. This roadmap does not require every draft to be complete before release.

First CLI release: proposed 0.1

The commands below are implemented in the local 0.1.0-dev candidate. Their current flags, result semantics, and limits are defined by the CLI contract and CLI introduction.

Command User outcome First-release boundary
oink doctor Understand why the site cannot run or why its environment differs from CI Inspect Hugo Extended/version, module pin and effective source, Starter/toolchain requirements, essential configuration, and enabled outputs. No repair by default
oink check Know whether a publication build and its local references are valid One strict build into isolated output, then check local links/anchors/assets and enabled machine outputs. Report coverage and unsupported checks
oink init my-docs Start a small, neutral site that can be maintained without the CLI Generate from a pinned Starter snapshot into a new/empty target. Select the supported language profile and explicit theme pin
oink upgrade --to <tag> See the exact changes needed for a theme upgrade Preview first. --write applies a reviewed scope after validation. Protect unrelated module dependencies, user changes, and vendored output
oink dev / oink build Use a memorable entry point without learning a second build system Thin Hugo invocations with visible effective arguments. build uses publication strictness. Direct Hugo remains fully supported

check is the single quality entry point. Avoid separate overlapping lint, validate, audit, and check products in 0.1. Later --scope options can separate source hints from rendered-output validation when users need the distinction.

Diagnosis and quality scope

Start with failures that users can act on and that checks can identify reliably: wrong toolchain, unresolved theme, malformed required configuration, missing local link targets/anchors/assets, and inconsistent enabled output references. Resolve routing and anchor truth from Hugo’s output, including language and base-path handling. Do not label a valid custom front-matter key as invalid merely because an editor schema does not list it.

Disabled optional outputs are not missing-output errors. The local candidate does not check translation completeness. Any future completeness rule must use the site’s declared languages and coverage policies. Duplicate titles, orphan pages, missing descriptions, prose style, and freshness remain later optional observations after real false-positive review. Browser accessibility and interaction checks remain in the site Playwright/axe suite.

The local candidate freezes oink.result/v1. Structured diagnostics have stable rule IDs, severity, known locations, explanations, actions, and explicit coverage. JSON stdout contains only the result. Logs go to stderr. No command waits for input. Exit meanings are 0 for completed work with no blocking findings, 1 for policy findings, and 2 for required incomplete work. Required unsupported checks cannot succeed. The result contract owns the detailed fields. Build-derived findings never receive invented line numbers.

Keep raw Hugo errors available as subprocess evidence. A future SARIF export can project from the same result without changing rule semantics.

Upgrade and file preservation

The existing consumer-upgrade script provides local precedents: distinguish declared pin from resolved version, disable both workspace mechanisms for release verification, recognize module replacements, and inspect _vendor. Port those behaviors with focused tests inside the standalone Go binary.

For 0.1, upgrade one explicitly selected site. Multi-site fleet discovery stays with the maintainer script until a consumer need is demonstrated. A normal check may examine an intentional local theme replacement. check --release must verify the declared published release without those replacements. It should report a conflicting go.mod replacement rather than edit it away.

Preview the proposed touched files and verify the prospective upgrade before applying it. Back up only those files, refuse changes to files that changed since the preview, and preserve unrelated dirty work. A failed operation must describe what was and was not applied, with a recovery path that does not overwrite subsequent edits. A dirty repository is not a reason to block read-only diagnosis. Refreshing vendor content requires a separate explicit action.

Do not commit, push, deploy, alter global agent settings, or install system packages as side effects of initialization or repair. Initialization creates the requested named directory. Changes to existing files default to a preview.

Distribution and offline behavior

The local candidate currently provides a tested source/Make installation path and archive preparation on macOS arm64, with other archive targets cross-compiled. A published Homebrew formula and public download/tag installation remain future distribution work.

Use a Go executable with release archives/checksums and a Homebrew installation path. Initially qualify macOS and Linux on tested architectures. Mark other targets experimental until you validate their filesystem and process behavior. The installed CLI itself needs no installed Go toolchain, Python, Node, or account. Hugo remains an external renderer. Initial module resolution still needs the site’s documented Git/Go/Hugo toolchain.

Embed or ship an exact, licensed Starter snapshot for deterministic initialization. Do not fetch a moving main branch on every invocation, and do not maintain handwritten CLI copies of Starter configuration. Check embedded/template drift during CLI release.

Distinguish a cold installation from offline operation. Downloading Hugo, the theme, or an uncached template requires connectivity unless supplied locally. Once dependencies are present, local diagnosis/check/build paths must work without external services. On a cache miss, an offline request must fail clearly without fetching silently. External URL checking, remote specifications, and other network actions are separate opt-ins. No default telemetry or background update check is required.

Migration: the first expansion

Start with a documented Docsy input profile selected from actual candidate sites, reusing the current migration fixtures and report model as evidence. Validate configuration, navigation, assets, languages, and routes as well as Markdown syntax.

Proposed workflow: oink migrate --from docsy --source <site> --output <new-site>. Assess the migration before writing. Apply it only with an explicit flag and a separate destination. Every source item receives one primary status: unchanged-compatible, transformed, manual-review, or unsupported. Counts must reconcile, with reasons and source locations. Custom templates and dynamic behavior remain visible manual work.

Acceptance means source preservation, idempotent supported transforms, no edits inside literal code examples, valid local references, and an explicit old-to-new route report. Prefer unchanged URLs. URL changes require a redirect plan for the hosting target.

Arbitrary JSX, imports, and embedded React/Vue are programs. Do not execute untrusted source to infer their meaning or silently drop unsupported constructs. Start a second framework only after the first profile is reused successfully without maintainer rescue. Full MDX migration is a later product investment.

Next content capability: version lifecycle

After the first CLI is useful, version lifecycle is the default next candidate because it extends OINK’s existing independent-build model. Move OpenAPI ahead only if real API users provide the stronger repeated need. Do not implement both foundations simultaneously with one primary maintainer.

Theme responsibilities: consistent version identity in the reader surface, reliable page switching, archive status, and correctly scoped search/machine outputs. CLI responsibilities: inspect/list versions, prepare a snapshot, validate page correspondence, and change declared lifecycle state. Use oink --version for the executable. A future oink docs version ... namespace would distinguish documentation versions.

Prefer a small version manifest with version label, source reference, base URL, status, and default selection. Keep independent per-version builds and existing external archives. CLI-managed manifests may produce checked-in Hugo configuration; in that mode, authors edit the manifest and configuration becomes a checked projection. Existing manually managed params.versions remains supported. The initial prototype must settle this projection before freezing its format.

Page correspondence needs a logical page key scoped by documentation family, language, and version. Reuse a suitable existing translationKey or explicit stable key before inventing universal UUIDs. You should disclose missing peers and link them to a defined version/section landing page. You should not fabricate an equivalent page or concatenate an unchecked URL. Route aliases handle moves separately from page identity.

Distinct historical content should ordinarily keep its own canonical URL. Do not point every old page at the newest version. Language alternates must refer to genuine translated peers in the same version. Default search and agent bundles stay inside the selected language/version. A cross-version collection, if later needed, is explicit. Archiving preserves the source and records how the built artifact is retained. It does not delete the source or silently redeploy an immutable archive.

NAVJSON v1 currently has closed object schemas. Adding version or identity fields therefore requires an explicit new schema/output contract or a separate artifact, not a supposedly harmless addition to v1. No change to current page identity is justified merely to reserve space for a future graph.

Following capability: static OpenAPI reference

The first OpenAPI product should be a read-only static reference generator. The CLI parses a local specification and supported local references, emits ordinary Markdown/Hugo data, and records source provenance. The theme supplies accessible semantic presentation and the existing output pipeline. Ordinary Hugo then builds HTML, Print, Markdown, search, and agent indexes from those generated pages.

Start with operations, parameters, request/response bodies, and linked schema descriptions. After a parser prototype, explicitly declare supported OpenAPI versions and constructs. Unsupported constructs cannot disappear silently. Scope operation identity to the API/specification. If operationId is missing, the generator can derive a method/path key and warn about identity changes. Reused operationId values across different APIs must not collide.

Keep human-authored guides separate from generated facts. Generation must be deterministic, record source hashes and generator version, detect stale output, and refuse to overwrite unexpected human changes. Check generated source into the site, or supply it as a versioned build input, so rendering itself remains CLI-independent. Resolve remote references in an explicit preparation step. Normal generation must not follow arbitrary external URLs.

Acceptance requires a real user specification in addition to a toy example, complete accounting of supported operations, cyclic-reference handling, stable routes, semantic content in all selected outputs, and accessibility checks with no inherited Swagger/Redoc exclusion for the new static renderer. Measure a representative large specification before promising a throughput target.

Keep existing Swagger/Redoc integrations compatible. Interactive requests, credential handling, SDK generation, mock servers, and an API testing platform are outside this first compiler increment.

Architecture and compatibility rules

Keep CLI internals small: command handling, Hugo/process integration, diagnostics, template loading, and bounded file changes. Add migration and OpenAPI packages when their stages begin. This is a suggested decomposition, not a plugin ABI or public SDK.

Three boundaries need versioning: the CLI’s machine result format, the theme’s public schema/output contracts, and each supported migration/generation input profile. Prefer capability checks over a single “requires newest OINK” rule. A newer unsupported schema must produce a useful compatibility diagnosis.

The CLI cannot import a sibling theme’s private Python modules, depend on a local checkout layout, or download executable checks at runtime. Port selected consumer operations and test their behavior. Keep template-internal checkers in the theme, and make future changes to exposed consumer rules update their owning contract. Keep existing scripts available during the transition. Remove duplication only after the replacement covers supported cases.

No CLI configuration file is required initially. Hugo retains rendering configuration. If repeated usage later justifies a tool-policy file, it may hold ignored paths, rule severity, or a reviewed baseline, but must not mirror params.ui, navigation, languages, or module pins. A reviewed lint baseline cannot suppress a failed Hugo build, an unreadable input, or an unsupported required check.

Roadmap and staffing assumption

Stages 0 and 1 have a local first-stage candidate, with validation details in the acceptance record. The 8–12 week first-stage planning envelope below assumes roughly one full-time implementation owner plus part-time documentation/review help. Toolchain qualification, recruitment, and bilingual review take time; reduce scope before adding parallel work.

Stage Timing from approval Deliverable Exit evidence
0: establish the boundary Weeks 1–2 Accept repository choice; collect failure examples; define result format and supported baseline; prototype read-only doctor/check against current 1.1.0 Starter plus at least three varied real repositories; failures and coverage omissions recorded
1: complete the daily workflow Weeks 3–6 Doctor/check, pinned init, thin dev/build; prospective single-site upgrade and file-preservation tests New users can diagnose a seeded failure; ordinary Hugo still builds generated sites; no unexplained source changes
2: release a bounded product Weeks 7–12 Proposed theme 1.2 + CLI 0.1; compatibility record; docs; qualified installation; limited Docsy migration assessment/pilot First-run study and repeat upgrade use; migration limitations are explicit; published pins and consumer adoption checked separately
3: validate migration and one content model Months 4–6 Harden the first migrator; choose version lifecycle or OpenAPI based on users; propose theme 1.3 / CLI 0.2 as needed At least two real repositories use the chosen workflow; accepted contract precedes compatibility promises
4: earn expansion After month 6 The other content capability, then optional recipes/provenance or agent transport where justified Repeated use and maintenance capacity

If stage 2 overruns, remove migration writing from that release and keep its assessment report. Do not cut upgrade preservation, truthful diagnostics, or independence from the CLI. If no independent team wants the migration profile, stop expanding framework coverage and investigate onboarding/positioning instead.

Freshness/ownership is a later optional quality feature, initially a report whose findings users actually act on. A modification date must never be presented as verification. Ship a handful of useful official page recipes before a registry. Graph G2/G3, MCP, analytics adapters, executable examples, Studio, and managed services each need a specific user problem and capacity decision; this roadmap assigns them no delivery dates. Existing static agent outputs make MCP less urgent than adoption.

Acceptance and product measures

Area Initial target or required property
First successful use With prerequisites already installed, at least 4 of 5 unfamiliar target users reach local preview and a passing strict check within 15 minutes without maintainer intervention; Record cold installation separately
Maintenance value At least three real sites use diagnosis/checks and repeat a supported upgrade; Every failure has an actionable report
Diagnostic precision Triage all blocking findings in the pilot; aim for less than 5% false positives in an explicitly counted labeled sample
Integrity Zero silent content loss; every migration input is accounted for; repeat transforms have no diff; user edits and unrelated dependencies survive
Independence Initialized/generated sites build through ordinary Hugo with provisioned dependencies; optional CLI and output features remain optional
Offline behavior Run the qualified local workflow with outbound access denied after provisioning; record cache misses and explicitly networked features separately
Compatibility Current tested theme baseline and candidate release, pinned site regression toolchain, root/subpath, and EN/ZH cases
Adoption Seek five independent pilot teams within the first stage, and track which reach production and continue using the result at 30/90 days

Use independently maintained production sites as the main adoption measure, verified through public references or voluntary user confirmation. A stable documentation site should not stop counting merely because it has no commit in 60 days. Track theme upgrade recency separately from retention. Stars, download counts, internal consumer count, and agent-generated volume serve as supporting signals.

Track time to first local success, time to production, upgrade effort, and manual migration effort separately. Do not add default telemetry to obtain these measures.

Implementation ownership and validation

Change Owning validation
Tooling descriptor and schema compatibility A focused theme descriptor check plus generate-config-schema.py --check and relevant parameter checks
Diagnostics exposed to consumers Owning resolver/checker cases; CLI diagnostic result/exit-code tests
Existing output behavior check-agent-indexes.py, output/security/navigation checks appropriate to the changed surface
Init and upgrade CLI tests against pinned Starter snapshots and repositories with replacements, vendor content, unrelated dependencies, and dirty target files
Migration Ported/extended transform cases, source-preservation and repeat-run checks; reviewed real-site route/content evidence
Future version/API presentation Theme output checks plus bilingual documentation-site integration, browser, accessibility, responsive, and visual review

Run the smallest owning check first. Public behavior changes still require implementation, checker, and both language contracts in one coordinated delivery. Use the sibling site’s make check, make browser, and make dev workflow for actual integration and visual acceptance.

For a release, separately record local checks, commits, tags, published module/binary resolution, consumer pins, and deployment. Theme release adoption continues through the maintained consumer inventory procedure. Use a coordinated issue/checklist to connect the repositories.

Open decisions and stop conditions

Repository selection and first-stage implementation are settled locally. Remaining release decisions include qualified platforms, the public distribution channel, compatibility claims justified by executed evidence, and independent pilot recruitment.

Result and exit semantics are frozen for the local candidate in the CLI contract. The minimal theme descriptor and stable theme warning identifiers remain separate proposals. Before a versioning beta, settle manifest projections, archive retention, and page correspondence. Before an OpenAPI beta, settle the supported spec subset and generated-source ownership.

Reconsider the separate CLI investment if pilots only need a tiny maintenance script, if rules must repeatedly duplicate template semantics, or if maintaining distribution consumes more effort than the measured user benefit. Keep successful standalone scripts in that case. If evidence changes, reorder versioning and OpenAPI. Do not expand the total concurrent scope.

Decision log and sources

Date Record
2026-09-29 Draft created from the supplied strategy research and local source review. Recommends a separate optional CLI, a small adoption release, bounded migrations, and sequential content capabilities.
2026-09-29 Subsequent user authorization accepted the independent Go repository and first-stage development. A local 0.1.0-dev candidate implements doctor/check/init/upgrade/dev/build. Stable behavior moved to the CLI decision and usage guide. Local acceptance passed for CLI commit e623d93.

Local authorities consulted: Architecture, generated schema decision, migration boundary, version behavior, OpenAPI limits, and graph proposal status. The source inspection also covered theme bin/, schema/nav.v1.schema.json, the existing Starter, and documentation-site build/check commands.

External primary sources were checked on 2026-09-29: the linked Mintlify command reference, Nimbus repository, Docusaurus versioning guide, and Hugo config/module documentation.

13 - oink: preview and multi-version serving from a docs repository

A draft PRD for one lean oink Go binary that orchestrates official Hugo on a Git documentation repository for local preview, self-hosted multi-version serving behind Cloudflare CDN, frozen archives, scoped SQLite FTS5 search, and Brotli-packed .oink packages for Crib, with minimal OINK theme coordination.
Draft, 2026-11-28 (v2 redesign)

This proposal describes a product direction that is not implemented. Do not use it as a configuration or command reference. Current behavior is defined by the architecture contract, the CLI contract and the versions guide.

Status and surface

Status and date: draft (v2 redesign after adversarial review and local benchmarking), 2026-11-28; product requirements and architecture direction, not an implementation contract.

Owner: OINK maintainer.

Baseline: OINK v1.7.0 / v1.8.0-dev (plain CSS, no Sass, no Bootstrap JS); installed Hugo v0.170.1; the local 0.1.0-dev candidate of pgsty/oink-cli (unreleased, no users).

Affected contracts: CLI contract (superseded if this proposal is accepted), Architecture · Outputs and runtime, Shell · Search, actions, and runtime, and the versions guide.

Related proposals: takes over the unimplemented version-lifecycle stage of the CLI roadmap; answers the open question of theme roadmap R2, “native version dimension or independent builds”; delivers the SQLite search backend left open by the local search proposal.

Affected implementation: a new, clean Go repository for the oink binary (pgsty/oink-server, retiring pgsty/oink-cli as archived history); six small, low-coupling OINK theme additions (C1–C6, see theme coordination).

Release intent: staged, delivering local preview (M0) and Git multi-version Hugo serving (M1) first; see milestones. This proposal commits to no release date.

Summary

Run one lean Go binary (oink, ~20 MB) directly against any OINK or Hugo Git documentation repository:

oink                                 # inside a site directory: same as oink dev
oink dev                             # preview the working tree, live reload on save
oink serve                           # production: publish Git branches, tags and frozen archives
oink freeze v3.5                     # snapshot a version before a breaking theme upgrade
oink build -o dist/                  # export static output (for Cloudflare Pages, etc.)
oink build --versions -o pgdoc.oink  # export a compacted, signed read-only .oink archive

oink does not fork Hugo and does not import Hugo’s unstable internal Go packages. It orchestrates the official Hugo binary as an isolated child process (using PATH or an auto-cached, SHA-256-verified official release), stores deduplicated outputs in local SQLite (CGO_ENABLED=0) packed with standard RFC 7932 Brotli clusters, and sits behind Cloudflare’s free CDN without requiring D1 or Workers.

The core model fits in one sentence: Git is the authoritative source, a version is a pointer to a Git ref or frozen archive, rendered output is an immutable content-addressed snapshot, and the server never rewrites HTML bytes.

Four mutually consistent invariants run through the whole design:

  1. Plain Hugo still builds every OINK site unchanged. Ordinary consumers need only the official Hugo binary; removing oink breaks nothing.
  2. Production serves only immutable snapshots with zero cross-request tearing. Production never reads the working tree; failed, timed-out, or OOM builds never replace live pointers; fingerprinted assets stay resolvable across a ≥ 48h grace window after snapshot switches.
  3. Zero server-side HTML splicing. The server performs no byte-offset HTML rewriting and no fragment builds. Version menus and outdated/prerelease banners are progressively enhanced on the client from /_oink/versions.json (with a static fallback link to /versions/ when JavaScript is off), while SEO canonical and indexing rules travel in standard HTTP response headers (Link and X-Robots-Tag).
  4. Cost follows active unique content, with honest boundaries. Publishing a new release never rebuilds old versions; historical versions that predate breaking theme retirements are frozen via oink freeze rather than re-compiled; full-text search indexes only configured active version lines by default.

Context and evidence

Current state

  • OINK treats each documentation version as an independent Hugo build with params.versions baked into every page. Adding a version forces updating every maintained branch and rebuilding all of them (see the versions guide).
  • pgsty/oink-cli is an unreleased 0.1.0-dev candidate with no users; the owner confirmed the new design need not be constrained by it.
  • Multi-version documentation such as the Chinese PostgreSQL manual (pgdoc-cn, 560 versions) explodes into gigabytes when deployed as per-version static trees and exceeds Cloudflare Pages file limits.
  • Self-hosted Go + local SQLite behind Cloudflare’s free CDN avoids per-row/storage pricing of managed edge databases such as Cloudflare D1 while keeping one binary for local preview, production serving, and offline reading.

Empirical benchmarks

Measured read-only on 2026-11-28 on the actual target repositories (darwin/arm64, Hugo v0.170.1, SQLite 3.54.0, zstd, brotli):

Measurement Observed result Design consequence
pgdoc-cn Git repository 559 v* tags + master (560 versions; 1,118 tags total including REL_* duplicates), Git pack 78.18 MiB Regex matching deduplicates twin tags on the same commit
pgdoc-cn tree scan & body dedup 528,798 HTML entries, 527,348 unique Git blobs (5,856.9 MiB); stripping navheader/navfooter leaves 98,141 unique bodies (1,206.7 MiB) Reading and stripping all 527k blobs takes 48.9 s in Python (est. 12–25 s in Go), so full materialization runs asynchronously in the background
pgdoc-cn base SQLite store (no FTS5) 1 MiB clusters + 14.60 MiB SQLite metadata (entries WITHOUT ROWID, objects, paths, snapshots) = 44–62 MiB depending on cluster ordering and codec All 560 versions fit comfortably under 65 MiB without search
pgdoc-cn contentless FTS5 (content='', detail=full, CJK bigrams) Latest 1 line (1,155 docs): 10.84 MiB (0.92 s); Latest 6 major lines PG 13–18 (4,250 unique docs): 32.41 MiB (5.07 s); All 29 major lines (20,177 docs): 98.46 MiB (20.81 s); All 560 versions (98,141 docs): > 473 MiB (> 100 s) Indexing all 560 minor releases blows past < 100 MiB by > 5× and distorts IDF. Separating search.db and indexing active major lines keeps pgdoc-cn (content + 6 active lines search) at ~75–85 MiB
Cluster codec comparison (15 × 1 MiB pgdoc-cn clusters, 14.23 MiB raw, (path, version) order) zstd -3: 0.411 MiB (34.6×); zstd -9: 0.372 MiB (38.3×); zstd -15: 0.361 MiB (39.4×); brotli -q 6 (lgwin=22): 0.337 MiB (42.2×), dec p50=0.29 ms / p99=0.76 ms; brotli -q 9: 0.326 MiB (43.6×), dec p50=0.26 ms / p99=0.34 ms; brotli -q 11: 0.306 MiB (46.6×), dec p50=0.27 ms / p99=0.42 ms Brotli beats zstd on ratio, matches zstd decode speed (< 1 ms p99), runs pure-Go (CGO_ENABLED=0), and is natively decoded by Apple’s Compression framework (COMPRESSION_BROTLI) with zero third-party dependencies in Crib
pigsty.io (bilingual OINK docs) 1,547 files, Git pack 154.92 MiB; data/ holds contributors.yaml, footer/, landing/, pgext/, upstreams.yaml, star_history.json Confirms data/ and static/ carry version-specific content and must travel with the version commit
pgext.cloud & pg.center pgext.cloud/public is 1.2 GB for 1,493 HTML files (71 MB index.xml); both pgext serve and pg.center already run as dedicated Go + PostgreSQL (pgx) apps Database-backed catalogs and knowledge graphs stay dedicated Go+PG apps sharing OINK’s chrome CSS bundle, rather than being forced into static sidebar trees
Local binary & theme sizes hugo v0.170.1 binary = 87 MB; OINK runtime assets (layouts, assets, i18n, data, static) = 25.77 MiB; theme tests/ = 79 MB Decoupling official Hugo keeps oink around ~20 MB and allows independent Hugo upgrades

Owner inputs

Confirmed premises from the 2026-11-27 and 2026-11-28 discussions:

  1. One Go binary named oink running directly on a Git documentation repository: local live preview while editing (oink dev) and production serving (oink serve).
  2. Production is Git-aware: pin one branch or serve configured branches and tags as multi-version documentation without exploding storage across 500+ PostgreSQL versions.
  3. Self-hosted Go server + local SQLite (avoiding expensive managed edge databases like Cloudflare D1), sitting behind Cloudflare CDN; large media can remain on nginx or local media mounts.
  4. Full-text search and optional page views on SQLite; single-file .oink packages readable directly by oink serve and the macOS reader app Crib (which has zero third-party dependencies).
  5. ACL / access control is deferred out of v1; the unreleased oink-cli need not constrain the design.

Goals and non-goals

Goals:

  • G1 Lean single binary. Running oink in any OINK repo previews it locally (auto-resolving official Hugo if absent); the same binary runs production serving and static/package exports.
  • G2 Git-aware multi-version serving. Branches, tags, aliases (current, latest), and frozen archives resolve deterministically; all 560 versions of pgdoc-cn are reachable; publishing a new version never rebuilds existing versions.
  • G3 Bounded storage without explosion. Storage follows unique content via Brotli clusters; all 560 pgdoc-cn versions plus active-line FTS5 stay under 100 MiB.
  • G4 Resilient atomic operations. Production serves only committed/frozen immutable snapshots; bad commits, build OOMs, timeouts, and kill -9 never degrade live traffic; rollback completes in < 1 s; fingerprinted assets never 404 across snapshot switches.
  • G5 Honest theme compatibility. Plain Hugo stays untouched; active lines share theme styling safely while keeping their own data/ and static/; versions predating breaking OINK retirements freeze cleanly without violating OINK’s no-compat-shim rule.
  • G6 Scoped search and offline .oink. Active-line FTS5 handles CJK and technical identifiers accurately; one compacted, signed, Brotli-compressed .oink archive opens directly in oink serve and Crib with zero Crib third-party dependencies.

Non-goals for v1:

  • No ACL, RBAC, OAuth accounts, login sessions, or authenticated preview hosts (deferred to a separate proposal that must isolate private content at build time rather than via HTTP path filters).
  • No built-in comment or moderation platform (v1 keeps giscus and adds a version-independent term key so discussions stay unified across versions).
  • No server-side HTML slot splicing (no <template data-td-slot> offsets or fragment builds).
  • No Hugo fork and no importing github.com/gohugoio/hugo/commands.
  • No database-driven catalog/graph pages inside oink (pgext serve and pg.center remain separate Go+PG services sharing OINK’s chrome CSS).
  • No multi-tenant hosting, multi-instance shared state, or built-in ACME TLS (run behind Cloudflare, nginx, or Caddy).
  • No Hugo multihost (per-language domain) routing in v1.

Users and target sites

Target site Shape How it uses oink
oink.pgsty.com / pigsty.io Bilingual EN/ZH Hugo + OINK docs, tens of versions, rich data/ oink dev locally; oink serve with active build track + oink freeze for pre-breaking legacy versions; Cloudflare CDN in front
pgdoc-cn / pgdoc-en (pgsql.cc) 560 versions of DocBook/pgweb HTML renderer: html (profile: pgweb), lines + releases + current alias, active-line FTS5 (< 100 MiB total), compacted .oink package for Crib
Static sites on Cloudflare Pages Single version or small version set oink build [--versions] -o dist/ exports static files + versions.json + _redirects
pgext.cloud / pg.center Dedicated Go + PostgreSQL dynamic apps Keep their Go+PG backends; share OINK look via css/bundle.html "chrome"; optionally mount oink serve under /docs/ via reverse proxy or embed a read-only oink/reader package later

Product shape

Commands

Command Behavior
oink Runs oink dev inside a Hugo/OINK site directory; prints help elsewhere
oink dev [DIR] Previews the working tree (drafts/future included) by proxying official hugo server; --versions mounts already-built Git versions read-only
oink serve [DIR | GIT-URL | FILE.oink] Production server: publishes Git refs + frozen archives, or serves one .oink file read-only
oink freeze <VERSION> [--from DIR | REF] [-o FILE] Captures a complete static build into a frozen archive snapshot so future breaking theme upgrades never break it
oink build [--versions] [-o DIR | FILE.oink] Exports a static directory tree (with versions.json and _redirects) or a compacted, signed .oink archive
oink check [--versions] Builds in isolation, validates version config, reports warnings/broken local links, and flags active lines incompatible with an upcoming theme upgrade (0 pass / 1 findings / 2 error)
oink versions Resolves Git refs and oink.yaml and prints versions, aliases, default, and archived status without building
oink status | rebuild | rollback | backup Operates a running oink serve over its 0600 local Unix socket; backup runs SQLite VACUUM INTO on state.db
oink hugo … Invokes the resolved official Hugo binary directly with all arguments passed through
oink --version Prints versions of oink, resolved Hugo, embedded SQLite driver, and cached OINK theme

Development mode

  • Listens on 127.0.0.1 by default and serves the working tree including uncommitted edits and drafts.
  • Spawns official hugo server on an ephemeral loopback port with --appendPort=false --liveReloadPort=<proxy_port> --baseURL=http://127.0.0.1:<proxy_port>/ and reverse-proxies it:
    • forwards HTTP/1.1 Upgrade: websocket (/livereload) transparently so LiveReload works out of the box;
    • serves /_oink/versions.json, /_oink/where, /_oink/search, and /_oink/hit locally against dev state;
    • streams Hugo’s own diagnostics cleanly to the terminal rather than scraping unstructured stderr text to fabricate source line numbers or injecting scripts that break site CSP/gzip responses.

Production mode

  • Reads only committed Git refs and explicitly registered frozen archives; never touches the working tree.
  • Serves immediately at cold start from existing snapshots in cache.db without blocking on rebuilds.
  • Accepts a local checkout (using .git), a bare repository push target, a trusted remote Git URL (mirrored into --data-dir), or a single .oink file (read-only mode, zero background builds).
  • Upgrades cleanly: replacing the oink binary and restarting never triggers snapshot rebuilds unless the Hugo version, skin commit, or corpus profile version actually changed.

Static export, freezing and packages

  • oink build -o public/ produces output byte-identical to running the same official Hugo release directly.
  • oink build --versions -o dist/ writes each version under its prefix alongside a generated /_oink/versions.json, a static /versions/ index page, and _redirects (for Cloudflare Pages / Netlify).
  • oink freeze <version> snapshots a version’s built output into a self-contained immutable archive before a breaking OINK/Hugo upgrade.
  • oink build --versions -o site.oink writes a compacted, single-file, Ed25519-signed .oink archive readable by both oink serve site.oink and Crib.

Core model

Git refs / frozen archives ──resolve──▶ versions ──build/import──▶ immutable snapshots ──atomic flip──▶ serve
       (oink.yaml)                   (line/tag/alias)              (cache.db + search.db)          (HTTP headers +
                                                                                                    versions.json)
Concept Definition
Source A Git repository plus optional frozen archive snapshots (mode: archive)
Version A published label bound to a Git ref (3.7 → v3.7.2, devel → main) or a frozen snapshot (2.7 → v2.7.oink)
Line A release series (17 covers 17.0–17.12; 3.7 covers 3.7.0–3.7.x)
Alias A movable pointer to a version (current → 18, latest → highest-numbered line)
Skin The ref supplying shared layout and styling for active Hugo builds (defaults to the newest stable release tag, not moving main)
Snapshot An immutable manifest mapping paths to content-addressed objects, keyed by H(version_commit, skin_commit, hugo_version, profile_version, url_base)
Cache / Search / State Three physically separate SQLite files: cache.db (rebuildable content store), search.db (rebuildable FTS5 index), and state.db (durable counters and audit log, back up via oink backup)

Versions from Git refs

  • Without oink.yaml, the default branch HEAD is the sole version, served at / (--ref <branch> pins another branch).
  • tags is a regular expression with named capture groups line and patch. Ordering compares dotted integer components numerically. Non-matching tags (such as REL_* aliases or -rc1) are ignored; duplicate tags on the same commit collapse to one canonical label.
  • releases: true additionally exposes every matched patch tag (e.g. /docs/17.4/).
  • branches maps explicit single-segment URL-safe labels (^[a-z0-9][a-z0-9._-]*$) to branches (preventing branch names containing / from producing ambiguous URL prefixes).
  • line_branch optionally tracks the head of each line’s maintenance branch instead of its newest tag (for translation repos shipping mid-release fixes).
  • default names the version served without a prefix at /. When default is omitted (as in pgdoc-cn where all versions live under /docs/{label}/), oink.yaml must specify root_redirect (e.g. /docs/current/, answered with 302) or a root landing source; an omitted default without root_redirect is a validation error.

Dual-track version lifecycle

OINK intentionally retires public interfaces in minor releases with zero compatibility shims (for example, v1.6.0 removed Sass hooks and v1.8.0 removed the social shortcode, causing older content to fail Hugo builds). Real sites such as pigsty.io also store versioned facts in data/ and static/. Therefore oink supports two explicit tracks for Hugo versions:

  1. Track A — Active build track (mode: build, default). Used for release lines sharing the current breaking-change generation of OINK:
    • Content domain comes from the version commit: all resolved contentDir and content mounts declared in effective hugo.yaml, plus data/, static/, and non-style/non-script assets/ (so versioned screenshots, download manifests, checksums, and data/docs_nav.json stay accurate to that version).
    • Skin domain overlays appearance only: from the pinned skin ref (default: newest release tag, never moving main), taking layouts/, theme module pin, assets/css/, assets/js/, i18n/, and appearance-only parameters (params.ui.preset*, dark_mode).
    • Any version that requires its own configuration/layouts can set skin: self.
    • Content adapter guard: _content.gotmpl files found in non-skin refs are rejected by default during materialization unless allow_content_adapters: true is explicitly set in oink.yaml.
  2. Track B — Frozen archive track (mode: archive). Used whenever a version crosses a breaking theme or Hugo upgrade:
    • Before upgrading the site across a breaking OINK release, the maintainer runs oink freeze <version> (or imports an existing built static tree) and lists it under versions.frozen in oink.yaml.
    • Frozen snapshots are ingested directly into cache.db as immutable objects and never rebuilt from source again, yet participate seamlessly in /_oink/versions.json, archived banners, /_oink/where, and HTTP SEO headers.

External HTML corpus importer

For pre-rendered HTML repositories such as pgdoc-cn and pgdoc-en, renderer: { type: html, profile: pgweb } provides a dedicated importer:

  • Streams objects directly from Git via git cat-file --batch without checking out a worktree.
  • Strips DocBook navheader/navfooter into location-independent body HTML and parses index.html into a compact per-version navigation JSON.
  • Preserves single visual authority: the importer does not hand-generate complex OINK component markup in Go. Pages render inside a minimal theme-built shell template (theme item C6) with one body insertion point, and a dedicated .td-corpus-pgweb CSS layer styles native DocBook classes directly.

URLs, redirects and SEO

  • Layout: single-host path layout /{version}/{lang}/... (default version drops {version}). Hugo multihost is unsupported and reported clearly by oink check / oink serve.
  • Default version redirect: /v{default}/x responds with 302 Found and Cache-Control: public, max-age=300 (never 301, so browsers are never pinned to stale redirects when default advances).
  • Aliases: HTML corpus aliases (location-independent bodies) serve in place; Hugo version aliases respond with 302 (max-age=300).
  • Orthogonal SEO via HTTP headers (compliant with Google Search Central; zero HTML rewriting):
Version kind HTTP X-Robots-Tag HTTP Link: rel="canonical" HTML <link rel="canonical"> & hreflang In sitemap.xml / RSS
Default version (or primary alias) none none (HTML self-canonical) self-canonical + full hreflang yes (sole source)
Non-default major line (e.g. /v3.6/, /docs/16/) none target same-language path in default version if present, else self omitted at build time (C3) no
Exact patch release & prerelease (17.4, devel) noindex, follow none (never combine noindex with cross-version canonical) omitted at build time (C3) no
  • Error pages: 404 carries X-Robots-Tag: noindex, loads /_oink/where?path=... to suggest versions containing that path, and marks data-td-no-history. Unbuilt versions return 503 Service Unavailable with Retry-After: 10. Error page language resolves in order: matched URL language prefix → Accept-Language header → site default language.

Architecture

Pipeline

Git refs / archives ─▶ resolve ─▶ materialize ─▶ build/import ─▶ ingest ─▶ publish ─▶ HTTP
(fetch/webhook/push)   versions   content+skin   Hugo child or   Brotli    atomic     headers +
                                  (or freeze)    pgweb stream    + FTS5    pointer    cache
                                                                    │         │
                                                                    ▼         ▼
                                                            cache.db +     state.db
                                                            search.db     (back up)
  1. Resolve: read oink.yaml from the configured ref, compute version/alias tables, and derive snapshot_key = H(version_commit, skin_commit, hugo_version, profile_version, url_base). Matching keys are skipped immediately.
  2. Materialize: for Track A Hugo versions, create a temporary git worktree at the version commit and overlay only the skin’s appearance files; for Track B archives and HTML corpora, read directly without a worktree.
  3. Build / Import: invoke official Hugo in an isolated child process into a temporary output directory, or stream HTML corpus pages through the pgweb profile.
  4. Ingest: hash every output file, pack only unseen objects into Brotli clusters in cache.db, populate entries and recent_assets, and update search.db if the version is inside search.scope.
  5. Publish: flip versions and aliases pointers in a single SQLite transaction, regenerate /_oink/versions.json payload, and enqueue batched Cloudflare prefix purges if configured.

Decoupled Hugo engine and isolation

  • External official Hugo binary: oink never imports gohugoio/hugo/commands. It resolves Hugo in order: --hugo → PATH → auto-managed ~/.cache/oink/hugo/<version>/hugo (downloaded from official GitHub Releases with pinned SHA-256 verification unless --offline). This keeps oink around ~20 MB, avoids Go dependency bloat, and lets sites upgrade Hugo independently of oink.
  • Theme provisioning: _vendor/ → Go module cache (when go is present) → cached OINK theme release injected via HUGO_MODULE_REPLACEMENTS, GOWORK=off, and HUGO_MODULE_WORKSPACE=off. Sites importing additional non-vendored Hugo modules require go or hugo mod vendor; oink does not reimplement Go’s MVS resolver.
  • Portable child-process resource isolation:
    • Never set RLIMIT_AS on Go child processes (Go’s 64-bit virtual arena mmap fails immediately with ENOMEM).
    • Every build child runs in its own process group (Setpgid: true), receives GOMEMLIMIT set to 80% of build_memory_limit (default 4 GiB), runs at lowered priority (setpriority / nice, plus Linux ionice), and is watched every 500 ms by a parent RSS monitor (Linux /proc/<pid>/status, macOS proc_pidinfo) that SIGKILLs the entire process group on RSS breach or timeout.
    • On Linux hosts with delegated cgroup v2 write access (such as systemd Delegate=yes), oink additionally enforces kernel memory.max.
  • Build security: skin refs are explicitly trusted code; oink serve still injects a configuration overlay forcing security.exec.allow: [] unless --allow-exec is explicitly passed, and passes only a minimal environment variable allowlist to build children (never CDN tokens or host secrets).

Storage, Brotli clusters and asset retention

  • SQLite Go driver (CGO_ENABLED=0): default to github.com/ncruces/go-sqlite3 (WASM SQLite with full FTS5, compact binary, zero C toolchain for cross-compilation), benchmarked against mattn/go-sqlite3 during M0 before freezing.
  • Physical separation into three SQLite databases:
    • cache.db (WAL, PRAGMA synchronous = NORMAL, rebuildable): meta, clusters(id, codec, raw_size, data), objects(id, hash, cluster, offset, size, media_type), paths(id, path), snapshots(id, key, version, commit_sha, state, created_at), entries(snapshot, path, object) WITHOUT ROWID, recent_assets(path, object, expires_at), versions, aliases. On startup, oink cleans up any interrupted state='building' snapshots and unreferenced orphan clusters left by a prior crash.
    • search.db (WAL, PRAGMA synchronous = NORMAL, rebuildable): decoupled FTS5 index so search maintenance never contends with content reads or bloats content snapshots.
    • state.db (WAL, PRAGMA synchronous = FULL for power-loss durability, non-rebuildable): daily page-view totals and build/audit history. Backed up safely online with oink backup (SQLite VACUUM INTO) or Litestream.
  • Single universal codec — RFC 7932 Brotli (lgwin=22):
    • Empirically verified on pgdoc-cn 1 MiB clusters to achieve 42.2× at -q 6 (0.76 ms p99 decode) and 43.6–46.6× at -q 9..11 (0.34–0.42 ms p99 decode), outperforming zstd -15 while decoding natively in Apple’s Compression framework (COMPRESSION_BROTLI) with zero third-party dependencies in Crib and pure-Go (github.com/andybalholm/brotli) in oink.
    • Online cache.db appends use fast -q 6; compacted .oink exports re-sort objects by (path, version_sort_key) and pack at -q 9 (or -q 11 with --max-compress).
    • Adaptive cluster size: 1 MiB raw target for small-page corpora (median < 64 KiB); 4 MiB raw target for large Hugo pages (median ≥ 64 KiB, still inside Brotli’s lgwin=22 4 MiB sliding window!) so tens of versions share one compression window cleanly.
  • Cross-request asset retention (eliminating switch/GC 404s):
    • Garbage collection retains snapshots and objects for max(3 latest snapshots, 48 hours) — strictly longer than CDN edge TTL (24h) plus stale-if-error (1h).
    • Whenever a request for a fingerprinted asset (/css/*, /js/*, /webfonts/*, hashed media) misses the newly switched current snapshot, the server falls back to recent_assets and returns 200 OK from the retained object.
  • Read-only .oink distribution archive (oink.store/v1):
    • Exported with oink build --versions -o site.oink: compacted clusters, journal_mode=DELETE, VACUUM, optional scoped FTS5 tables, and canonical logical Ed25519 signing (SHA-256 over sorted meta excluding signature plus sorted (snapshot, path, object_hash) records stored in meta['manifest_sha256'] and signed in meta['signature'], avoiding circular file-byte hashing).
  • Explicit index scope (search.scope): defaults to active-lines (non-archived major lines), with options default-only and all. On pgdoc-cn, indexing the 6 active major lines (PG 13–18, 4,250 unique docs) adds only 32.4 MiB in 5.1 s, keeping total pgdoc-cn storage (cache.db + search.db) around 75–85 MiB (< 100 MiB).
  • Version and language isolation: queries filter by (version_line, lang) directly inside the index rather than taking global Top-K across all versions and post-filtering (preventing empty recalls on high-frequency terms and cross-language leakage).
  • Tokenization and section granularity:
    • Hugo sites ingest section-level records directly from OINK’s offline-search-index.<lang>.json (preserving headings, data-td-search-entry anchors, and excerpts); pgweb corpora split sections on headings.
    • FTS5 uses content='' and tokenize="unicode61 tokenchars '_-./:'" so identifiers (work_mem, --baseURL, /pg/data) stay intact; a shared Go pre-processor emits overlapping CJK bigrams and normalizes common SQL/JSON operators (->>, ::, @>).
    • Acceptance uses a fixed curated 60-query EN + ZH + identifier/operator benchmark (targeting Top-5 recall ≥ 90% and p99 latency < 25 ms), rather than claiming byte-level ranking equivalence with the browser’s 922-line scanning engine.

Serving, Cloudflare caching and updates

Request dispatch order: /_oink/* endpoints → /versions/ static directory → longest-prefix version/alias match (or default version / root_redirect) → pin current snapshot → entry lookup → recent_assets fallback (for fingerprinted assets) → language-aware 404 / 503.

Response Browser Cache-Control Cloudflare Cloudflare-CDN-Cache-Control Invalidation
Fingerprinted assets public, max-age=31536000, immutable max-age=31536000 Content-addressed filename
Release / line HTML public, max-age=300 + ETag max-age=86400, stale-while-revalidate=600, stale-if-error=3600 Batched prefix purge on publish
Moving branch HTML (devel) public, max-age=60 + ETag max-age=300, stale-while-revalidate=60, stale-if-error=1800 Prefix purge on publish
/_oink/versions.json public, max-age=60 max-age=60, stale-while-revalidate=300, stale-if-error=3600 Single-URL purge on version change
/_oink/search, /where, /hit private, no-store (/where: public, max-age=60) no-store Never cached
  • Cloudflare Cache Rules contract: Cloudflare does not cache HTML by default, and s-maxage causes Cloudflare to ignore stale-if-error. Using Cloudflare-CDN-Cache-Control avoids that conflict so edge nodes serve stale pages across origin restarts. Operators configure one Cache Rule matching public paths (excluding /_oink/*) with Eligible for cache and Use cache-control header if present (never “Ignore cache-control header”). The purge client batches up to 100 prefixes per API call and rate-limits cleanly under Cloudflare Free’s 5 req/min ceiling.
  • Updates and fair scheduling: triggered by periodic git fetch (default 60 s), HMAC-verified webhooks (POST /_oink/hooks/<provider>), or local bare-repo pushes. Builds run at default concurrency 1 with aging priority (default version first, waiting versions gain priority over time so frequent main commits cannot starve low-traffic lines); newer commits coalesce queued builds for the same version.

Cookieless page views and hybrid apps

  • Page views (/_oink/hit, opt-in, off by default): pages send navigator.sendBeacon. The server verifies same-origin Origin/Sec-Fetch-Site, filters common bot UAs, and deduplicates repeat views in memory using a Plausible-style daily rotating random salt hash SHA256(daily_salt || host || ip || ua || path) (no cookie, no IP written to disk, salt discarded every 24 hours). Increments flush every 60 s into daily aggregates in state.db.
  • Comments: v1 uses OINK’s existing giscus integration enhanced with a version-independent term key (C4).
  • Hybrid integration for pgext and pg.center: those applications retain their own Go + PostgreSQL runtime for live catalogs and knowledge graphs, share OINK’s visual identity via partial "css/bundle.html" "chrome", and either reverse-proxy /docs/ to oink serve or (in a later library phase) embed a read-only oink/reader Go package over .oink archives.

Configuration

Two files with clean ownership: hugo.yaml owns page rendering and params.ui.*; oink.yaml (schema_version: oink.serve/v1) owns publishing, versions, search scope, media mounts, and CDN purging. Secrets come strictly from environment variables.

oink.yaml (product docs)
schema_version: oink.serve/v1
origin: https://docs.pigsty.io
skin: latest                                     # pin to newest stable tag, not moving main

versions:
  tags: '^v(?P<line>\d+\.\d+)\.(?P<patch>\d+)$'
  branches: { devel: main }
  default: latest
  url: '/v{label}/'
  archived: ['< 3.0']
  frozen:
    '2.7': ./archives/v2.7.oink

search:
  enable: true
  scope: active-lines

page_views:
  enable: false

cdn:
  provider: cloudflare                           # OINK_CF_API_TOKEN, OINK_CF_ZONE_ID

media:
  - url: /media/
    dir: /srv/media
oink.yaml (pgdoc-cn, 560 HTML versions)
schema_version: oink.serve/v1
origin: https://pgsql.cc
root_redirect: /docs/current/

versions:
  renderer: { type: html, profile: pgweb }
  tags: '^v(?P<line>\d+(?:\.\d+)??)\.(?P<patch>\d+)$'
  releases: true
  branches: { devel: master }
  aliases: { current: latest }
  url: '/docs/{label}/'
  archived: ['< 15']

search:
  enable: true
  scope: active-lines

Output, accessibility and security boundaries

  • Output and progressive enhancement: static HTML stays complete without JavaScript; without JS, the version control degrades to a semantic link to /versions/ (a theme-rendered static directory of all versions); Print, Markdown, and LLMS remain per-version; RSS and sitemap.xml come from the default version only.
  • Accessibility and localization: every new user-visible string (503, prerelease banner, /versions/ page, 404 version hints, version-scoped search) ships natively in all 32 OINK locales and passes the documentation site’s axe checks.
  • Management and metrics isolation: management CLI commands talk solely over <data-dir>/oink.sock created with mode 0600. Prometheus /metrics is served only on oink.sock or an explicit loopback-only listener (--metrics-listen 127.0.0.1:9091), never on the public reverse-proxied HTTP port.
  • No accidental secret exposure: child Hugo processes run with security.exec.allow: [] by default and stripped environment variables; CSP headers permit OINK’s own startup scripts without wildcard inline execution.

Theme coordination

Dropping server-side HTML slot splicing, accounts, and built-in comments trims theme work down to six small, high-leverage changes (C1–C6). All paths below are relative to the OINK theme repository root.

Theme changes (C1–C6)

Item Change Files Stage
C1 Fix O(N²) linear scan in pager-state.html with a cached path → index map; update sidebar-nav.js to highlight the active row from window.location.pathname rather than link[rel="canonical"] layouts/_partials/pager-state.html, assets/js/sidebar-nav.js M1
C2 Emit noindex on 404.html; add a localized 503 (“building”) template across all 32 locales; add data-td-no-history to error templates and update history.js to skip any page carrying it layouts/404.html, layouts/_partials/head.html, assets/js/history.js, i18n/*.yaml M1
C3 Add a build-level oink_managed_seo switch that omits HTML <link rel="canonical"> and hreflang on non-default versions (delegated to HTTP headers); remove target="_blank" on same-site archive banner links and add a prerelease banner (32 locales); support configuring site-root storage scope for history and shortcuts without breaking subpath isolation layouts/_partials/seo-alternates.html, layouts/_partials/version-banner.html, layouts/_partials/scripts.html, layouts/_partials/shell/history-dialog.html M1
C4 Add an opt-in js/chunks/oink-versions.js runtime that hydrates the navbar/drawer/footer version menu, Command Palette switch_version options (preserving page path), and archived/prerelease banners from /_oink/versions.json, with a no-JS static link to /versions/; fetch /_oink/where on 404 pages; add a version-independent term option to giscus.html layouts/_partials/navbar.html, layouts/_partials/actions/context.html, layouts/_partials/giscus.html, assets/js/ M1
C5 Refactor command-palette.js query execution to support an opt-in async remote search backend (/_oink/search with debounce, AbortController, and version-scope toggle), preserving zero network requests when unconfigured assets/js/command-palette.js, layouts/_partials/shell/search-dialog.html M2
C6 Add a minimal corpus shell layout (one body insertion slot + navigation JSON hook) and a .td-corpus-pgweb CSS adapter layer so external HTML corpora inherit OINK styling cleanly layouts/, assets/css/td/ M2

(Independent theme housekeeping, non-blocking: add an empty tests/go.mod in the OINK theme repository so the 79 MB test fixtures stop inflating Go module zips for all consumers.)

Process coordination

  • Independent releases: because oink does not embed Hugo or require a lockstep embed.go in the theme root, OINK theme releases and oink binary releases ship independently.
  • Contract ownership: /_oink/versions.json schema, /_oink/search response shape, and the C6 corpus shell contract live in OINK’s bilingual Design contracts with explicit version fields.
  • Checkers: oink Go tests verify plain-Hugo parity, pgdoc-cn storage/latency budgets, kill -9 recovery, asset grace-window retention, HTTP SEO headers, and exec isolation; theme checkers (check-shell.py, check-goldens.py, check-i18n.py) and oink.pgsty.com Playwright suites verify rendered output.

Compatibility and migration

  • Plain Hugo sites are completely unaffected. The theme repository remains pure templates, CSS, JS, and i18n with no server code or embed.go requirement.
  • Existing params.versions static sites keep working unchanged. Adopting oink serve switches them to /_oink/versions.json without editing historical tags.
  • Retiring oink-cli. If accepted, the CLI contract is marked superseded and pgsty/oink-cli is archived. Essential link/translation checks move to oink check; oink.result/v1 and oink.policy/v1 are retired cleanly (oink.yaml uses explicit schema_version: oink.serve/v1).
  • Crib compatibility. Existing .crib files are untouched; Crib adds .oink (oink.store/v1) reading using Apple’s built-in libsqlite3 and COMPRESSION_BROTLI with zero new third-party dependencies.

Implementation and checker plan

Create a clean Go repository (pgsty/oink-server, producing the oink binary) split into focused packages: hugoexec (official Hugo resolution, SHA-256 caching, isolated child runner + RSS watchdog), gitsrc (ref resolution, worktree materialization, cat-file --batch streaming), corpus/pgweb, store (cache.db + Brotli clusters + .oink compaction & Ed25519 manifest signing), search (search.db scoped FTS5 + CJK/identifier analyzer), serve (routing, HTTP SEO/CDN headers, Cloudflare batched purge, recent_assets fallback), pv (daily-salt dedup counter + state.db), and admin (0600 Unix socket + VACUUM INTO backup).

Milestones

Milestone Estimate Scope Exit evidence
M0: Lean dev & check binary 2 weeks oink (dev, build, check, versions, hugo); official Hugo auto-cache + SHA-256 verification; LiveReload WebSocket proxy; ncruces vs mattn SQLite benchmark Clean machine without preinstalled Hugo/Go previews oink.pgsty.com and pigsty.io with live reload; oink build matches plain Hugo byte-for-byte
M1: Multi-version Hugo serving 3 weeks oink serve, oink.yaml (v1), oink freeze, dual-track lifecycle, cache.db (Brotli clusters + 48h recent_assets grace window), atomic switch, status/rebuild/rollback/backup, HTTP SEO & Cloudflare headers, theme C1–C4 Bilingual site with 5+ tags, 1 frozen legacy version, and moving devel runs live; publishing a new tag rebuilds zero old versions; bad commits/OOM/kill -9 keep live site up; old HTML fetching old fingerprinted CSS returns 200; rollback < 1 s; EN/ZH + axe pass
M2: pgdoc-cn 560 versions & scoped search 2–3 weeks pgweb importer, theme C5–C6, search.db (active-line FTS5 + CJK bigrams + identifiers/operators), 60-query benchmark All 560 pgdoc-cn versions reachable; cache.db + 6 active major lines search.db total < 100 MiB; cold start < 2 s; hit p99 < 5 ms, cluster miss < 15 ms; resident RAM < 512 MiB; 60-query Top-5 recall ≥ 90%
M3: .oink packages, Crib & PV 2 weeks Compacted .oink export (brotli -q 9), Ed25519 manifest signing & verification, oink serve x.oink, Crib native reader (libsqlite3 + COMPRESSION_BROTLI), daily-salt /_oink/hit PV Signed .oink round-trip serves byte-identical output; Crib opens all 560 pgdoc-cn versions with zero third-party libraries; PV deduplicates refreshes with no IP persisted

Acceptance criteria

  1. Zero-rebuild publishing: pushing a new tag v3.8.0 on an M1 test site triggers exactly one Hugo build; existing versions remain untouched; /_oink/versions.json updates and client version menus show v3.8.0 with working same-page links.
  2. No cross-request asset tearing: after 4 consecutive CSS-changing publishes and a GC pass within 48 hours, an older cached HTML page’s request for its original fingerprinted CSS still returns 200 OK.
  3. Resilience & memory containment: an intentionally low build_memory_limit triggers watchdog SIGKILL of the Hugo child process group without degrading server availability; kill -9 mid-ingest leaves live snapshots intact and auto-cleans orphan clusters on restart; oink rollback completes in < 1 s.
  4. pgdoc-cn scale & latency: all 560 versions resolve; cache.db + 6-line search.db stay under 100 MiB; cold start < 2 s; p99 < 5 ms (LRU hit) / < 15 ms (cluster decode); 60-query EN/ZH/identifier search benchmark hits Top-5 ≥ 90% at < 25 ms p99.
  5. SEO & security verification: default version emits self-canonical + hreflang; non-default lines emit HTTP Link: rel="canonical" with no conflicting HTML canonical/hreflang; patch releases and devel emit only X-Robots-Tag: noindex, follow; /v{default}/x returns 302; repositories enabling security.exec are blocked by default; oink.sock is 0600; /_oink/metrics is 404 on the public listener.
  6. Package round-trip: oink build --versions -o x.oink followed by oink serve x.oink passes Ed25519 verification and serves byte-identical responses for every URL.

Risks

Risk Mitigation
Readers without JS do not see the interactive version dropdown Every page carries a static <a href="/versions/"> link to a theme-rendered full version index; SEO relies on HTTP headers, not JS
Maintainer upgrades OINK across a breaking change without freezing old lines first oink check --versions audits active lines against the new theme and lists versions needing oink freeze before cutover
Cloudflare Cache Rule misconfiguration or Free-tier purge throttling (5 req/min) Ship copy-pasteable Respect-Origin Cache Rule recipes + oink verify-cdn; batch up to 100 prefixes per purge with rate backoff
Background builds saturate a small single-core VPS Default concurrency 1, nice/ionice, GOMEMLIMIT, RSS watchdog, and Cloudflare edge absorption (stale-if-error=3600)
pgweb DocBook HTML variations across 25 years of PostgreSQL releases Test importer across all 560 real pgdoc-cn / pgdoc-en tags (v6.0–v20devel) in M2 CI fixtures

Alternatives

Alternative Conclusion
Per-version static builds on Cloudflare Pages (mike / Read the Docs style) mike and RTD already use client-side versions.json (no full menu rebuilds), so small sites work well via oink build --versions; however 560 pgdoc-cn versions (529k files, 6.15 GB) exceed Pages’ 20k/100k file limits and blow up storage
Cloudflare R2 + Workers + D1 Avoids a VPS origin, but D1 query/storage pricing for 529k manifests and full-text search is unacceptable to the owner; self-hosted oink + local SQLite + free Cloudflare CDN keeps cost flat and works identically offline
Embedding github.com/gohugoio/hugo/commands in-process/re-exec Couples to an unstable internal Go API, bloats binary to ~130–145 MB, and forces releasing oink on every Hugo upgrade; orchestrating the official Hugo binary is cleaner and smaller
Server-side HTML byte-offset slot splicing (v1 draft Stage 2) Breaks page-for-page version_menu_pagelinks without server-side URL rewriting, ties all old versions’ ETags to default-version page deletions, and doubles theme surface (T1–T12); client versions.json + HTTP SEO headers achieve the same goal far more simply
Kiwix/ZIM or docs.rs S3 + PostgreSQL ZIM is a strong read-only archive reference (clusters + index), while SQLite + Brotli avoids writing a custom binary parser for Crib (Apple ships libsqlite3 + COMPRESSION_BROTLI); docs.rs targets multi-terabyte Rust crates with container fleets, overkill for single-repo docs
Hugo native [versions] matrix (v0.153+) Builds every version together in one Hugo invocation; memory and rebuild cost scale as versions × pages (unworkable for 560 versions). Suitable only for small static sites under theme roadmap R2

Resolved design decisions

All architectural decisions previously left open are resolved for this v2 baseline:

  1. Decoupled official Hugo binary (instead of importing gohugoio/hugo/commands): keeps oink ~20 MB, decouples Hugo upgrades, and eliminates Go dependency conflicts.
  2. Zero HTML splicing (/_oink/versions.json + HTTP Link/X-Robots-Tag headers) (instead of Stage-2 <template data-td-slot> splicing): removes full rebuilds on release, preserves page-for-page switching, and cuts theme coordination from 12 items to 6.
  3. Dual-track version lifecycle (mode: build + oink freeze): active lines keep their own data/ and static/ while sharing a pinned release-tag skin; historical versions crossing breaking OINK retirements freeze cleanly without compatibility shims.
  4. Universal RFC 7932 Brotli (lgwin=22) for oink.store/v1: empirically outperforms zstd -15 on pgdoc-cn 1 MiB clusters (42.2–46.6×, < 0.8 ms p99 decode), runs pure-Go in oink, and decodes natively in Crib via Apple’s COMPRESSION_BROTLI with zero third-party dependencies.
  5. Scoped search.db (active-lines default): separates FTS5 from cache.db and indexes active major lines by default (32.4 MiB for PG 13–18), keeping all 560 pgdoc-cn versions + search under 100 MiB.
  6. Clean new binary repository (pgsty/oink-server) and explicit oink.yaml schema (oink.serve/v1): retires pgsty/oink-cli cleanly without carrying dead oink.result/v1 history.
  7. Defer ACL/auth/comments and keep pgext/pg.center dynamic apps separate: keeps v1 focused, secure behind Cloudflare CDN, and deliverable in ~9–10 weeks across M0–M3.

Decision log

Date Record
2026-11-27 Owner defines online needs: multi-version docs (including 500+ PG versions), search, page views, comments, pgext/pg.center, Cloudflare preference
2026-11-28 Initial v1 draft written (embedded Hugo CLI, Stage-2 HTML slot splicing, zstd SQLite store, full-corpus FTS5, accounts/ACL/comments)
2026-11-28 Adversarial architecture review and live local benchmarks on pgdoc-cn, pigsty.io, pgext.cloud, and pg.center identify key flaws: 560-version FTS5 exceeds 473 MiB, Stage-2 splicing conflicts with version_menu_pagelinks and per-page canonical, content/-only skinning breaks data//static/ and retired shortcodes, RLIMIT_AS crashes Go children, s-maxage disables Cloudflare stale-if-error, and brotli beats zstd while matching Apple’s native COMPRESSION_BROTLI
2026-11-28 Owner confirms self-hosted SQLite behind Cloudflare CDN (no D1), defers ACL out of v1, and delegates remaining architecture decisions; proposal rewritten as v2 redesign

14 - Spec boards: GitHub-aligned issues in Markdown

Draft PRD for spec boards, a content type that keeps GitHub-style issues as numbered Markdown files in a fixed directory layout, with GitHub’s statuses, types, fields, labels, milestones, sub-issues and dependencies, statically built views, enforced numbering, and the OINK Design section as the first board.
Draft, 2026-12-03

This proposal describes behavior that does not exist. It is not a configuration reference. Current behavior is defined by the Shell and Architecture contracts.

Record Value
Status Draft PRD, second revision, 2026-12-03; not accepted and not implemented
Owner OINK maintainers
Owner decisions so far The working name is spec; GitHub’s nine default labels are built in; the OINK Design section becomes the first board (decision log)
Alignment baseline GitHub Issues as documented on 2026-12-03: issue statuses (public preview since 2026-11-23), issue types, issue fields, sub-issues, issue dependencies and issue templates; repository boards and the Table, Board and Roadmap layouts of GitHub Projects
Form A spec content type in the documentation family, rendered in the shared reading shell. A board can be a top-level section or a section inside a docs tree
New public API Content type spec; the board layout with its reserved directories issues/ and templates/; the issue number rule; issue front matter keys (mapping); params.ui.spec and a board’s spec map; opt-in output format SPECJSON; archetypes spec and spec-board
Runtime None required; one optional chunk for view tabs, table sorting and date-relative hints
Affected contracts Shell, Architecture · outputs and runtime, the configuration reference, the generated front matter and site parameter schemas, all 32 locales, and the structure of this Design section
Related oink serve (later browser write-back), OINK CLI roadmap (spec commands), knowledge graph G1 (backlinks as “mentioned in”)

Summary

A spec board is a section of Markdown files that reads like a GitHub repository’s issues. It has one fixed layout. The board page and the fixed documents sit at the top. Every issue sits in one flat issues/ directory, and issue templates sit in templates/. An issue’s number is the four-digit prefix of its file name. Its front matter uses GitHub’s names: status, labels, assignees, milestone, priority and so on.

content/spec/                     the board
├── _index.md                     board page: README and configuration
├── RULE.md                       RULE: the charter agents read first
├── ARCH.md                       ARCH: the architecture to respect
├── issues/                       every issue, flat and numbered
│   ├── _index.md                 the issue list
│   ├── 0001-local-search.md      issue #1
│   ├── 0001-local-search.zh.md   its translation
│   └── 0042-spec-boards/         issue #42, a leaf bundle with its images
│       └── index.md
└── templates/                    issue templates
    └── feature.md
---
title: Render spec boards
status: In progress
issue_type: Feature
labels: [enhancement]
assignees: [alice]
milestone: v1.9.0
priority: High
start_date: 2026-12-05
target_date: 2026-12-20
parent: 12
blocked_by: [7, 9]
date: 2026-12-03
---

The board page renders saved views laid out as a board, a table or a roadmap. The issue list renders every issue, the counterpart of a repository’s Issues tab. Git is the database, a commit is the transaction and history is the audit log. The theme only reads files. Agents read and write the same files that people read as pages, with no API, token or service between them.

The rules fit in two lines. The place of a file decides its kind, and the name of an issue decides its number. Mistakes are reported when the archetype creates a file, on every build, and optionally before a merge.

Background and evidence

The request. On 2026-12-03 the owner asked for a file-based board that does what GitHub Projects and Issues do without depending on GitHub. Specs drive the work, each item has a natural number, status is kept in front matter, RULE and ARCH are fixed charter pages, and a companion CLI may manage files later. The owner then asked that the data model follow GitHub’s field names and available statuses. In a second round the owner kept the working name, chose to build in GitHub’s default labels, and named the OINK Design section as the first board. The owner also asked for two more parts of the design. One is a numbering scheme that users can actually be held to, with the number fixed at the front of the name. The other is a designed directory layout instead of an unstated flat folder.

GitHub moved toward a model that files can mirror. On 2026-11-23 GitHub put issue statuses into public preview. Seven statuses, each in a category, now decide whether an issue is open or closed and why it was closed; setting a status through the REST API updates state and state_reason. The same release added repository boards, which are saved views that render one column per status. Issue types (default Task, Bug, Feature), issue fields (default Priority, Effort, Start date, Target date), sub-issues, “blocked by” dependencies and issue templates were already in place. One key, status, now decides the column, the open or closed state and the closing reason. That is what makes a faithful file-based mirror practical.

Prior art covers the parts separately.

  • File-based trackers keep one Markdown or YAML file per issue in the repository. Examples are ditz (2008), git-issue, git-issues, tisket, ditz2 and Backlog.md, which adds a terminal board, a local web board, decisions, docs and an MCP server for agents. All of them are CLIs or local servers. None publishes a static reading site. Backlog.md moves finished tasks into other directories, so a task’s path changes with its state.
  • Spec-driven development tools use the same three parts proposed here. Spec Kit has a constitution (memory/constitution.md) and numbered specs/001-…/ folders. Kiro has steering files (product.md, tech.md, structure.md) and .kiro/specs/. OpenSpec keeps current specs/ beside proposed changes/. They generate files and drive workflows, but they have no board and no reading site.
  • Numbered proposal series show that numbered Markdown with status metadata and a generated index works at scale: PEPs, EIPs, Swift Evolution, Rust RFCs, Kubernetes KEPs, and ADRs published with log4brains. All of them put the number at the front of the name. They assign it through a person or a tool: PEP editors assign numbers, a Rust RFC takes its pull request number when it merges, a KEP takes its tracking issue number, and adr-tools and Spec Kit’s scripts compute the next number. None checks uniqueness when the site builds.
  • A search on 2026-12-03 found no Hugo theme that provides this.

OINK already uses the pattern by hand. This Design section holds 18 proposals and 24 dated research records. They carry design_kind, design_status, proposal_date and last_verified, and two index pages keep tables of them by hand. An inventory on 2026-12-03 found two proposals whose front matter status disagrees with the proposals index (findings). A board would generate those tables and give each record one status.

Consumer evidence. On 2026-12-03 no primary Hugo checkout under ~/www or ~/pgsty had a content/spec, content/issues or content/proj directory, so a new spec type collides with no maintained site.

Goals and non-goals

Goals

  1. One file is one issue, in GitHub’s model. An issue exported from GitHub and an issue written by hand use the same keys and the same values: status names and categories, closing reasons, issue types, issue fields, labels, milestones, parent and sub-issues, and blocked-by relations.
  2. One fixed layout. A file’s kind follows from where it is and an issue’s number from its name. People and agents can find, create and check files with ls alone.
  3. Numbers are enforceable. Violations are reported when the file is created, on every build, and optionally before a merge. Nothing depends on people remembering a convention.
  4. Views are built statically. Board, Table and Roadmap views are rendered at build time. They can be read without JavaScript, printed, and indexed by search.
  5. Documents come first. RULE, ARCH and the other documents come before the issues in every listing and output. They are the charter that agents read before they touch an issue.
  6. Outputs are ready for agents. Each issue and board has a Markdown output, and an opt-in JSON output follows the shape of GitHub’s REST issue objects.
  7. Hugo is enough. Theme archetypes create boards and issues and check the number. A CLI can add convenience but is never required.
  8. Invalid input warns and falls back. hugo server stays usable.
  9. The first board is OINK Design. The design is accepted only when it can carry this section’s real records without losing information.

Non-goals

  • Write-back from the browser, such as dragging cards or editing forms. Moving a card means editing a line of front matter. A served write path belongs to oink serve, not to the theme.
  • Comments, reactions, notifications, subscriptions, locking, pinned issues, participants and permissions.
  • Pull requests and the status transitions GitHub drives from linked pull requests and assignment.
  • The parts of GitHub Projects beyond view layouts: cross-repository aggregation, draft issues, iteration fields, insights charts and project status updates. These are phase 3 candidates.
  • Synchronization with GitHub. Import and export belong to the CLI track, which has its own lifecycle.
  • Any build-time meaning of “now”. A static page cannot know today, so overdue marks and the roadmap’s today line are client-side hints only.
  • Replacing a public bug intake. Readers who cannot commit to the repository cannot open issues on a board.

Alignment model

Mapping

Front matter keys use GitHub’s REST names in snake case. Three exceptions are forced by Hugo: type selects a page’s layout, date and lastmod are Hugo’s own dates, and authors is OINK’s existing author key.

GitHub concept GitHub API name Board front matter Notes
Issue number number Prefix of the issue’s file or bundle name in issues/, such as 0042- Sole authority; displayed as #42; see numbering
Title title title
Body body Markdown body
Status status status Sole workflow authority (statuses)
State state derived Accepted as input only when status is absent
Closing reason state_reason derived Same as state
Issue type type issue_type Hugo reserves type; the name follows GraphQL issueType
Labels labels labels List of names
Assignees assignees assignees List of logins; resolved through the authors taxonomy when a term exists
Milestone milestone milestone Milestone title
Author user authors OINK’s existing key; the first entry is the issue’s author
Created created_at date Hugo’s date; a future date hides the page unless the site builds future content
Updated updated_at lastmod From Git when enableGitInfo is on
Closed closed_at closed_at A plain parameter, not a Hugo date
Closed by closed_by closed_by Optional login
Parent issue parent_issue_url parent Issue number
Sub-issues sub_issues_summary derived from parent
Blocked by blockedBy blocked_by List of issue numbers
Blocking blocking derived from blocked_by
Duplicate of duplicate_issue_id duplicate_of Issue number; required by a status in the duplicate category
Issue fields issue_field_values One flat key per field: priority, effort, start_date, target_date, custom keys See issue fields
Development Development sidebar development List of URLs to pull requests, branches or commits on any forge
Comments, reactions, lock, pin, draft various none Not mirrored; see non-goals

The vocabularies that GitHub keeps at repository or organization level are declared once per board:

GitHub vocabulary Where GitHub keeps it Board configuration key Inheritance
Statuses (fixed in the preview; a project’s Status options are editable) Issue statuses, Projects spec.statuses Replaces
Issue types Organization or personal account spec.issue_types Replaces
Issue fields Organization or personal account spec.fields Replaces
Labels Repository spec.labels Merges by name
Milestones Repository spec.milestones Merges by title
Saved views and repository boards; project views Repository, Projects spec.views Replaces
Issue templates .github/ISSUE_TEMPLATE/ The board’s templates/ directory Per board

Statuses

The default list is GitHub’s seven issue statuses, in GitHub’s order.

Status Category State Closing reason
Backlog backlog open
Todo planned open
In progress started open
In review started open
Done completed closed completed
Not planned not_planned closed not_planned
Duplicate duplicate closed duplicate
  1. status is the only authority. state and state_reason are derived from the status category, as GitHub derives them when a status is set.
  2. Matching follows GitHub’s project sync. Case, extra spaces and emoji are ignored, so In Progress and in progress both select In progress. Pages always show the declared name.
  3. A missing status is derived. An issue with state: closed takes the first status whose category matches its state_reason: completed or an absent reason gives Done, not_planned gives Not planned, duplicate gives Duplicate. Every other issue takes the first status in the backlog category, which matches GitHub giving new and reopened issues Backlog.
  4. Disagreement warns. If status and state or state_reason are both present and disagree, the build warns and status wins. GitHub’s API rejects such a mismatch.
  5. An unknown status warns. The issue is treated as open and placed in a No status column. GitHub boards also show items without a status.
  6. Duplicates need a target. A status in the duplicate category requires duplicate_of. Without it the build warns and the page shows “Closed as duplicate” with no link.
  7. Boards may replace the list. Each entry needs a name and one of the six categories, and may add a color and a description. An entry without a valid category is dropped with a warning. GitHub Projects allow custom Status options in the same way. The category, not the name, carries the meaning, so a status such as Sandbox in the backlog category behaves like Backlog.
spec:
  statuses:
    - {name: Sandbox, category: backlog, color: gray}
    - {name: Todo, category: planned}
    - {name: In progress, category: started, color: yellow}
    - {name: Done, category: completed, color: purple}
    - {name: Dropped, category: not_planned}

GitHub’s statuses are a public preview and may change. Categories are the stable anchor here. If GitHub renames a status, only the theme’s default list changes, in a release with a migration note.

Issue types

The default types are GitHub’s organization defaults: Task, Bug and Feature. Each has a name, a description and a color taken from GitHub’s named palette: gray, blue, green, yellow, orange, red, pink and purple. The default descriptions and colors must be checked against GitHub before implementation.

An issue with an undeclared issue_type builds with a warning and renders untyped. A board can declare its own list. A spec-driven board might use Research, Design, Feature, Bug and Verify. The type names the kind of deliverable, and the status names how far the work has gone.

A file that writes GitHub’s own type: key changes the page’s Hugo content type. The page then leaves the board and renders with another layout. The board’s resolver looks for pages under the board whose content type differs from the board’s and whose type value matches a declared issue type. For each one it warns: use issue_type.

Issue fields

The default fields are GitHub’s four defaults:

Field Key Type Options
Priority priority single select Urgent, High, Medium, Low
Effort effort single select High, Medium, Low
Start date start_date date
Target date target_date date

The field types are GitHub’s: text, number, date, single_select and multi_select. A field’s key is its name in lower case, with spaces and hyphens turned into underscores, unless the field declares an explicit key. Dates are written YYYY-MM-DD. Option names are matched the same way as statuses.

A field whose key collides with a reserved key warns and is dropped. Reserved keys are Hugo’s front matter fields, the issue keys in the mapping, and OINK page parameters. An invalid value, or an option that is not declared, warns and leaves that field empty for that issue.

Labels and milestones

Labels and milestones are open vocabularies. Any name works without being declared, and a declaration only adds a color, a description or a due date. Statuses, issue types and single-select options are closed vocabularies because they control state, grouping and order.

The theme ships the nine labels GitHub gives a new repository, an owner decision of 2026-12-03:

Label Color Description
bug d73a4a Something isn’t working
documentation 0075ca Improvements or additions to documentation
duplicate cfd3d7 This issue or pull request already exists
enhancement a2eeef New feature or request
good first issue 7057ff Good for newcomers
help wanted 008672 Extra attention is needed
invalid e4e669 This doesn’t seem right
question d876e3 Further information is requested
wontfix ffffff This will not be worked on

Declarations merge by name from the theme to params.ui.spec.labels to the board’s spec.labels. A board adds labels or recolors a default without repeating the other eight. An unused default label costs nothing, because pages show only the labels that issues use. The descriptions are translated into all 32 locales.

Label colors are six-digit hex values, with or without #, as on GitHub. Pages show a label’s color only as a small swatch beside text in the preset’s own ink. Author colors never set chip backgrounds, so contrast, dark mode and forced colors stay under the preset’s control.

A milestone declaration has title, description, due_on and state (open or closed), as on GitHub. A declared milestone shows its due date and a progress count of closed issues out of all its issues. An undeclared milestone shows its title only.

Relationships

  • Parent and sub-issues. parent: 12 makes this issue a sub-issue of #12. The parent lists its sub-issues and a summary in GitHub’s shape: total, completed and percent_completed. As proposed here, completed counts sub-issues in a closed category; GitHub’s exact count must be checked before implementation. The theme follows GitHub’s limits of 100 sub-issues per parent and eight levels of nesting.
  • Dependencies. blocked_by: [7, 9] is stored on the blocked issue, and blocking is derived on #7 and #9. While any blocker is open, cards and the issue header show a Blocked mark, as GitHub boards and issue lists do.
  • Duplicates. duplicate_of: 17 links “Closed as duplicate of #17”.
  • Integrity. A reference to a missing number, to a number that two issues share, to the issue itself, or an edge that closes a parent cycle warns, and that edge is ignored. In version 1, references stay within one board.

Relationships live in front matter, never in directories. Sub-issues sit beside their parent in issues/, so changing a parent edits one line and moves no file.

Issue templates

GitHub keeps Markdown issue templates in .github/ISSUE_TEMPLATE/, with front matter name, about, title, labels, assignees and type. A board keeps them in templates/. GitHub’s title and type collide with Hugo’s own keys, and a template page needs Hugo’s title and description for itself, so the keys move as follows:

GitHub template key Board template key Meaning
name title The template’s name, shown in navigation
about description What the template is for
title issue_title Default title of a new issue, such as "[Bug] "
labels labels Default labels
assignees assignees Default assignees
type issue_type Default issue type

The body is the skeleton of a new issue. A template may also set default issue fields, such as priority, and a default status.

Board layout

The layout is fixed, as a filesystem hierarchy standard is. Every board has the same shape, so a person, an agent, the archetypes and the CLI all know where anything is without configuration.

<board>/                          board root: any section of type spec
├── _index.md                     board page: README body and spec configuration
├── RULE.md                       document: RULE, weight 1
├── RULE.zh.md                    its translation
├── ARCH.md                       document: ARCH, weight 2
├── <name>.md                     more documents: contracts, glossary, process
├── <group>/                      a group of documents, such as decisions/
│   ├── _index.md
│   └── <name>.md
├── issues/                       reserved: every issue, flat
│   ├── _index.md                 the issue list
│   ├── 0001-<slug>.md            issue #1
│   ├── 0001-<slug>.zh.md         its translation
│   └── 0042-<slug>/              issue #42 as a leaf bundle
│       ├── index.md
│       └── sequence.png
└── templates/                    reserved: issue templates
    ├── _index.md
    └── <name>.md
  1. Place decides kind. The board root’s _index.md is the board page. issues/_index.md is the issue list, and every regular page under issues/ is an issue. A page under templates/ is a template. Every other page under the board is a document. issues and templates are reserved names at the board root and nowhere else.
  2. The name decides the number. An issue’s number is the prefix of its file name, or of its directory name when it is a bundle (numbering). Outside issues/ a leading number is only part of a name. An ADR-style decisions/0001-use-hugo.md stays a document.
  3. Fixed parts sit at the top and growth goes below. The board root holds only fixed things: the board page, documents and the two reserved directories. Only issues/ grows. In navigation, in the board’s Markdown output and in LLMS output, documents come before issues, ordered by weight. The spec-board archetype gives RULE weight 1 and ARCH weight 2. Their upper-case names follow README.md and AGENTS.md, so they stand out in a repository listing; Hugo still serves them at /spec/rule/ and /spec/arch/.
  4. Issues are flat. issues/ contains issue files and issue bundles, nothing else. Status, type, parent, milestone and date are front matter. Directories for them would move a file, change its URL and split its Git history whenever a value changed. Closed issues stay where they are; there is no archive/ or done/.
  5. A bundle is one issue. An issue that needs images or attachments is a leaf bundle, 0042-<slug>/index.md. Its other files are page resources. Hugo does not publish Markdown files inside a leaf bundle as pages. Long supporting work, such as a plan or a test report, becomes a sub-issue.
  6. The layout is relative to the board root. It is the same at content/spec/, at content/docs/design/, or in a repository that keeps spec/ beside its code and mounts it at content/spec with a Hugo module mount.
Path Kind Numbered URL Listed
_index.md Board page No /spec/ Navigation root
RULE.md, ARCH.md, other root pages Documents No /spec/rule/ First, by weight
<group>/… Documents No /spec/decisions/… After root documents
issues/_index.md Issue list No /spec/issues/ One navigation entry with a count
issues/0042-<slug>.md or issues/0042-<slug>/index.md Issue Yes /spec/issues/0042-<slug>/ Views and the issue list, never one by one in navigation
templates/<name>.md Template No /spec/templates/<name>/ One navigation group

Size. Git and Hugo handle thousands of files in one directory. GitHub’s web file browser lists at most 1,000 entries of a directory, and GitHub recommends at most 3,000. A bilingual board has two files per issue, so GitHub’s listing shows every file up to 500 issues. Boards beyond that are open decision 7.

Numbering

Rules

  1. Form. The number is the first part of the name: four decimal digits, zero-padded, then a hyphen and a slug, as in 0042-spec-boards. Numbers above 9999 use as many digits as they need. The slug uses lower-case ASCII letters, digits and single hyphens. A translation keeps the name and adds its language: 0042-spec-boards.zh.md, or index.zh.md inside a bundle.
  2. Value. The number is the integer value of the prefix and starts at 1. 0000 is not a number.
  3. Unique. A number belongs to one issue in the board, in every language. Translations share it because they share the name.
  4. Permanent. A number never changes and is never reused. Abandoned work is closed as Not planned or Duplicate rather than deleted. A deleted issue’s number stays retired. The slug may change; the old URL then becomes an alias.
  5. Next. A new issue takes the highest number in the board plus one, counting closed issues and all languages. Gaps are never filled.
  6. Only the name. Front matter has no number key, so there is never a second copy to disagree with the name.

The fixed width makes alphabetical order equal number order in ls, in editors and in GitHub’s file list. ls issues | tail -1 shows the highest number. That is the simplest way for a person or an agent to find the next one.

Enforcement

A naming rule that only people remember fails at the first busy week. Each layer below catches what the one before it lets through.

Layer When Owner What it does
E1 Written rule Before writing spec-board archetype Writes an “Issues and numbers” section with rules 1 to 6 into RULE.md, where agents read first. The board page and its Markdown output show the next number and the exact path to create, such as issues/0043-<slug>.md
E2 Creation hugo new content spec archetype Computes the next number from the board, fills title, status and date, and warns when the given name is malformed, already taken, or not the next number. A probe on Hugo 0.171.0 on 2026-12-03 confirmed that an archetype can read the board and warn
E3 Build Every build and hugo server Board resolver Warns for every violation (diagnostics) and shows it. Unnumbered and conflicting issues are listed under Needs attention at the top of the issue list, and a shared number cannot be referenced
E4 Gate Pre-commit hook, CI oink spec check (CLI, own lifecycle) Exits non-zero for every E3 problem and for problems that need Git: a number reused after a deletion, a renumbered issue that was already published, and a collision with a base branch (--against main)
E5 Repair After a collision oink spec renumber Moves the later issue to the next free number and rewrites parent, blocked_by and duplicate_of references to it

Hugo alone provides E1 to E3. E4 and E5 serve teams and agents that work on parallel branches. The theme’s E3 warnings never stop a build; a site that wants a hard gate runs E4.

Collisions

  • Two agents in one worktree. oink spec new allocates under an exclusive lock, so two sessions never receive the same number. Agents without the CLI rely on E2 and E3.
  • Two branches. Two branches can both create #43 with different slugs. Git reports no conflict because the file names differ. E3 reports the duplicate after the merge, and E4 with --against reports it before. The issue that reaches the default branch first keeps the number. The other renumbers with E5 before it merges. It was never published, so it needs no alias.
  • Imports. Issues imported from GitHub keep their GitHub numbers. Local numbering continues from the highest number. Pull requests also consume GitHub numbers, so imported boards have gaps, which rule 5 allows.

Proposed behavior

Boards

A board is the topmost section of content type spec. A top-level section named spec gets the type from its name. Any other section sets type: spec and cascades it, which the spec-board archetype writes:

---
title: Theme work
description: Specs and work items for the theme.
type: spec
cascade:
  type: spec
  backlinks: true   # "mentioned in" on every issue
spec:
  milestones:
    - {title: v1.9.0, due_on: 2027-01-15}
  labels:
    - {name: presets, color: 5319e7, description: Visual presets}
  views:
    - {name: Board, layout: board, query: "-status:Duplicate"}
    - name: Open bugs
      layout: table
      query: "is:open type:Bug"
      fields: [title, status, assignees, labels, priority]
      sort_by: priority-desc
---

The README of the board. It follows the views on the board page.

spec belongs to the documentation family. Today the shell treats docs and book alike in several places: the sidebar root, the sequential pager, navigation JSON, the section index, translation comparison and the Docs entry of the navbar. It treats spec the same, through one helper that replaces those repeated type lists. A board can therefore live inside a docs tree. content/docs/design/ keeps the docs sidebar and the Docs navbar entry, and a reader moves between the board and the rest of the docs without changing shells.

Navigation. The shared sidebar lists the board’s documents as ordinary entries, issues/ as one entry with its count, and templates as one group. It never lists individual issues, because a board can hold thousands. On an issue page, the pager moves to the previous and the next issue by number. A nested section with its own spec map warns, and the map is ignored.

Configuration

Site defaults live in params.ui.spec, and a board’s _index.md overrides them with a spec map, following the theme rule that page overrides drop ui.. The keys are statuses, issue_types, fields, labels, milestones and views. A closed vocabulary present on the board replaces the site’s whole list: statuses, issue types, fields and views. An open vocabulary merges by name: labels and milestones. The resolver validates entries with the shared validate.html pattern. It runs once per board and language through partialCached, and every template that needs the board reads its result.

Views

A view follows a saved view in GitHub’s repository boards and projects. It has a name, a layout (board, table or roadmap), a query, the fields it shows and a sort_by setting. Board views also accept column_by, columns and closed_limit. Roadmap views also accept dates. fields may name any issue key in the mapping, any declared field, and Hugo’s date and description.

When a board declares no views, it gets two:

View Behavior
Board One column per status, in declared order. Columns in the not_planned and duplicate categories are collapsed in a native disclosure. Each closed column shows its closed_limit (default 20) most recently closed issues, sorted by closed_at, then lastmod, and links to the issue list for the rest. A No status column appears only when it has issues.
Roadmap Bars from start_date to target_date on a month grid, with declared milestones’ due_on dates as markers. An issue with one date is a point. Issues without dates are counted and linked to the issue list. The view is omitted when no issue has a date.

column_by defaults to status. It may name any single-select field, as a GitHub project board can, for example to show columns by priority. columns picks and orders the visible options.

Query. The query uses GitHub’s issue search syntax. Version 1 applies this subset at build time:

  • Space-separated terms are combined with AND. A comma separates alternatives within a qualifier, as in label:bug,docs. A leading - negates a term. Double quotes hold values with spaces.
  • Qualifiers: is:open, is:closed, is:issue, status:, category: (written not-planned for the not_planned category, as in GitHub search), reason: (completed, "not planned", duplicate), type:, label:, assignee:, author:, milestone:, no: and has: (with label, assignee, milestone or type), and field.<name>: with >, >=, < and <= for number and date fields.
  • sort: with created or updated and -asc or -desc. A view’s sort_by, which is GitHub Projects’ “Sort by” setting and may name any field, takes precedence over sort:.
  • The build cannot apply free text, the AND and OR keywords, parentheses, @me, @today and relative dates, involves:, linked:, user:, org:, or unknown qualifiers. Each one warns and is ignored, so a view shows more issues, never fewer. A client-side parser for the full syntax is a phase 3 candidate.

Cards show the number and title, the type, up to three labels and a count of the rest, assignees, sub-issue progress, the Blocked mark, and the view’s fields.

Rendering. All views of a board are rendered into the board’s one HTML page as sections. Without JavaScript they stack, and a link list at the top jumps between them. With the optional chunk they become tabs, and the selected tab is kept in the URL hash. The README follows the views as one more section, which becomes one more tab. Whether very large boards also need separate URLs per view is open decision 2.

Issue list

issues/_index.md renders the counterpart of a repository’s Issues tab. It is a table of every issue, newest number first, in two parts with counts: Open and Closed. The Closed part is a native disclosure. The columns are number and title, status, type, assignees, labels, milestone and lastmod. When the board has unnumbered issues or shared numbers, a Needs attention part comes first. The page is the complete table, so board views link here for anything they leave out. Print expands everything.

Issue page

  • Header. The title followed by #42, a state badge with an icon and the status name, and a byline such as “alice opened on 2026-12-03”. A closed issue reads “Closed as completed”, “Closed as not planned” or “Closed as duplicate of #17”, with closed_at when it is known.
  • Body. The Markdown body, followed by a Sub-issues block with a progress meter and the sub-issues’ numbers, titles and states. Authors can record activity with Update headings or a Timeline list; Git history remains the event log.
  • Right rail. Groups appear in GitHub’s sidebar order: Assignees, Labels, Type, Fields, Milestone, Relationships (Parent issue, Blocked by, Blocking, Duplicate of), and Development. The existing TOC group and the backlinks group follow. The backlinks group serves as GitHub’s “mentioned in”.
  • Left sidebar. The shared sidebar, as described in boards.

Documents and templates

Documents render as ordinary reading pages with the shell’s TOC. The board’s _index.md body is its README, the counterpart of a GitHub project’s README. The theme gives no file name special meaning; order comes from weight.

RULE has a single authority. The repository’s AGENTS.md says “read content/spec/RULE.md first” rather than copy the rules. People read the rendered page and agents read the source, so both see the same text.

Templates render in their navigation group as reading pages. A list of their defaults (issue title, labels, assignees, type and fields) comes before the skeleton. They never appear in views or in the issue list. oink spec new --template feature copies a template into a new issue; without the CLI an author copies one by hand.

Outputs

Output Board Issue list Issue
HTML Views and README Open, Closed and Needs attention tables Page described above
Print The README and every view, with disclosures expanded Every issue in full Metadata as a static list, then the body
Markdown README; then documents in order with their Markdown URLs; then “Next issue: issues/0043-<slug>.md”; then a list per status such as - #42 Render spec boards · Feature · @alice · High, with closed statuses limited by closed_limit One table of every issue # Render spec boards (#42), a metadata list, the body, sub-issues and relationships; no component markup
LLMS / LLMSFULL Documents first, then issues by number; LLMSFULL, when the board enables it, concatenates in the same order Listed as a section Included as a page
RSS Issues by date, through the shared safe RSS template
SPECJSON (opt-in) issues.json: an array of objects shaped like GitHub’s REST issues (number, title, state, state_reason, status, type, labels, assignees, milestone, user, created_at, updated_at, closed_at, html_url, parent, sub_issues_summary, issue_dependencies_summary, issue_field_values), plus markdown_url; bodies are left out; validated by schema/spec-issues.v1.schema.json
Search Indexed as a section page Indexed as a section page #42, status, type and labels are added to the page’s keywords

SPECJSON follows the opt-in pattern of LLMSFULL: a board adds it to its own outputs, and the theme never adds it to a site.

Diagnostics

Input Fallback after the warning
params.ui.spec or spec is not a map, or a key has the wrong shape Defaults for that key
A status lacks a valid category, or two names match after normalization The entry is dropped, or the first one is kept
A page in issues/ whose name has no number Listed under Needs attention without a number; it cannot be referenced
A number written at the wrong width, such as 042- or 00042- The number is used; the warning names the expected 0042-
A 0000 prefix Treated as unnumbered
Two issues with the same number Both are listed under Needs attention; references to that number are ignored
A number key in front matter Ignored; the name decides
An issue in a subdirectory of issues/ that is not its own bundle Still an issue; the warning asks to keep issues flat
A section (_index.md) inside issues/ other than the issue list Not an issue; the warning suggests index.md
A board with issues but no issues/_index.md No issue list page; views link to the board page instead
Unknown status on an issue Open, in the No status column
status disagrees with state or state_reason status wins
A duplicate-category status without duplicate_of Rendered without a link
Unknown issue_type Untyped
A GitHub type: key on an issue or template Warning only; the page keeps the content type Hugo gives it
An invalid field value or an undeclared option Field empty for that issue
A field key that collides with a reserved key Field dropped
An invalid label color No swatch
An invalid date (start_date, target_date, closed_at, due_on) Value ignored
A relation to a missing, shared or own number, or a parent cycle Edge ignored
An unsupported query term Term ignored
An unknown view layout, or a view without a name View dropped

Every warning starts with spec: and names the page path and the key, in the format the theme already uses. None of them stops the build. The spec archetype gives the numbering warnings once more when a file is created.

Accessibility, responsive and print

  • Board. Each column is a section labelled by a heading that gives the status name and count. Cards sit in an ordered list, and a card has one tab stop, its title link. Collapsed columns use native details. There is no dragging.
  • Tables. Issue list and table views use a real table whose caption names it, with th scope="col". When the chunk sorts a column it sets aria-sort. Wide tables scroll inside their own container.
  • Roadmap. Each issue’s dates appear as text next to its bar, and the bar itself is decorative. The axis uses logical properties, so it runs from right to left in RTL languages.
  • State and color. State always shows an icon and text, never color alone. The eight named colors map to tokens in each preset’s light and dark palettes. In forced-colors mode, swatches become outlined marks.
  • Narrow screens. Board columns stack, and closed columns stay collapsed.
  • Long titles and labels. Titles wrap. Labels truncate and keep their full text in a title attribute.
  • Reduced motion. Nothing animates.

Security and privacy

Every name and value from front matter is plain text. Label colors must match a six-digit hex pattern, and only then reach a CSS custom property. Status and type colors come from the named enum. development URLs pass through the shared URL policy (content/url.html). JSON is produced with jsonify. A normal build fetches nothing, and nothing is vendored.

Internationalization

Front matter values are canonical names, matching GitHub, so all translations of an issue share them. The theme translates the display names of its default vocabularies into all 32 locales: the seven statuses, three types, four fields and their options, nine label descriptions, two view names, closing phrases, relationship labels, the issue list parts, the next-number line and counts. That comes to about 70 strings. Placeholders are preserved and bin/check-i18n.py checks parity.

Custom vocabularies display their declared name. A translated board _index.<lang>.md can give an entry a label for that language without changing the name that issues use. Each language’s board lists the issues in that language. Falling back to untranslated issues is open decision 4.

First board: OINK Design

The owner chose this section as the first board and the prototype corpus. It is a demanding test. It has six contracts, fourteen decisions, eighteen proposals and twenty-four research records in two languages, and other pages and repositories link to it.

Mapping the layers

Today On the board Reason
Contracts: architecture.md, components.md, shell.md, landing.md, migration.md, expo.md Documents at the board root; URLs unchanged; architecture.md serves as ARCH They describe the present and change in place
decisions/ A document group; URLs unchanged Living rationale for current behavior, updated in place
Process text in _index.md, proposals/_index.md and research/_index.md One new RULE.md with its translation One place for authority, lifecycle, review gate, research rules and the numbering rules
proposals/ (18) and research/ (24) 42 issues in issues/, of type Proposal or Research They record change, have a date and a lifecycle, and close
The hand-written proposals and research tables The Board view and the Proposals and Research table views Generated, so they cannot drift
The PRD outline under “Where a new PRD goes” templates/proposal.md, plus templates/research.md The eight required parts become the skeleton that a new proposal copies

Under this mapping a proposal is no longer retired into a decision. The proposal is an issue that moves from Draft to Done. On the way, its accepted behavior moves into a contract document and its lasting rationale into a decision document, as the current lifecycle already requires.

Vocabularies

content/docs/design/_index.md would carry:

type: spec
cascade:
  type: spec
  search_boost: 0.6
  categories: [Design]
spec:
  statuses:
    - {name: Draft, category: backlog, description: Written and under evaluation}
    - {name: Accepted, category: planned, description: Accepted by the owner, not yet implemented}
    - {name: In progress, category: started, color: yellow, description: Partly implemented}
    - {name: Done, category: completed, color: purple, description: Released, or research recorded}
    - {name: Rejected, category: not_planned}
    - {name: Superseded, category: duplicate, description: Replaced by the issue in duplicate_of}
  issue_types:
    - {name: Proposal, color: purple, description: A PRD or RFC}
    - {name: Research, color: blue, description: Dated, non-normative evidence}
    - {name: Task, color: gray}
    - {name: Bug, color: red}
  fields:
    - {name: Evidence, type: text}
  labels:
    - {name: architecture}
    - {name: components}
    - {name: shell}
    - {name: landing}
    - {name: migration}
    - {name: expo}
    - {name: cli}
  milestones:
    - {title: v1.6.0, due_on: 2026-11-23, state: closed}
    - {title: v1.7.0, due_on: 2026-11-28, state: closed}
    - {title: v1.8.0, due_on: 2026-11-28, state: closed}
    - {title: v1.9.0, state: open}
  views:
    - {name: Board, layout: board}
    - name: Proposals
      layout: table
      query: "type:Proposal"
      fields: [title, status, milestone, labels, description]
      sort_by: created-desc
    - name: Research
      layout: table
      query: "type:Research"
      fields: [title, date, evidence]
      sort_by: created-desc

The six statuses take one category each. The proposal lifecycle therefore fits GitHub’s model without a new concept, and Superseded reuses GitHub’s duplicate link. The labels name the contract a record affects, which the current PRD outline asks for in prose. The milestones are the theme releases that shipped a record.

Numbers

Numbers follow creation dates: a proposal’s proposal_date, and a research record’s date from its file name, or last_verified when the name has none. On the same date a parent comes before its sub-issues, and old paths break the remaining ties. The migration script derives the same table from these rules. The date leaves the research file names, because date keeps it, and one slug changes to avoid two issues named ink-terminal-stabilization. This proposal becomes #42.

# Name in issues/ From Date Type Status Milestone Parent
1 0001-goldmark-attributes research/goldmark-attributes 2026-08-16 Research Done
2 0002-knowledge-graph proposals/knowledge-graph 2026-08-19 Proposal In progress
3 0003-media-convergence proposals/media-convergence 2026-08-20 Proposal In progress
4 0004-consumer-evidence research/consumer-evidence 2026-08-24 Research Done
5 0005-comprehensive-review research/2026-08-26-comprehensive-review 2026-08-26 Research Done
6 0006-upstream-review research/2026-09-19-upstream-review 2026-09-19 Research Done
7 0007-v1-1-release-review research/2026-09-20-release-review 2026-09-20 Research Done
8 0008-oink-cli-roadmap proposals/oink-cli-roadmap 2026-09-29 Proposal In progress
9 0009-cli-acceptance research/2026-09-29-cli-acceptance 2026-09-29 Research Done
10 0010-cli-maintenance-acceptance research/2026-10-03-cli-maintenance-acceptance 2026-10-03 Research Done
11 0011-oink-cli-maintenance-roadmap proposals/oink-cli-maintenance-roadmap 2026-10-03 Proposal Done
12 0012-cli-maintenance-acceptance-r1-r5 research/2026-10-03-cli-maintenance-acceptance-r1-r5 2026-10-03 Research Done #10
13 0013-cli-maintenance-acceptance-r6-r8 research/2026-10-03-cli-maintenance-acceptance-r6-r8 2026-10-03 Research Done #10
14 0014-visual-presets proposals/visual-presets 2026-10-04 Proposal In progress?
15 0015-ink-terminal-experiment research/2026-10-05-ink-terminal-experiment 2026-10-05 Research Done
16 0016-v1-2-release-review research/2026-10-05-v1-2-release-review 2026-10-05 Research Done
17 0017-visual-presets-acceptance research/2026-10-05-visual-presets-acceptance 2026-10-05 Research Done
18 0018-theme-review research/2026-10-13-theme-review 2026-10-13 Research Done
19 0019-consumer-baseline research/2026-10-18-consumer-baseline 2026-10-18 Research Done
20 0020-component-refinement research/2026-10-25-component-refinement 2026-10-25 Research Done
21 0021-ink-terminal-stabilization proposals/ink-terminal-stabilization 2026-10-26 Proposal Done? v1.8.0?
22 0022-ink-terminal-reading-acceptance research/2026-10-26-ink-terminal-stabilization 2026-10-26 Research Done
23 0023-large-table-reading research/2026-10-26-large-table-reading 2026-10-26 Research Done
24 0024-document-comparison research/2026-10-29-document-comparison 2026-10-29 Research Done
25 0025-review-repairs research/2026-11-06-review-repairs 2026-11-06 Research Done
26 0026-v1-5-1-release-review research/2026-11-06-v1-5-1-release-review 2026-11-06 Research Done
27 0027-dependency-acceptance research/2026-11-11-dependency-acceptance 2026-11-11 Research Done
28 0028-theme-roadmap proposals/theme-roadmap 2026-11-21 Proposal In progress
29 0029-local-search-engine proposals/local-search-engine 2026-11-23 Proposal Done v1.6.0
30 0030-content-components-expansion proposals/content-components-expansion 2026-11-27 Proposal Done v1.7.0
31 0031-component-audio proposals/component-audio 2026-11-27 Proposal Done v1.7.0 #30
32 0032-component-map proposals/component-map 2026-11-27 Proposal Done v1.7.0 #30
33 0033-component-social proposals/component-social 2026-11-27 Proposal Done v1.7.0 #30
34 0034-component-timeline proposals/component-timeline 2026-11-27 Proposal Done v1.7.0 #30
35 0035-component-update proposals/component-update 2026-11-27 Proposal Done v1.7.0 #30
36 0036-component-video proposals/component-video 2026-11-27 Proposal Done v1.7.0 #30
37 0037-ink-news-presets proposals/ink-news-presets 2026-11-28 Proposal In progress
38 0038-oink-serve proposals/oink-serve 2026-11-28 Proposal Draft
39 0039-architecture-review research/2026-11-30-architecture-review 2026-11-30 Research Done
40 0040-map-basemaps research/2026-12-01-map-basemaps 2026-12-01 Research Done
41 0041-gap-review research/2026-12-02-gap-review 2026-12-02 Research Done
42 0042-spec-boards proposals/spec-boards 2026-12-03 Proposal Draft

A question mark marks a value the owner must confirm.

Status findings

The inventory turned up what a single status authority would have prevented:

  • #14 visual-presets. Its front matter says partially-implemented, and its callout keeps it active for the Ink and Terminal design acceptance. The proposals index says all six presets ship in v1.8.0.
  • #21 ink-terminal-stabilization. Its front matter says draft, and its callout says v1.7.0 superseded its typography. The proposals index cites it for the v1.8.0 release. Done, Superseded and In progress all have support.
  • Mixed records. #2 (G1 shipped, G2 and G3 draft), #3 (M4 open), #8 (later stages draft), #28 (R0 shipped, R1 to R3 draft) and #37 (three parts open) are each part done and part draft. The table gives them In progress. The GitHub way would close the shipped part as Done and open the rest as new Draft sub-issues. The owner decides whether to split them.
  • Research grades. The research records use nine design_status values, such as review-snapshot, local-verification and dated-evidence. They grade evidence rather than describe a lifecycle, so they move verbatim into the text field evidence. Every research issue is Done, with closed_at on its date.

Migration steps

  1. Precondition. A theme release that contains phase S1 is pinned by the site. The site’s check target uses the local theme, but build, serve and production use the published pin, so the content cannot move before the release.
  2. Move. git mv each record and its translation to issues/, as in the table. Add the old URL to aliases in both language files. Map the keys: design_kind becomes issue_type, design_status becomes status and evidence, and proposal_date becomes date. Add closed_at, milestone and parent. Drop weight, because numbers order issues.
  3. Write. Write RULE.md and RULE.zh.md from the process text of the three index pages, together with the numbering rules. Write templates/proposal.md and templates/research.md in both languages, and the board configuration above. Delete proposals/_index*.md and research/_index*.md, and alias their URLs to issues/. Decisions keep their current keys.
  4. Links. Rewrite links in current site content to the new URLs. Historical release notes keep their links and rely on the aliases. Regenerate the Markdown goldens. Update the Design pointers in the AGENTS.md files of the theme, the site and the CLI, each in its own repository.
  5. Verify. The site’s check and browser targets pass. Every old URL in both languages redirects. No issue keeps design_kind or design_status. The Board’s counts match the table, and the Proposals and Research views list the records that the hand-written tables listed.

Trade-offs and alternatives

  • Status as a taxonomy (rejected). A status is a single-valued state machine, but a taxonomy is many-to-many. Columns need order, category and limits from one declaration, and taxonomies are site configuration that the theme does not declare. labels can still be backed by a site taxonomy for term pages, but no board feature depends on one.
  • state as the authority (rejected). That is GitHub’s model before 2026-11, in which open or closed was the fact and a project’s Status was a separate field that workflows kept in sync. Two authorities can disagree. GitHub’s current model, and this proposal, make status the single authority.
  • Separate issue and task directories (rejected). They would mean two number sequences, two templates, and a choice agents can get wrong. Issue types and sub-issues express the difference, as GitHub does.
  • Directories for status, type, parent or date (rejected). Backlog.md moves finished tasks to other directories, and Spec Kit nests a feature’s tasks in its folder. Every change of value would move a file, change its URL and split its history. Front matter changes one line.
  • Documents and issues in one flat directory (rejected). Telling them apart would need reserved numbers, such as 0000- for templates, or a naming rule, and fixed documents would be lost among hundreds of issues. A directory is a rule nobody has to remember.
  • A number key in front matter (rejected). It would be a second authority beside the file name. Use slug to change a URL.
  • A counter file (rejected). A next: 43 line in _index.md turns parallel allocations into a Git conflict. It is also a second authority, and it drifts as soon as someone adds a file by hand.
  • Random or time-based IDs (rejected). ULIDs or date prefixes avoid collisions. They give up the natural number the owner asked for and GitHub’s #42.
  • Decisions as numbered issues (rejected for OINK Design). ADR practice numbers decisions. OINK’s decisions are living rationale that is updated in place, so they stay documents. Another board can still number its decisions as issues of a Decision type.
  • Hex colors for every vocabulary (rejected). GitHub uses named colors for issue types and project options. Named colors let each preset keep its own voice. Labels keep hex for GitHub compatibility but render as swatches only.
  • Mermaid or ECharts for the roadmap (rejected). Those need a runtime, are hard to print, and ignore presets. A build-time CSS grid has none of these problems.
  • Drag and drop through a local server (deferred). Writing files from a browser belongs to oink serve.

Compatibility and migration

  • The change is additive. No existing key or layout changes meaning. Keys such as issue_type mean something only on spec pages, and issues/ and templates/ are reserved only at a board root.
  • spec joins the default params.ui.shell_types, because chrome, scripts and search depend on membership in that list. A site that sets its own list must add spec; the upgrade note says so.
  • The documentation-family helper replaces type lists that name docs and book. Their behavior for docs and book pages does not change, and the owning checkers prove it.
  • Shipping layouts/spec/ changes the rendering of any existing section whose content type is spec. The inventory found none among maintained sites. A site that has one sets another type for that section.
  • The theme gains an archetypes/ directory for the first time.
  • The generated front matter and site parameter schemas gain the new keys.
  • If GitHub’s status preview changes, the defaults may change in a minor release with a migration note. Boards that declare their own statuses are not affected.
  • The OINK Design migration changes URLs of this site only, with aliases for every old URL (steps).

Implementation plan

Theme

Area Change
Layouts layouts/spec/{baseof,list,single}.html, print variants, and Markdown templates. baseof is thin and reuses the shell partials, as Expo’s does. The list template renders the board page, the issue list or a group’s section page, by place
Partials layouts/_partials/spec/: config.html (resolver), issues.html (collects and resolves a board once per language: kinds by place, numbers by name, derived state, relations and diagnostics), query.html, board.html, table.html, roadmap.html, issue-list.html, card.html, state.html, issue-aside.html, template-defaults.html
Shell One documentation-family helper used by the sidebar root, pager, navigation JSON, section index, translation comparison and navbar; the sidebar shows issues/ as one entry; the pager steps through issues by number
Configuration params.ui.spec defaults in hugo.yaml, including the nine labels; spec added to shell_types; output format SPECJSON; regenerated schemas; schema/spec-issues.v1.schema.json
Styles A new layer assets/css/td/spec.css registered in layers.html; tokens for the named colors in every preset
Runtime An optional chunk at js/chunks/spec for tabs, hash state, table sorting, the today line and overdue hints, selected through a Page Store capability flag
Archetypes archetypes/spec.md: an issue, with next-number computation and the creation warnings. archetypes/spec-board/: _index.md, RULE.md with the numbering section, ARCH.md, issues/_index.md, templates/_index.md, and templates/{bug,feature,task}.md for the three default types
Locales About 70 strings in all 32 locale files
Checks A new owning checker bin/check-spec.py, added to ci.yml beside check-expo.py. Fixtures: a top-level board, a board nested under a docs section, and a mounted board, with a case for every numbering and layout diagnostic. HTML, print, Markdown and JSON goldens. check-output.py, check-params.py, check-i18n.py, check-presets.py and the schema check

Documentation site

  • A Spec boards section in the Shell contract, in both languages, covering the layout, the numbering rules and the diagnostics.
  • The SPECJSON output in the Architecture contract.
  • A guide at /docs/write/spec/ beside the Expo guide, and params.ui.spec in the configuration reference.
  • The OINK Design migration (steps), which is also the site’s demonstration board and browser-test target.

CLI (separate lifecycle, non-normative)

oink spec new assigns the next number under a lock and can copy a template. oink spec check is the E4 gate, with --against for a base branch. oink spec renumber repairs a collision and rewrites references. oink spec status sets a status and stamps closed_at. oink spec import and oink spec export move issues to and from GitHub; they are the payoff of matching GitHub’s model. None of these is required to use a board.

Phases

Phase Scope
S1 Layout and numbering: the resolver, diagnostics and archetypes with creation checks. The issue page, issue list, documents and templates, Board view, parent and sub-issues, Markdown and print outputs, the documentation-family helper, locales, check-spec.py, goldens, guide and contract. Then the OINK Design migration as the acceptance corpus
S2 Table and Roadmap views, the query subset, blocked-by relations, milestone progress, the SPECJSON output, and the optional chunk
S3 (candidates) Swimlanes and table grouping, a client-side parser for the full query syntax, iterations, cross-board projects, #42 autolinks in prose, a layout for boards beyond 500 bilingual issues, project status updates, CLI import and export, browser write-back through oink serve

Acceptance criteria

  1. A fixture board with the default statuses renders seven columns in GitHub’s order. Not planned and Duplicate are collapsed, closed columns respect closed_limit, and a No status column appears only for unknown statuses.
  2. For every status category, the derived state and state_reason match GitHub’s table. Every diagnostics row has a fixture that produces exactly its warning and its fallback, and hugo server keeps serving.
  3. A fixture written from a GitHub REST issue export (status, state, state_reason, type → issue_type, label names, assignee logins, milestone title, created_at → date, closed_at) renders the same as a hand-written equivalent.
  4. Each numbering rule has a fixture that produces its warning and its mark. The spec archetype warns for a taken, malformed or skipped number. The board page and its Markdown output show the next number and path.
  5. A top-level board, a board nested in a docs section, and a mounted board all build. The nested board keeps the docs sidebar and navbar entry, no sidebar lists individual issues, and a numbered file in a document group stays a document.
  6. Board, issue list, Table and Roadmap are complete and usable with JavaScript disabled. Print is static and expanded. Markdown contains no component markup. issues.json validates against its schema.
  7. A page with a GitHub type: key inside a board produces the issue_type warning.
  8. The resolver runs once per board and language. Template metrics on a generated board of 1,000 issues confirm this, and its build time is recorded as a baseline.
  9. The OINK Design board holds the 42 records. Every old URL in both languages redirects, and the generated views list what the hand-written tables listed. The site’s check and browser targets pass.
  10. Rendered review on the documentation site covers English and Chinese, desktop and mobile, light and dark in all six presets, forced colors and an RTL locale.
  11. The owning checker, the goldens and the whole ci.yml list pass.

Open decisions

  1. Default shell_types. The proposal adds spec, given the consumer evidence. The alternative is to make boards opt-in through each site’s list.
  2. View URLs. One page holds all views (proposed for version 1), or each view gets its own URL through output formats, which suits very large boards.
  3. Sub-issue progress. Confirm how GitHub counts completed, including whether Not planned and Duplicate sub-issues count toward total.
  4. Multilingual boards. Each language lists only its own issues (proposed), or untranslated issues fall back to the default language with a marker.
  5. #42 in prose. Leave plain text (proposed for version 1), or add an autolink pass that has to skip code.
  6. Default closed_limit. 20 as proposed, or another value.
  7. Large boards. Before any board nears GitHub’s 1,000-entry listing, either define one fixed bucket scheme, such as issues/1000/1042-…, or advise splitting into several boards.
  8. OINK Design statuses. Confirm the six statuses, the two conflicting records (#14 and #21), and whether the mixed records are split into sub-issues.
  9. Document names. Upper-case RULE.md and ARCH.md for new boards (proposed) or lower case like other content files; and for OINK Design, keep architecture.md as ARCH (proposed, no URL change) or rename it with an alias.

Decision log

  • 2026-12-03 (owner): Asked for a new reading surface that tracks specs as local Markdown files, with GitHub Projects and Issues as the model and no dependency on GitHub. Each item has a natural number, status lives in front matter, RULE and ARCH are fixed charter pages, and a companion CLI may follow.
  • 2026-12-03 (owner): Asked that the data model follow GitHub Issues and Projects, including default field names and available statuses.
  • 2026-12-03 (owner): Kept spec as the working name. Chose to build in GitHub’s nine default labels. Named the OINK Design section as the prototype corpus and first board, to be converted to this model.
  • 2026-12-03 (owner): Asked for a numbering design that users can be held to, with the number fixed at the front of the name, and for a designed directory layout instead of a flat folder.
  • 2026-12-03: Claude wrote the first draft. It aligns with GitHub’s 2026-11-23 issue status preview, makes status the single authority, uses issue_type because Hugo reserves type, and keeps status in front matter rather than a taxonomy.
  • 2026-12-03: Claude revised the draft after the owner’s second round. It adds the fixed layout with reserved issues/ and templates/, the numbering rules with five enforcement layers, issue templates, the issue list page, the documentation-family type for nested boards, label merging, and the OINK Design mapping with 42 numbered records. These are agent recommendations, not owner decisions.

15 - Roles: audience spaces, role switching and version comparison

Accepted design for native Hugo roles in OINK. A role becomes an audience space with its own derived shape of languages and versions, a role switcher on C, role-aware links and configuration, confined outputs and browser state for protected spaces, and a Duo View that V opens on another version of the same page.
Accepted design, local implementation (2026-12-04)

The v2 design is accepted. The candidate implementation is available in the sibling theme checkout. Normative behavior now lives in the Shell and Architecture contracts; user setup is documented in Spaces (roles). The December 5 prerelease review retained two shortcut fallbacks. Without another space, C opens commands. Without a version counterpart, V cycles the version menu.

Record Value
Status Accepted v2 design (2026-12-04), implemented in the local release candidate; all design decisions settled (decision log)
Owner OINK maintainers
Owner decisions C switches roles and \ keeps opening commands; V opens Duo View on another version instead of cycling versions; one reader serves both keys, switching axes in place when the other key is pressed; role-autonomous defaults, transitive peer discovery, automatic sitemap.xml emptying for index: false, and history-scope confinement for unlisted roles
Baseline Hugo 0.171.0 (roles since 0.153.0); theme main
New public API params.ui.roles, params.ui.role_menu; a roles filter on configured menu entries, palette commands, page context links and params.versions entries; actions switch_role and compare_versions; link state role; shortcut rows role and duo-version
Changed public behavior C and V bindings; Duo View targets, axis switching and pane headings; where a prefixed role publishes its search index; robots and sitemap.xml for roles with index: false; history storage scope for unlisted roles
Affected contracts Shell · keyboard, Shell · translation comparison, Shell · version menus, Architecture · outputs, Architecture · version links, the document comparison decision, the configuration reference and generated schemas, all 32 locales
Related Gap review 2026-12-02 lists roles as an unused Hugo capability. The Spec boards draft describes content an internal role could hold. Follow-up needed in oink-cli (internal/app/authoring.go) to accept sites.matrix.roles mounts

Summary

A Hugo role is a third site dimension beside language and version. It is meant for audiences: the same project builds a public manual and, under /spec/, an internal one. Hugo gives a role a name, a weight and an output prefix, nothing else. It has no access control, no label, no per-role configuration, and it builds every combination of language, version and role whether or not the combination has content.

This proposal makes roles usable in OINK without a second configuration authority:

  1. Content defines each role’s autonomous shape. Every role derives its non-empty sites, versions, languages, default version, default language and entry routes from its mounted content. Combinations without rendered content files are empty sites; OINK excludes them from every switcher and renders their HTML home as a redirect.
  2. Roles get a reader interface across every breakpoint. params.ui.roles gives each role a label, an icon, whether other roles list it, and whether search engines index it. The controls appear in Space, language, version order, C cycles roles, and non-default spaces retain a compact compass indicator even on mobile or when no other role is listed.
  3. Links and site configuration understand roles. A non-default role falls back to the default role across version and default-language boundaries; explicit /<role>/... links adapt to the target role’s available versions and languages; menus, palette commands, page links and external versions filter by roles before resolving targets.
  4. Protected roles leave zero public footprint. Everything OINK generates for a prefixed role stays under that role’s directory—including search indexes, sitemap.xml emptying when index: false, llms.txt isolation, role-keyed template caches, static JS chunks and localStorage browsing history—so one server rule protects it, or a Hugo environment omits it.
  5. V opens Duo View on another version. The reader that B opens on a translation gains a version axis over the page’s full transitive equivalence class of counterparts, with linked version and language menus, independent axis preferences, and direct B ↔ V axis switching.

Background and evidence

What Hugo does

The rows below were verified with scratch builds on Hugo 0.171.0:

Behavior Observation
Configuration roles takes a weight per role; defaultContentRole and defaultContentRoleInSubdir choose the default and its directory. Site.Role has only Name and IsDefault (roles, Site.Role)
Access control None. Hugo expects authentication outside Hugo, by directory (PR #13679)
Output paths /<role>/<version>/<language>/; default values take no directory unless their …InSubdir option is set
Assignment A mount’s or a page’s sites.matrix chooses roles, versions and languages; _role_<name>_ in a file name since 0.161.0. Content without sites belongs to the default role only
Dimensions Independent. A mount can give a role one language and one version while the default role has several of each
Full matrix Every combination is a site. Two roles, three versions and two languages make twelve sites; a Chinese-only role still gets a home page, 404.html, sitemap.xml and taxonomy pages in every other cell unless suppressed
Cascade on home A blanket cascade setting build: {render: never} on languages: ['**', '! zh'] also suppresses (spec, defaultVersion, en)’s home, removing /spec/index.html and causing /spec/ to 404 unless kind excludes home
Rotate "role" Returns existing peers of a page in other roles with the exact same language and version only
sites.complements Lends pages to another site’s lists only. GetPage returns nil and relref fails with REF_NOT_FOUND in the borrowing site
Configured menus Apply to every role of a language. A sites key on a menu entry is ignored. Front matter menu entries belong to the page’s own role
static/ Published at the root for every build, even through a mount whose sites.matrix names a role, and even in a segment build that excludes that role
Global resources resources.Get and resources.FromString publish relative to the publish root (without baseURL’s subpath); prefixing their target with <role>/... confines them under that role’s directory
Segments --renderSegments writes only the selected sites, but hugo.Sites and Rotate still return the excluded ones. A segment with only excludes renders nothing
Environments Configuration layered with --config a.yaml,b.yaml or config/<environment>/ can add a role and its mounts; the other build never knows the role. Mount lists replace, they do not merge
Sitemaps Each site writes its own; the root sitemap index lists only the default role and version
Aliases, 404 Published inside the role’s directory
Templates single._role_staff_.html applies only to that role

What OINK does today

Core link and site-index tables include .Site.Role.Name, and bin/check-version-links.py builds two symmetrical roles. However, building an asymmetric spec role (Chinese-only, single-version) beside a multilingual, multi-version public role exposed defects across both UI and isolation:

Area Observed
Empty sites spec counted as natively versioned. Its version menu offered v4.1 and v3.2 home pages and external archives; its language menu offered the empty English home
Search & chunks Every spec site published offline-search-index.spec.*.json at the root, outside /spec/, including five empty-site indexes; js/chunks/google-search-<lang>.js baked in absLangURL without role or version isolation
Cache collisions backlinks-index.html, actions/root-order.html, shell/blog-index-pages.html, theme-color-pair.html and images-authored.html omitted role/version from partialCached keys, risking cross-role leakage of unlisted URLs and titles
Links A spec (zh) page linking to public /docs/install/ warned as missing; an English public page linking explicitly to /spec/design/storage/ missed when spec had no en site
Configuration & LLMS Site menus, palette commands and params.versions archives appeared in spec and warned on missing targets; index.llms.txt did not filter role-scoped menus
Browser history history.js stored all visits under td-history:<basePath>, exposing visited /spec/ titles and URLs inside the public H history dialog
Interface No role menu, no shortcut, no palette action, and no space indicator on desktop or mobile

Meanwhile, Duo View paired only translations of the same version (.Translations), while V cycled switch_version targets blindly.

Goals and non-goals

Goals:

  • a project can hold a versioned, multilingual public manual and an unversioned, single-language internal space in one build;
  • each role’s languages, versions, default version, default language and entry routes follow automatically from its content, with no shape declaration;
  • readers can see which space they are in across desktop and mobile, and switch spaces by menu, palette and C;
  • pages can link implicitly from a non-default role to the default role (across version and default-language gaps) and explicitly across roles without spurious warnings, while warning once when a listed role links into an unlisted one;
  • everything OINK generates or stores for an unlisted role stays confined to its prefix, and a public build can omit a role completely;
  • readers compare a page side by side with any published counterpart across versions and languages in one shared Duo View.

Non-goals:

  • authentication, authorization or encryption; OINK remains a static theme;
  • per-role site titles, logos, presets or parameter files; roles share site configuration except for scoped configuration and ordinary Hugo cascade front matter overrides;
  • search across roles, or comparing pages across different roles;
  • text diffs, changed-paragraph highlighting or line-by-line locking;
  • Hugo sites.complements; it lends pages to lists only and breaks links;
  • changing how Hugo assigns content to roles.

Model

  • Role: an audience space.
  • Site: one cell of the matrix (role × version × language).
  • Empty site: a site of a non-default role in which no page comes from a content file of that site (.File != nil and .Site.Home == $site.Home) that renders output (content/renders-page.html). The default role keeps today’s behavior so a language whose home is built solely from Landing data keeps its place in menus.

content/role-index.html derives a six-part shape for every role that has at least one non-empty site:

  • sites: non-empty sites of the role in Hugo’s order, plus a "<version>|<lang>" lookup table;
  • versions / versioned: Hugo-ordered versions with at least one non-empty site; versioned is true when len(versions) > 1;
  • languages: ordered languages with at least one non-empty site;
  • defaultVersion: Hugo’s default version if present in versions, else versions[0];
  • defaultLanguage: Hugo’s default language if present in languages, else languages[0];
  • entry / entryByLanguage: entryByLanguage[lang] is (defaultVersion, lang)’s published HTML home if present, else the first non-empty site of the role in lang with an HTML home; entry is entryByLanguage[defaultLanguage] (or the role’s first published HTML home).

For the example with English as the project default:

Role Non-empty sites Versioned Default version / lang Entry
public (default) v4.2, v4.1, v3.2 × en, zh Yes v4.2 / en / (zh: /zh/)
spec v4.2 × zh No v4.2 / zh /spec/zh/

A role declared in roles that has zero non-empty sites warns once, never appears as a target, and redirects its home to the default role’s entry.

Proposed behavior

Configuration

defaultContentRole: public
roles:
  public: {weight: 1}
  spec: {weight: 2}
params:
  ui:
    role_menu: Space            # optional; localized ui_role otherwise
    roles:
      public:
        label: Documentation
      spec:
        label: Internal spec
        icon: fa-solid fa-lock
        listed: false
        index: false
Key Type, default Meaning
params.ui.role_menu string, localized ui_role (“Space”, “空间”) Role menu name and switch_role palette title. The keyboard help uses ui_shortcut_role.
params.ui.roles.<role>.label string, the role name Text of the role in menus and the palette
params.ui.roles.<role>.icon Font Awesome class pair, none Icon beside the role name in the Space menu
params.ui.roles.<role>.listed boolean, true Whether other roles offer this role. Its own pages always offer listed roles so a reader can leave
params.ui.roles.<role>.index boolean, true false writes noindex, nofollow on the role’s HTML and empties its sitemap.xml

A language overrides label and role_menu in its own params.ui. An entry for an undefined role, a non-string label, an invalid icon or a non-boolean switch warns once and uses the default. A role needs no entry.

Empty sites

  • Empty sites are never targets of language, version or role menus, the palette, X, C, Duo View, hreflang alternates or LLMS peers, and do not count toward a role’s versions or languages.
  • shell/search-enabled.html is false on empty sites, and search/index-resources.html publishes no search index for them, so residual 404.html or taxonomy pages in an empty site neither publish empty indexes nor fail looking one up.
  • In baseof.html and baseof.landing.html, empty-site home redirection (content/role-home.html) runs before version-home.html, writing a redirect to entryByLanguage[lang] (else entry) with a canonical link and noindex, nofollow. Typing /spec/ lands on /spec/zh/. version_home applies only to non-empty sites of versioned roles whose version differs from defaultVersion.
  • Residual pages rendered in an empty site carry noindex, nofollow and an empty sitemap.xml.

Role switching

content/role-targets.html returns one ordered list per page, in Hugo’s role order, shared by the navbar, mobile drawers, compact subnav, footer line, palette and C. For each role $R$ other than the current one, it picks the first published HTML page among:

  1. the exact peer in (R, currentVersion, currentLang) from .Rotate "role";
  2. the same logical path or a translated path in the target role, checking the current language, the role default, then remaining languages in Hugo order. Within each language, try the current edition, the role default, then the remaining editions in Hugo order;
  3. $R$’s home in (currentVersion, currentLang) when that site is non-empty;
  4. R.entryByLanguage[currentLang];
  5. R.entry.

Steps 3–5 carry data-td-role-home. A role with listed: false appears only on its own pages. A role with no non-empty site never appears.

  • The desktop navbar, mobile drawers and footer dock order their controls Space, language, version. The navbar and footer use a compass for Space. Hover, focus or tap opens the choices. Entries carry their role’s label and icon.
  • Non-default roles keep the compass in the phone bar. Other dimensions are available in the drawer and footer. With no alternate target a non-default role shows a static compass with its space name available to assistive technology.
  • Palette and keyboard. switch_role is a palette choice action available whenever at least one other target exists. C cycles to the next non-active target, wrapping.

content/site-link.html and content/site-destination.html gain symmetric fallback and explicit resolution:

  • Fallback to the default role. In a non-default role, a site-root path that matches nothing in the current role tries non-empty sites of the default role $D$ in the same language and edition order as the role switcher. A hit returns state role and data-td-link="role" without warning. The default role never falls back into another role, and non-default roles never fall back into one another.
  • Explicit role segment. When a site-root path matches no real page, route or resource in the current role and its first segment names a role $R$, the remainder resolves in $R$, recognizing optional leading version and language segments. An explicit dimension is binding. Unspecified dimensions follow the role switcher’s candidate order. The default role also accepts its logical name when its published URLs have no role directory. /spec/design/storage/ from an English public page therefore resolves to /spec/zh/design/storage/. Cross-role hits carry state role and data-td-link="role". A real page at that path in the current role always wins.
  • Cache-safe leak warning. When a listed role resolves an explicit link into a role with listed: false, site-destination.html returns leakedRole as pure data and site-link.html (outside partialCached, when not .quiet) warns once per source file or configuration key and authored target URL.

Scoped configuration

Configured lists filter entries by roles before resolving target URLs:

Entry Where roles goes Default when roles is omitted
Configured menu entry (and children) params: {roles: [public]} Every role
params.ui.command_palette.commands[] roles: [public] Every role
params.ui.page_context_menu.links[] roles: [public] Every role
params.versions[] roles: [public] versioned roles when the project has > 1 native versions; listed: true roles when the project has 1 native version
  • A shared content/role-menus.html filters .Site.Menus.main (and child trees, hiding parent panels whose children are all filtered out) across navbar.html, navbar-group-items.html, shell/subnav.html, actions/quick-links.html, actions/root-order.html and index.llms.txt. navbar-entry-link.html never marks an entry .active when its link resolved via state == "role".
  • actions/site-commands.html reads default-language base commands from unfiltered hugo.Sites so localized command overrides in a single-language role still inherit base url/action/roles before filtering.
  • content/version-targets.html trims leading, trailing and consecutive "---" separators left after filtering, and content/archive-directories.html applies the same role filter.
  • Unknown role names warn once and are ignored. An explicit malformed allowlist skips the entry.

Outputs, caches and confinement

  • Search. Whenever a site’s role carries a directory prefix ($index.rolePrefix != ""), search/index-resources.html publishes its index and split body files under the site’s directory (stripping baseURL’s subpath, e.g. spec/zh/offline-search-index.spec.zh.json). assets/js/search.js reads data-td-search-page from .td-search markup rather than baking absLangURL into js/chunks/google-search.js, keeping all root chunks role-invariant.
  • Robots and sitemaps. index: false writes noindex, nofollow in head.html and emits an empty <urlset> in layouts/sitemap.xml. Hugo’s root sitemap index already omits non-default roles.
  • Agent outputs. index.llms.txt filters configured menus through role-menus.html and skips entries with state missing or role, keeping llms.txt, llms-full.txt, Markdown and NAVJSON strictly within their own role.
  • Template caches. Every partialCached call whose output depends on site content or routing—including backlinks-index.html, actions/root-order.html, shell/blog-index-pages.html, theme-color-pair.html, images-authored.html, language-targets.html, compare/targets.html, actions/context.html and shell/history-dialog.html—keys on .Site.Version.Name and .Site.Role.Name.
  • Browsing history. On a role with listed: false and a role prefix, shell/history-dialog.html scopes data-td-history-scope to <basePath>/<role>/ (e.g. /spec/), so internal visits are stored under td-history:/spec/. For an unlisted default role at the root, the hidden and listed audiences use distinct #unlisted and #listed storage keys while validating URLs against the same physical base path.
  • Author files. static/ files and root-targeted global assets publish at the root in Hugo; protected assets belong in page bundles of that role.

Duo View by version

The reader keeps one dialog, one runtime and params.ui.compare as its switch. Its targets become the full transitive equivalence class of published counterparts within the same role:

  • compare/targets.html computes the fixed-point closure of .Rotate "version" and .AllTranslations from the current page within the current role, deduplicating by (Version.Name, Language.Lang). A target must be a same-origin published HTML page of a Docs, Book or blog page (not paginated past page 1, not a draft), in a non-empty site whose language enables compare, other than the current page. Version home fallbacks and params.versions archives never qualify.
  • Each target carries version and latest (Version.Name == R.defaultVersion) beside url, code, direction and label, ordered by Hugo’s version order, then language order.

Opening and in-reader keys:

Trigger Behavior
B, compare_translations Same version, another language: remembered language, else first available
V, compare_versions Another version, same language: remembered version, else R.defaultVersion when reading an older version, else the version after the current one; if that version lacks the current language, its first available language
Entry button B choice (with ui_shortcut_compare and aria-keyshortcuts="B") when a same-version translation exists, else V choice (with ui_shortcut_compare_versions and aria-keyshortcuts="V")
B / V while open Pressing Escape or the active axis’s key closes the reader; when only one axis differs from the left pane and the other axis is available, pressing the other axis’s key retargets the right pane to that axis in place

B is available when the current version has a translation; V when another version has a counterpart. The palette lists each action only when available, and the shortcut sheet dims unavailable rows.

Headings, menus and state:

  • The left heading shows 中文 · v4.2, omitting any dimension that does not vary across [current, ...targets].
  • The right heading renders the language menu before the version menu. A dimension with only one value across the available set renders as plain text, never a single-option dropdown: monolingual versioned manuals show only the version menu, and single-version bilingual sites match today’s UI.
  • Choosing a version preserves the currently selected right-pane language if that version has it, else the left pane’s language, else that version’s first language.
  • Below 900 CSS pixels, variable menus render as compact triggers in the switcher row (fa-language, fa-code-branch), and pane switcher tabs match the pane headings.
  • localStorage['td-compare-reader'] stores language, version and sync independently (still reading legacy target entries), while history.state.oinkCompareSession stores the exact {version, code} pair and scroll bookmarks for reload and Back/Forward restoration.

Keyboard map

Group Today Proposed
Navigation … x language, r section, v version, h history, g home … x language, c role, r section, h history, g home
Actions / and f search, \ and c commands, … / and f search, \ commands, …
View b Duo View, z Zen Mode, … b Duo View (translation), v Duo View (version), z Zen Mode, …

The sheet grows from twenty-nine to thirty rows (ten, nine and eleven). Row version becomes role; row duo-version follows duo. X, C and V sit side by side for language, role and version. Retired bindings (v as version cycling, c as command-mode palette) join the contract’s retired list.

Accessibility, localization and print

  • The role menu reuses the version menu’s disclosure semantics, focus management, Escape handling, forced-colors and RTL rules.
  • Duo View’s version and language menus are independent labelled listbox buttons in reading order language then version; invariant dimensions render as plain text.
  • All 32 locale catalogs add ui_role, ui_shortcut_role, ui_shortcut_compare_versions and ui_compare_version_select.
  • Print, Markdown, LLMS and RSS render no role or comparison controls.

Publishing an internal role

Roles are not access control. Deployments choose one of two patterns:

Publish behind authentication. Build all roles and protect /spec/ in the server or CDN (e.g. nginx location /spec/ or Cloudflare Access). With native publication paths, the outputs for spec—HTML, bundles, aliases, 404.html, empty sitemap.xml, Markdown, LLMS, NAVJSON, Print and local search indexes—lie under /spec/, while localStorage history stays under td-history:/spec/.

An authored URL or alias can override these paths. Check the built tree and pass its Hugo log to bin/check-version-links.py --public DIR --build-log LOG; any [oink-role-path] diagnostic blocks publication.

Omit from the public build. Layer the internal role and its full mount list under config/internal/hugo.yaml so hugo --environment internal builds both roles while the public configuration omits spec. Use a fresh destination for each deployment. For example, build into hugo --environment production --destination "$(mktemp -d)" and hugo --environment internal --destination "$(mktemp -d)". Deploy only the selected tree. Hugo can leave files from a previous build in a reused directory.

Worked example

The companion site’s make spec preview serves one Chinese working copy at /spec/ alongside bilingual Docs for v1.9, v1.7 and v1.6. See the working-language configuration.

The following configuration uses English as its project default and publishes an unlisted Chinese space at /spec/zh/.

defaultContentLanguage: en
defaultContentVersion: v4.2
defaultContentRole: public
languages: {en: {weight: 1}, zh: {weight: 2}}
versions: {v4.2: {weight: 1}, v4.1: {weight: 2}, v3.2: {weight: 3}}
roles: {public: {weight: 1}, spec: {weight: 2}}
module:
  mounts:
    - {source: content/latest, target: content, sites: {matrix: {roles: [public], languages: [en, zh], versions: [v4.2]}}}
    - {source: content/archive, target: content, sites: {matrix: {roles: [public], languages: [en, zh], versions: ['v3.*', v4.1]}}}
    - {source: spec, target: content, sites: {matrix: {roles: [spec], languages: [zh], versions: [v4.2]}}}
cascade:
  - target: {kind: '{page,section,taxonomy,term}', sites: {matrix: {roles: [spec], languages: ['**', '! zh'], versions: [v4.2]}}}
    build: {render: never, list: never}
  - target: {sites: {matrix: {roles: [spec], versions: ['**', '! v4.2']}}}
    build: {render: never, list: never}
params:
  offline_search: true
  ui:
    compare: true
    roles:
      spec: {label: 内部规格, icon: fa-solid fa-lock, listed: false, index: false}

The first cascade rule keeps (spec, v4.2, en)’s home and 404 page while removing empty sections and taxonomies, so /spec/ redirects cleanly to /spec/zh/ and no v4.1 or v3.2 directories are written under /spec/. index: false automatically writes noindex, nofollow and empties spec’s sitemaps. Links from spec to /docs/install/ (whether translated or English-only) resolve without warnings; public pages contain zero /spec/ references.

Compatibility and migration

  • Keys. V opens version Duo View instead of cycling versions; C cycles roles instead of opening the command palette (\ remains).
  • Duo View. Sites with params.ui.compare: true and native versions gain version comparison automatically; single-version sites see no UI change.
  • Existing role sites. Sites defining multiple listed roles gain the Space switcher; prefixed roles publish search indexes under their own directory.
  • Site-owned bundles. Custom shells bundling keyboard-nav.js alone (such as pgsty.com) update their custom help copy if it listed C for commands.
  • Content. No content or front matter migration is needed.

Implementation plan

  1. Stage 1: Site and role model. content/site-index.html, content/role-index.html, content/role-config.html, content/role-home.html; empty-site handling across site-peers.html, version-identity.html, version-banner.html, language-targets.html, version-targets.html, archive-directories.html, seo-alternates.html, shell/search-enabled.html, search/index-resources.html, baseof.html, baseof.landing.html, head.html and layouts/sitemap.xml; full partialCached role/version key audit across nine partials.
  2. Stage 2: Duo View by version. Transitive closure in compare/targets.html; dynamic shortcut metadata in compare/scripts.html and compare/entry.html; compare_versions in actions/context.html, actions/site-commands.html and assets/js/action-registry.js; pure assets/js/compare-targets.js with unit tests; linked version/language menus, independent preferences and axis switching in assets/js/document-compare.js and assets/js/compare-entry.js; styles in assets/css/td/document-compare.css; V binding and duo-version row in assets/js/keyboard-nav.js and shell/keyboard-help.html; 32 locales.
  3. Stage 3: Role switching and space indicator. content/role-targets.html, navbar-role-selector.html, navbar.html (desktop + drawer order fix), shell/sidebar-panel.html, shell/subnav.html, shell/footer-line.html; mobile compass and static single-space indicator in assets/css/td/site-navbar.css; switch_role action; C key and role shortcut row; bin/check-params.py and generated schemas.
  4. Stage 4: Cross-role links and scoped configuration. Default-role ordered sparse fallback, adaptive explicit role resolution and cache-safe leakedRole warning in content/site-destination.html and content/site-link.html; content/role-menus.html across all six .Site.Menus.main consumers plus navbar-entry-link.html active-state guard; filter-before-resolve roles support in actions/site-commands.html, actions/title-menu.html and content/version-targets.html; schema updates.
  5. Stage 5: Output confinement, contracts and guides. Subpath-safe site-dir search publishing in search/index-resources.html; static assets/js/search.js via data-td-search-page; unlisted role history scoping in shell/history-dialog.html; index.llms.txt cross-role exclusion; confinement and chunk-invariance checks in bin/check-runtime-isolation.py and bin/check-version-links.py; bilingual contracts and user guides.

Verification

Checker Coverage
bin/check-version-links.py Asymmetric spaces fixture (public en/zh × 3 versions + spec zh × 1 version, with and without cascade, plus subpath baseURL). Empty-site exclusion, /spec/ → /spec/zh/ redirect with cascade, 5-step role targets, 4-step default-role fallback (including English-only fallback), adaptive /spec/... explicit links and leak warning, scoped menus/commands/links/archives, search files under /spec/zh/, noindex and empty sitemap.xml, llms.txt isolation, history scope, zero /spec/ footprint across public files
bin/check-compare.py Role/version fixtures and a six-language, six-edition chain with ten reachable targets; exact transitive target set, compare_versions, dynamic entry shortcut
bin/check-runtime-isolation.py Static google-search.js, empty-site search-enabled gate, role-invariant chunk bytes
bin/check-keyboard.py, bin/check-shell.py Thirty rows, c, v, b bindings, role → language → version order across navbar, drawers and footer
bin/check-actions.py, bin/check-palette.py switch_role, compare_versions, command allowlist and localized command inheritance in single-language roles
bin/check-params.py, bin/generate-config-schema.py --check params.ui.roles, params.ui.role_menu and roles filters: valid shapes, warnings, fallbacks, negative tests and schema parity
bin/check-search.py, bin/check-backlinks.py Per-role index placement, no empty-site indexes, role-isolated backlinks cache
bin/check-i18n.py, bin/check-goldens.py, tests/js/ 32-locale parity, updated goldens, unit tests for keyboard-nav, action-registry, compare-targets and document-compare
Site suites make -C ../oink.pgsty.com check and browser suites

Acceptance criteria

  1. The English-default example builds with zero warnings. Both with and without the cascade, /spec/ redirects to /spec/zh/, and empty spec sites appear in no menu, hreflang, llms.txt or search index. In the Chinese-default companion preview, /spec/ serves Chinese and old /spec/zh/ bookmarks forward to the matching manuscript.
  2. In spec, the version menu, version banner and V are absent; the language menu, hreflang, X and B offer no target; mobile and desktop headers show the Space compass.
  3. Links from spec (zh) to both translated and English-only public pages resolve with data-td-link="role" and no warning; explicit /spec/... links from English or Chinese public pages resolve to spec’s Chinese pages and emit one leak warning per source and target URL; when spec is unlisted and unlinked, public HTML, llms.txt, sitemap.xml, JS chunks and td-history:/ contain zero /spec/ references.
  4. Every file OINK generates for spec lies under /spec/, with noindex, nofollow on HTML and an empty /spec/zh/sitemap.xml.
  5. hugo with the default environment produces no spec file and no reference to it.
  6. In Duo View, B opens same-version translations, V opens cross-version counterparts, pressing the opposite key inside the reader switches axes in place, a ten-edge chain reaches its final counterpart, and single-axis sites display a single menu.
  7. C cycles listed roles and returns from spec to the matching public page (across language/version if needed) or home; with one role and on the default space, the role shortcut row is dimmed.
  8. Focused theme checkers, JS unit tests, and sibling site checks pass.

Open decisions

None remain open. All original nine decisions (2026-12-03) and the v2 review refinements (2026-12-04) are settled.

Decision log

  • 2026-12-03 (owner): Asked how Hugo roles work for a multilingual, versioned public manual (en default) paired with a Chinese-only, unversioned internal spec protected by prefix auth or omitted from public builds. Chose C to cycle roles (\ opens commands) and V to open Duo View on another version inside one shared reader.
  • 2026-12-03: Initial draft written and nine open decisions settled by owner (“Space” / “空间” label, listed: true default, single params.ui.compare switch, V cross-language fallback, empty-site home redirect, leading role segment with leak warning, default role empty-site compatibility).
  • 2026-12-04 (owner): Reviewed architectural edge cases and approved the v2 unified design for implementation: role-autonomous defaultVersion and defaultLanguage; 5-step role switching and 4-step default-role link fallback plus adaptive explicit-role resolution; kind-scoped cascade preserving /spec/ redirect and automatic layouts/sitemap.xml emptying on index: false; partialCached role/version audit, static google-search.js, llms.txt role isolation, and td-history:/<role>/ scoping for unlisted roles; params.versions defaulting to listed: true roles on single-version projects; transitive closure target discovery, independent axis preferences, and in-reader B ↔ V axis switching in Duo View.

16 - OINK CLI maintenance roadmap

Historical R1–R8 requirements for documentation maintenance and Oink Studio, distinct from acceptance evidence and the current reduced CLI contract.
Implemented requirements record

This dated requirements record preserves the original R1–R8 planning scope and anchors. Current CLI behavior belongs to the CLI contract and CLI introduction, and historical acceptance evidence belongs to the 2026-10-04 supplement. Conditional extensions E1–E4 remain inactive.

The proposed product should complete documentation maintenance before adding a local visual interface. It should help maintainers check changes, understand their effects, review safe modifications, and publish the exact artifact that passed checks. Studio should expose those same capabilities.

Record Value
Status Implemented locally for R1–R8 and A18
Owner OINK maintainers
Date 2026-10-03
Baseline Local CLI 0.1.0-dev, commit e623d93. Hugo Extended 0.166.0 and Go 1.27.1 on macOS arm64
Completion scope R1–R8 and the acceptance cases below. Conditional extensions have separate entry criteria
Affected surfaces CLI command/result contract, Starter projection, consumer CI, translation policy, maintenance operations, local Studio, EN/ZH guides
Schedule assumption One full-time developer with scheduled documentation and review support

Background and evidence

The original CLI roadmap accepted an independent Go executable and narrowed the first implementation to doctor, check, init, single-site upgrade, dev, and build. This proposal adds a maintenance program with a defined scope. Docsy migration, version lifecycle, OpenAPI generation, and theme 1.2 retain their own scopes.

The 2026-10-03 local audit reran the Go suite and actual Hugo integration tests. A bilingual initialized site passed checks over 223 files and 4,461 references. The PIG consumer site passed over 1,392 files and 64,440 references, with 858 source files and its Git state unchanged.

The audit also reproduced four limits. A missing rendered link failed check while build succeeded. Ordinary HTML references outside the configured base path were marked untested. doctor --release accepted a Starter still using https://example.org/. Both embedded deployment workflows called Hugo without the CLI’s additional checks. Translation completeness and readable upgrade diffs were absent. These findings define the first changes.

Product goal and users

Prioritize maintainers of multilingual engineering documentation and small teams maintaining several Hugo sites. Their recurring jobs are reviewing translations, preventing broken publications, updating dependencies, and reorganizing content without losing references or public URLs.

The product succeeds when an ordinary consumer repository can use one quality entry point locally and in CI. Maintainers must be able to inspect affected pages and apply reviewed changes while preserving unrelated work. CLI, Studio, and Agent callers must receive the same findings and change plans.

Feature selection

Capability from the supplied design Decision Delivery
Links, anchors, attachments and machine outputs Strengthen existing checks and explain uncovered cases R1–R3
Environment diagnosis, preview and strict builds Complete release diagnosis and add opt-in verified builds R1, R3
Translation completeness and protected structure Build as a primary product capability R2
Initialization and CI configuration Extend the fixed Starter and manage reviewed CI changes R3–R4
Native content rules and project style Implement a small deterministic core. Optional general tools R2, R6
New content, snippets and editor setup Implement ordinary Hugo inputs with overwrite protection R4
Safe upgrades and migration preflight Add diffs and candidate comparisons. Framework migration remains separate R4
Page moves, renaming and impact analysis Implement after page relationships and change plans are dependable R5
Issue panels and translation comparison Build a read-only local Studio first R7
Multiple sites Add an explicit site registry over the same single-site engine R6
EPUB, PDF and offline packaging Conditional adapter to distributed publication tools E1
Executable documentation examples Conditional, explicit execution profiles E2
Agent inspection, impact and context Implement deterministic local operations R5
AI translation and semantic review Conditional proposals after deterministic maintenance works E4
Sources, evidence and knowledge dependencies Limit this program to build/review provenance and observed page relationships Wider knowledge management deferred
Rich editing, live collaboration and native desktop apps Deliver safe Markdown editing only. Defer the broader platform R8. Remainder deferred

Scope and non-goals

R1–R8 define this PRD’s finite completion scope. Each stage can deliver value and be accepted separately. Suggested CLI versions 0.2, 0.3, and 0.4 identify release candidates. They do not require public tags or theme versions.

The program does not include a renderer, universal migration engine, hosting account manager, deployment API, built-in LLM, vector database, remote editor, real-time collaboration, native desktop shell, or full WYSIWYG editor. Existing provider workflows perform deployment. Publication permissions and credentials remain consumer-owned.

Shared project facts and check policy

This scope is accepted locally. The original requirements below are retained as proposal history. Current behavior and flags belong to the CLI contract.

Extend the existing isolated Hugo analysis. Do not introduce a second configuration parser or navigation authority. Proposed internal facts include page identity, language, publication state, actual output URLs, known source files, translation relationships, and observed rendered references.

Use Hugo’s public Page.Translations and Page.OutputFormats for relationships and outputs. Page.File can provide provenance, but some pages have no backing file. Such findings must retain an output location and unknown source state. Any temporary probe must leave ordinary published outputs unchanged after its removal.

Use oink.yaml only for check selection, severity, translation policy, reviewed exclusions, and tool/workflow options. Hugo continues to own languages, titles, menus, URLs, and site configuration. Module files own theme versions. Initially provide check links, check translations, and check style over one shared analysis. Keep --json. --format json may be an additive alias.

Report blocking errors, warnings, and suggestions through the existing error, warning, and info severities. Unsupported required tools or input shapes remain exit 2. Policy cannot turn failed builds, unreadable inputs, or incomplete required checks into success. Source locations need reliable mapping. Otherwise report the actual output and pointer.

Translation maintenance

This scope is accepted locally. The original requirements below are retained as proposal history. Current behavior and flags belong to the CLI contract.

Support filename languages, language-specific content directories, and translationKey relationships as resolved by Hugo. Coverage policies select required languages for an explicit content scope. Disabled languages and intentional localizations must not become missing-translation errors. Check duplicate identities and configured draft/publication requirements. If a production build omits a source needed to assess policy, use an explicit analysis view. Do not confuse that view with publishable output.

Provide two policies: strict correspondence for manuals, and localized content for blogs or product pages. Strict policy can require explicit IDs, declared placeholders, selected code blocks, and necessary fields to agree. Localized policy checks only declared shared constraints. Heading counts and all code blocks must not become universal requirements.

Propose translations status, translations diff <page>, and an explicit review-record operation. A versioned review record binds the translation to a source content hash or Git revision, plus the translation hash and declared source language. A missing record means unknown. A changed hash means changed since review, not automatically a bad translation. Recording review requires a user-requested write and must never happen just because a checker ran.

Native content rules and baselines

This scope is accepted locally. The original requirements below are retained as proposal history. Current behavior and flags belong to the CLI contract.

Start with a small catalog of high-confidence rules drawn from actual consumer failures: malformed supported component/attribute usage, conflicting explicit IDs, known deprecated forms, and configured protected content. Respect the syntax boundaries of code, inline code, shortcode bodies, raw HTML, and attributes. Do not apply regular expressions without regard to these boundaries.

Use the effective theme version’s contracts. An editor schema that omits types is not a complete strict validator. Missing compatible metadata must produce explicit limited coverage rather than validate against the latest theme. Do not require a future theme release to finish basic checks.

A visible versioned baseline can acknowledge existing findings with stable fingerprints, reasons, and review metadata. Reports show acknowledged and new findings separately. Baseline updates are explicit and reviewable. They cannot hide required incomplete work. Formatting and prose suggestions are optional. Automatic fixes first produce a diff, then validate a candidate before applying a narrow set of files.

Verified publication and CI

This scope is accepted locally. The original requirements below are retained as proposal history. Current behavior and flags belong to the CLI contract.

Preserve the current transparent build default. Add an explicit managed build --check workflow. Run one strict Hugo build. Run selected checks on the same output. Export only that verified artifact to a new or empty destination. Do not delete arbitrary directories or mix stale files into a verified tree. Default build must continue to report when extra checks did not run.

A local versioned manifest records the source revision and dirty state when known. It also records the source-input hash, effective theme identity, Hugo/CLI versions, build settings, base URL, check coverage, and file digests. Secrets and machine paths must not be copied into public metadata. If a public build marker is enabled, it contains only the minimum identity needed for verification. Artifact changes after validation invalidate the recorded result.

Propose ci init github-pages and ci init cloudflare-pages --mode direct-upload. Generate local configuration only, explain variables and permissions, and record template provenance. Detect existing workflows, preview diffs, preserve unknown modifications, and require explicit application. Both use the same quality engine and upload the verified output without another Hugo build. Before a public CLI release, templates must accept a documented immutable source/archival input rather than assume a nonexistent download tag.

Extend release diagnosis with an example-address warning, a release-policy error when publication checks require a real address, effective local source commit/dirty state when available, and comparisons with supported generated CI settings. Unknown custom CI is reported as unknown. A local checkout’s commit does not attest to a published module. Vendor byte identity remains separate.

Propose verify --site URL --manifest FILE with explicit network permission. Check representative pages, languages, resources, search/Markdown outputs, canonical addresses, and artifact identity. A generic fallback with HTTP 200 must fail identity checks. Timeout, authentication, rate limiting, or an absent required identity produce unknown/incomplete results, not invented success. Local HTTP fixtures test this without deploying to a provider.

Authoring and upgrade assistance

Add new, a small snippet catalog, and explicit editor-schema setup. Create page bundles, selected translation drafts, and ordinary front matter while refusing existing files. Translation drafts are not completed translations. Editor hints follow the effective theme and preserve existing editor settings.

Extend init with docs, blog, book, and project profiles by composing one licensed Starter source. Do not maintain four copied template trees. For existing projects, provide diagnosis and reviewed proposals. Do not replace their configuration.

Keep the explicit-tag, single-site upgrade protections. Add readable unified diffs and baseline/candidate route and capability comparisons. Report removed URLs, changed aliases and missing previously enabled outputs. A clean candidate build alone does not prove compatibility. Proposed configuration migrations need a documented transform and tests. Otherwise return a manual action. Conflicting replacements and vendor refresh remain explicit owner operations.

Impact analysis and safe content changes

This supported scope is accepted locally. The original proposal requirements below remain as history. Current behavior, limits and flags belong to the captured-facts contract and move contract.

Provide inspect <page>, impact --since <ref>, and context <task> over the shared facts. Inspect shows provenance, publication state, references, translations, and outputs. Context packages relevant local material with versions, paths, selection reasons, and size limits. No vector service or LLM is required. Document content is data. It cannot authorize command execution.

Initially check --since may still perform a full check and say so. Later optimization must include changed targets, their inbound references, translations, and derived outputs. Deleting B must still inspect unchanged A that links to B. Configuration, templates, navigation, or uncertain dependency changes expand the scope to a full check. Cache data is disposable evidence. It is not an authority.

Propose move <source> <target> as preview by default. A plan contains touched files, readable diffs, base hashes, translations, attachments, route changes, and an alias recommendation. Rewrite only links whose meaning and ownership are known. Ambiguous template/shortcode references require review. Apply verifies bases, validates an isolated candidate, protects concurrent edits, and retains recovery information. A failed or stale plan must not partially overwrite user work.

Workspaces and optional tools

An explicit workspace registry names selected site directories. It reuses the single-site engine, reports per-site results and aggregate completion, and allows writes only to explicitly selected sites. It must not discover and upgrade every sibling repository automatically or duplicate Hugo settings.

Optional markdownlint, Vale, and lychee adapters use explicitly configured, already provisioned tools and normalize their findings. Required missing tools return 2. Optional omissions remain visible. If the adapter cannot understand syntax, exclude it. Do not rewrite it. Ambiguous external-link failures require a network-status distinction. Tool installation and network access are separate actions, and generic formatters never overwrite content by default.

R6 accepted local boundary

The explicit registry and optional adapters are accepted locally in supported R6 scope. Stable fields and limits are documented in the registry contract and tool contract. The accepted R7/R8 boundaries below retain their own evidence and limits.

oink.workspace/v1 names 1–64 literal directories in one regular YAML file bounded to 256 KiB, without duplicating Hugo settings or discovering siblings. Exact names, canonical root identity, registry-order selection, per-site 0/1/2 parity and explicit-name saved-plan application are the supported workspace boundary. Already provisioned markdownlint-cli 0.49.1, Vale 3.24.0 and lychee 0.24.2 extend each site’s policy, with captured configuration and typed protocol/source/network coverage. They do not install or format tools/content. Lychee needs explicit network consent. Ambiguous external failures remain unknown rather than definite broken links.

Frozen Go/vet, actual Hugo/pinned-tool, and owning race gates have passed. The exact binary also passed four-site direct/aggregate diagnostic/coverage/exit parity and all source byte, full-mode, Git, ignored-input, and directory guards. Initial preparation failures remain excluded, and the receipt-driver-only command metadata correction is recorded without a CLI runtime correction or rerun. Guarded canonical EN/ZH source/rendered checks passed, and supported R6/A07/A15 scope is accepted locally in the R6 record. Current A18 runtime/archive qualification passed. Darwin amd64 remains experimental/unverified.

Read-only Oink Studio

Build a local web interface with project overview, issue panel, translation comparison, page relationships, and publication panel. These views use the same core results as CLI/CI. Support filters, known-source navigation, actual Hugo preview, change comparisons, and copying proposed actions. A large graph or embedded editor is not needed for this acceptance.

Default to loopback and an explicit site allowlist. Separate untrusted rendered content from the management origin. Handle Host/Origin checks and session authorization before adding write APIs. Ship prebuilt UI assets with the CLI. Node is a contributor build dependency, not a consumer runtime requirement. Cover keyboard operation, screen-reader labels, mobile layouts, light/dark themes, and readable long diagnostic lists.

R7 candidate boundary

The read-only Studio candidate now serves an embedded five-view browser and an authenticated literal-loopback API over the same native checks and captured Hugo facts. Stable candidate boundaries are in the contract. Explicit existing-site/registry selection, typed paginated findings, source/diff/hash states, actual production preview and separate optional analysis coverage preserve the CLI authority.

Frozen native/browser/core-case and exact-binary four-consumer receipts now qualify the supported read-only scope, including explicit partial-preview incompletion. They exercise native 0/1/2 parity, keyboard/mobile/light/dark flows, literal source data and separate-origin preview attacks. R7/A16 passed guarded canonical promotion/rendered gates and is accepted locally. R1–R8 supported scope and current A18 runtime/archive qualification passed.

Safe Markdown editing

After the read-only interface is accepted, add Markdown editing, front matter forms, selected component insertion, and attachments. Reuse the CLI change-plan engine and actual Hugo preview. There is no second save/validation mechanism.

An unchanged open/save cycle must preserve bytes. Updating one field preserves unknown fields, comments, order, encoding, and unrelated whitespace. Detect external-editor changes and refuse stale saves. If a front matter form cannot preserve a construct, keep it editable as text and explain the form limitation. Do not round-trip the whole document through a generic serializer.

Writes need an authorized local session, an allowed directory, base verification, and a visible diff. Reject path traversal, symlink escapes, and requests from untrusted preview content. Attachments must not overwrite existing files. Publishing a static site never adds these management APIs to it.

R8 accepted editing boundary

R8 now has one source-preserving proposal engine for CLI edit text, field, snippet and attachment, and the explicit studio --edit flow. Default Studio remains read-only. Known site-owned Markdown, exact source hashes, supported top-level YAML scalars with text fallback, original catalog byte-boundary insertion and new-only leaf-bundle attachments share the same saved plans and guarded writer. The complete visible review binds plan, file, and full-mode identities. Candidate HTML comes from actual selected nonpublishable Hugo analysis, with native findings and required view incompletion kept distinct.

The accepted local interface is documented in the contract. Corrected frozen public/Go/race/vet, actual/ordinary Hugo, Editor browser accessibility/mobile and exact-binary four-consumer preservation gates passed. R8/A17 supported local scope also passed guarded canonical source/render gates and is accepted in the R8 record. R1–R8 supported scope and current A18 runtime/archive qualification passed. Darwin amd64 stays experimental/unverified.

Delivery sequence and schedule

The following estimate assumes one developer. T0 is the implementation start after scope approval. Dependencies are sequential acceptance gates, which additional staff can support through independent tests and UI work.

Stage Effective weeks Delivery Acceptance gate
R1 1–2 Shared facts, check policy, focused scopes, trustworthy locations Hugo owns routes/relationships. Required incomplete checks cannot pass
R2 3–5 Translation policy/review state, native checks, visible baseline Three language layouts. Strict/localized cases. Reviewed fixes preserve files
R3 6–8 Verified build artifacts, CI init, release diagnosis, deployed-site verification One checked artifact is uploaded. Stale bytes and HTTP 200 fallback are detected
R4 9–11 New content, profiles, snippets/editor setup, upgrade diffs/comparisons Ordinary Hugo build. Dirty/replaced/vendor and route-regression cases remain safe
R5 12–15 Inspect, impact, context, move and shared change plans Unchanged inbound links and translations are included. Stale plans cannot write
R6 16–17 Explicit workspaces and optional check adapters Per-site parity. Required unavailable tools are incomplete. No implicit installs
R7 18–20 Read-only Studio and its security boundary Five useful views. CLI/UI findings agree. Accessibility and preview isolation pass
R8 21–24 Safe Markdown/forms/attachments with conflict review No-op save has zero diff. Comments/unknown fields survive. Concurrent saves fail safely

Allow another 4–6 weeks for integration, false-positive review, cross-platform execution, and repairs, distributed across the gates. The total planning range is 28–30 effective weeks (or roughly twice that elapsed calendar time at half-time availability).

R1–R3 yield a proposed 0.2 quality/publication candidate around weeks 9–10 including early reserve. R4–R6 yield a proposed 0.3 maintenance candidate around weeks 19–20 cumulatively. R7–R8 yield a proposed 0.4 local Studio candidate around weeks 28–30 cumulatively.

Conditional extensions

Extension Entry criterion Proposed boundary Separate estimate
E1 Publication exports At least two maintained books need a recurring export workflow Reuse distributable EPUB/PDF tools and package local artifacts. Declare external dependencies 1–2 weeks after R3/R4
E2 Executable examples Explicit owners identify runnable examples and disposable test environments Reviewed execution profiles, time/resource limits, offline default. Never execute discovered prose automatically 3–5 weeks after R5
E3 MCP An existing Agent integration needs capabilities beyond invoking JSON CLI results Thin adapter over inspect/check/impact/context/plans. Same permissions and diagnostics 1–2 weeks after R5
E4 AI review and translation Deterministic translation maintenance works and a reviewed evaluation corpus exists User-selected provider, explicit network/cost settings, proposals bound to source hashes. No automatic source writes 3–6 weeks for a limited experiment after R5

The R1–R8 total excludes these estimates. Activate an extension only for its stated use case. A future need is not an unfinished core milestone. Remote Studio, live collaboration, native shells, general knowledge provenance, vector retrieval, and universal framework migration require separate PRDs and evidence.

Architecture and compatibility

Use Go for core operations. Use subprocesses for Hugo and optional tools. Extend existing packages when they own the behavior. Add a package only with its capability. Do not create a generic plugin platform, public SDK, or shared service layer before an actual consumer needs it.

Preserve oink.result/v1, exit meanings, and the default thin wrappers. New diagnostic details and command data may be additive. Changed field semantics need a new result version. Version review records, baselines, plans, build manifests, and workspace registries independently. Detect supported capabilities from the actual theme. Do not require all users to install the latest release.

Read/check/preview, local file application, networking, example execution, and deployment have separate side effects. No telemetry, background updater, credential discovery, arbitrary directory cleanup, global configuration change, commit, push, or deployment happens as a maintenance side effect. Read-only consumer trials preserve sources, replacements, workspaces, and vendor bytes.

Acceptance cases and owning checks

Case Required outcome Primary owner
A01 JSON and completion One JSON result on stdout. Clean stderr separation. Findings 1, required incompletion 2 internal/report, internal/app, Schema
A02 Hugo truth Slug/url/permalinks/aliases, custom mounts, unlisted pages and language roots follow actual Hugo results internal/site, internal/outputcheck, actual Hugo fixtures
A03 Subpaths A definite project-local missing route fails. Outside-origin/path references remain classified honestly. Declared external scopes avoid false positives Output checker and policy tests
A04 Translations Filename, directory and translationKey layouts. Duplicate/missing/draft cases. Strict/localized policy Translation engine and public-command tests
A05 Review state No record is unknown. Changed source hash is visible. Mtime never determines review state Translation/review-record tests
A06 Content syntax Fences, inline code, shortcodes, HTML, attributes, custom fields and configured protected text do not generate invented findings Native-rule tests and real content corpus
A07 Baselines and adapters Acknowledged findings remain visible. New findings fail policy. Unavailable required tools cannot pass Policy/adapter tests
A08 Artifact identity Modify a file after check and manifest verification fails. Provider upload uses the same exported tree without rebuilding Managed-build and workflow tests
A09 CI preservation Both templates, existing customized workflows, permissions/variables, preview/apply conflict and provenance Starter/CI tests and local workflow rehearsal
A10 Public verification HTTP 200 fallback, wrong language/build, missing resource, canonical mismatch, timeout/auth/rate limit Local HTTP fixtures, no required cloud account
A11 Initialization and authoring Supported profiles/languages. Empty-target protection. Generated sites build with ordinary Hugo. Editor config preserves unknown settings internal/starter, authoring and Hugo tests
A12 Upgrade Readable diff, old/new routes, dirty files, both workspaces, replacement/vendor, failure recovery and concurrent edits internal/upgrade, public-command/Hugo tests
A13 Impact Deleted B finds unchanged A. Translations/attachments/derived outputs included. Global changes expand scope Impact and Git-baseline fixtures
A14 Change application Candidate validation before apply. Hash conflicts and failed writes preserve subsequent edits. Ambiguous references are not rewritten Shared plan/apply and move tests
A15 Workspace and context Per-site results match direct invocation. Selected writes only. Bounded context gives paths/versions/reasons without executing content Workspace/context tests
A16 Studio parity Five views show the same results as CLI. Usable keyboard/mobile/light/dark flows and source/preview separation Studio browser/accessibility tests
A17 Editor preservation No-op save is byte-identical. YAML comments/unknown values/order survive. Stale saves and attachment collisions are rejected Editor/browser and shared apply tests
A18 Runtime and recovery Test actual declared macOS/Linux targets. Signals stop child processes. Cached operations work offline. Unsupported inputs remain explicit Process/integration/installation tests

Run the smallest owning tests before broader integration. Keep Go unit fixtures offline. Repeat actual Hugo tests after parser, snapshot, probe, initialization, or upgrade changes. Keep focused checks. Do not require consumers to run theme internals or a browser suite for every document change.

For each candidate, record tool versions and source identities. Then test the Starter and three distinct maintained sites without writes. Compare source bytes, modes, and Git state before and after. Tests for new native rules need a reviewed valid/invalid corpus. Fix false positives before enabling a blocking default. Before promising incremental speed, measure full-build time against the same current-site baseline. Functional correctness takes priority over check counts.

Completion and release evidence

For each stage, record implemented behavior, known limits, focused tests, and actual integration results. Provide updated EN/ZH contracts/guides and a reviewable diff. Track individual requirement/case statuses. This PRD is complete only when R1–R8 and their required acceptance cases are satisfied.

After supported behavior is accepted, move it into the owning CLI contract, usage guides, and durable decisions. Retire the corresponding proposal sections through the existing lifecycle.

Decisions and stop conditions

Confirm staffing and start date before turning relative weeks into calendar dates. Decide supported runtime targets, review-record storage details, initial native-rule catalog, and precise additive command flags in R1. These are bounded implementation choices within this scope, not reasons to reopen the product boundary or wait for an entire theme release.

If preservation or correctness work exceeds a stage estimate, move its optional convenience work later. Never remove stale-write protection, truthful completion, or ordinary-Hugo compatibility. If repeated corpus review shows that a rule is unreliable, keep it advisory or remove it. If a form cannot preserve source bytes, keep that syntax in text mode. Interest in implementing a conditional extension does not add it to the critical path.

Decision log

Date Record
2026-10-03 Created from the current CLI audit and the supplied feature goals. Proposed R1–R8, optional extension gates, resource assumptions and executable acceptance cases.
2026-10-03 R1 shared Hugo facts and check policy passed local owning/actual-Hugo checks. Stable behavior moved into the CLI contract. The acceptance record tracks final refreshed reports and rendered EN/ZH evidence separately. R2–R8 and conditional extensions remain open.
2026-10-03 R2 translation scopes/hash reviews, syntax-bounded native rules and visible baselines now use shared guarded file plans. Local owning, actual-Hugo and focused race gates passed. Final refreshed consumer and EN/ZH documentation acceptance remains pending in the record. Implemented behavior is in the contract. R3–R8 remain open.
2026-10-03 R2 final corpus and bilingual documentation gates passed. R3 one-render checked export, exact file identity, guarded CI plans for both providers, release diagnosis and explicit-network HTTP verification passed their scoped local gates, including custom-workflow discovery. Stable behavior moved to the contract. Exact evidence and A08–A10 outcomes belong to the maintenance record. R4–R8, final A18 runtime/archive refresh and Darwin amd64 remain open.
2026-10-03 R4 supported local scope passed frozen Go/vet, actual Hugo/race and exact-binary read-only Starter/docs/PIG/repository gates. One unchanged licensed Starter composes all profiles/languages. Ordinary new/editor/snippet flows and source/external-input guards passed, as did readable bounded upgrade views and alias/output regression protection. Stable behavior belongs to the contract. Exact A11/A12 evidence and remaining limits belong to the record. R5–R8, final A18 runtime/archive refresh and Darwin amd64 stay open.
2026-10-03 R5 corrected frozen Go/vet, actual Hugo/race and exact-binary four-consumer read-only gates completed. Inspect/context complete for all sites. Historical impact and move blockers remain explicit. Guarded canonical source/rendered gates and stage acceptance are pending. Stable behavior belongs to the contract. The record identifies A13/A14/context evidence, the cached-module correction and exact preservation receipt. R6–R8, workspace A15 and final A18 remain open.
2026-10-03 R5 supported inspection/impact/bounded-context and guarded move scope is accepted locally after corrected frozen owning gates, exact-binary four-consumer preservation and first-promotion canonical source/rendered gates. The production translation owner retains only its known draft-release omission. Separate nonpublishable analysis passes all owners. Stable behavior belongs to the contract and command reference. The record retains exact outcomes and the separate post-render evidence boundary. A13/A14 supported CLI scope passed. A15 context passed while workspace/direct parity remains R6. R6–R8 and final A18 remain open.
2026-10-03 R6 explicit registry and bounded optional-tool candidate implemented. Focused workspace and corrected actual-protocol trials passed, with preparation failures kept separate. Final runtime/corpus/canonical gates and A07/A15 stage acceptance remain pending in the R6 record. R7/R8 and final A18 remain open.
2026-10-03 R6 frozen Go/vet, actual Hugo/pinned tools, owning race and exact-binary four-consumer direct/aggregate parity/preservation qualified. The completed receipt records six original operations, existing repository duplicate-ID findings and a driver-only command-summary correction over unchanged raw outputs. No CLI/Hugo rerun or runtime fix was needed. Canonical source/render checks and explicit R6/A07/A15 stage acceptance remain pending in the record. R7/R8/final A18 remain open.
2026-10-03 R6 supported explicit-registry and optional-tool scope is accepted locally after frozen Go/vet, actual Hugo/pinned tools, race, exact-binary four-consumer parity/preservation and guarded canonical source/render gates. A07 adapters and A15 workspace/direct/context supported scope passed. The R6 record separates first-promotion rendered bytes from this post-render status/evidence amendment. R7/R8 and final A18 remain open.
2026-10-03 R7 read-only embedded Studio candidate and authenticated loopback views implemented. Frozen core/browser and exact-binary four-consumer qualification completed within the declared scope. Guarded canonical promotion/render and explicit R7/A16 acceptance remain pending. R1–R6 remain accepted. R8/final A18 open.
2026-10-03 R7/A16 supported read-only Studio is accepted locally after frozen cumulative executed-case/browser proof, exact-binary four-consumer parity/preservation and guarded canonical source/render gates. First-promotion rendered bytes remain distinct from this post-render status amendment. Whole invocation failure and explicit partial-preview incompletion stay visible. R1–R7 accepted. R8/final A18 open.
2026-10-03 R8 CLI/opt-in Editor source-editing candidate implemented. Default Studio remains read-only. Pure-core/streaming-output focused evidence is recorded and failed browser trials retained. Final frozen public/browser/consumer/canonical gates and A17 stage acceptance remain pending in the R8 record. R1–R7 remain accepted. R8/final A18 open.
2026-10-03 R8/A17 reviewed CLI/opt-in Editor supported local scope is accepted after corrected frozen whole owning/browser gates, exact-binary four-consumer proposal parity/source preservation and guarded first canonical promotion/actual rendering. R1–R8 are accepted locally. The R8 record separately binds first-rendered and current status bytes, retaining every failed trial, native finding and required partial-preview incompletion. Final A18 current Linux/archive qualification remains open.
2026-10-04 Current backend integrity correction, refreshed owning/Hugo/race, carried unchanged-runtime four-consumer preservation and three declared runtime/archive qualifications passed. See the dated completion supplement. Finite R1–R8 implementation is complete locally. Retain this requirements record and anchors, retire it from active navigation, and keep stable behavior in the contract/guide. E1–E4 have not been invoked.

17 - Visual presets and appearance switching

Paper and Slate ship in 1.2.0; Ink and Terminal are explicitly enabled experiments awaiting design acceptance.
Phase 1 released in 1.2.0; refined in 1.7.0; Ink/Terminal opt-ins available

Paper, Slate and the Appearance menu ship with OINK 1.2.0; OINK 1.7.0 further refined all four presets, added per-preset CJK system typography, and finalized the t/y shortcuts. The architecture contract, accepted decision and acceptance record own current behavior and evidence. A subsequent Ink/Terminal experiment provides actual selectable output; this proposal remains active for their design acceptance. The October 4 injected screenshots are research prototypes; they are distinct from the October 5 screenshots of actual theme output.

Status and surface

Field Value
Status Phase 1 released in 1.2.0; Ink/Terminal explicit opt-ins
Owner OINK maintainers
Date 2026-10-04
Baseline OINK v1.4.0 theme and documentation site; this row preserves the proposal’s October 4 research starting point
Affected contracts Architecture: Trust, CSS, and accessibility (font roles, accent roles, inline-code colour), Shell (theme control), Landing, Configuration decision, Brand guide
Phase 1 Paper preset, Slate preset, default changed to Paper, reader switching between Paper and Slate
Later phases Ink/Terminal design acceptance; Folio and Canvas names reserved only

Context and evidence

The baseline and limitations below record the October 4 research input, before phase 1.

OINK ships one visual identity, referred to here as Slate: a cool blue-grey canvas (#f1f4f8 / #0b1119), navy text, steel-blue links (#245f94), copper accents, Inter for interface and prose, Chakra Petch for display and wordmark, IBM Plex Mono for code and technical labels, a blueprint grid and glow on the Landing hero, and a crimson inline-code pair. It is defined by Bootstrap custom properties in assets/css/td/brand.css, shell tokens in assets/css/td/shell/tokens.css, and font roles in assets/css/td/tokens-typography.css. In releases up to 1.5.1 these are the SCSS partials _brand.scss, shell/_tokens.scss and _tokens-typography.scss under assets/scss/td/.

PG.CENTER, an independent site, has a warm editorial reading style that maintainers want as the future OINK default. Its presentation tokens live in media/css/pgsql.css of that project. Measured on its local preview (2026-10-04, light and dark, home, Docs index, long manual page, component manual):

Role Light Dark Note
Canvas #f7f6f3 #161513 warm white / warm black
Raised surface #ffffff #1d1c19 cards, code blocks
Secondary surface #efede8 #262420 table header, hover
Ink #21201c #ece9e3 body text
Secondary text #56534c #b6b1a7
Lines and washes ink at 4.5–22 % alpha light ink at similar alpha no tinted greys
Radius 12 px / 8 px same
Shadow 0 2px 10px rgba(33,32,28,.07) black-based warm, soft
Motion 160 ms cubic-bezier(.2,.7,.2,1) same

Typography is IBM Plex Sans (variable, 400–600) for interface and prose, IBM Plex Mono for code, dates and versions, and Chakra Petch for the wordmark only. The component-manual pages are the best long-form model: lead paragraph 17 px capped at 70ch, h2 followed by a hairline that runs to the edge, framed tables with a header band and no zebra, monochrome callouts with a 3 px rule.

The following PG.CENTER elements are site identity, not reusable reading rules: the PostgreSQL brand blue #336791 family, wine content links, version-state colours, release strips, search-kind badges, wiki tones, the duotone hero, and the 144-character measure of the imported PostgreSQL manual. Two values fail WCAG AA (muted text 3.67:1, link hover 4.22:1) and are corrected below rather than copied.

Measured OINK docs typography for comparison: 16 px / 1.7 body, ≈ 76ch measure, h1 36 px / 700, h2 24 px / 600, code 14 px. PG.CENTER Docs index: 15.5 px / 1.7, ≈ 120ch.

Current limitations

  • Colours are tied to data-bs-theme only. No attribute selects a second palette, and several surfaces bypass tokens: the Landing primary button (#2f6793 with navy glows), the grid, scrims (rgba(4,10,18,.45)), print colours, asciinema surfaces, and the giscus stylesheets.
  • About 85 literal border radii and several literal shadows make a flat preset impossible without a radius and shadow scale.
  • The light/dark control expands on hover or focus. Touch readers cannot reach “follow system”; the trigger mixes aria-pressed and aria-expanded; Esc does not close it. The Landing mobile drawer has no theme control.
  • contrast-on-canvas.html hard-codes Slate canvas luminance for the theme_color warning.
  • dark_mode is opt-in (false by default), so the palette and its menu are absent unless a site enables them.

Goals and non-goals

Goals:

  • one site key selects the default visual preset; Paper becomes the default;
  • Slate remains available and reproduces current output for sites that choose it;
  • readers can switch Paper and Slate instantly, without reload, independent of light/dark/system mode;
  • the configured default renders without JavaScript and with storage unavailable;
  • presets share templates, components, and layout geometry; they change paint and type;
  • local fonts only, ordinary Hugo build, no new runtime framework or required build tool.

Non-goals:

  • implementing Ink, Terminal, Folio, or Canvas in phase 1;
  • copying PG.CENTER brand colours, version UI, or page structures;
  • per-page or per-section presets (section colour remains theme_color);
  • changing layout geometry, density, or navigation structure per preset in phase 1;
  • theming Swagger UI, ReDoc, or third-party embeds beyond their existing light/dark handling.

Preset model

This table and the phase-one configuration below retain the original scope. The later experiment adds explicit ink/terminal configuration and menu-list entries; true still offers the stable set plus the site default. The architecture contract owns current behavior.

Preset Direction Phase 1 Reader menu
paper Warm editorial minimalism Implemented, default Yes
slate Technical minimalism (current OINK) Implemented Yes
ink Typographic minimalism, Swiss-inspired Spec + research prototype No
terminal Terminal-inspired utilitarian Spec + research prototype No
folio Academic / book publishing Name reserved No
canvas Playful geometric / creator Name reserved No

Reserved names are rejected by validation until implemented, with a warning that names the stable presets.

Configuration

params:
  ui:
    preset: paper        # paper | slate        (theme default: paper)
    preset_menu: false   # false | true | [paper, slate]
  • preset selects the site default. Invalid or reserved values warn through the existing validation path and fall back to paper. Publishing gates turn the warning into a failure.
  • preset_menu controls the reader choice. false renders no style group and emits no preset-init script; true offers every stable preset; a list offers a subset that must contain preset. Following the dark_mode precedent, the default is false; the documentation site enables it; starter adoption is outside this change.
  • preset is site-level only. Page and section overrides are not supported: switching identity per page would break reader expectation and the stored choice.
  • The Appearance menu exists when either dark_mode.show_menu or a style choice is enabled. A site with dark_mode: false and preset_menu: true shows only the Style group.

Relationship to existing keys

Precedence, lowest to highest:

  1. Slate base tokens on :root / [data-bs-theme] (unchanged selectors).
  2. Preset tokens on [data-td-preset=X].
  3. params.ui.typography: system — collapses font roles to system faces after the preset blocks, so it still requests no brand font in any preset.
  4. params.ui.fonts — emitted inline after the stylesheet at :root; equal specificity and later source order beat preset font roles. Explicit fonts always win.
  5. theme_color / theme_color_dark — page and section accent backgrounds only. They override the preset accent; they never touch links or inline code.
  6. The site’s project stylesheet, assets/css/project.css — loaded after the theme’s stylesheet. In releases up to 1.5.1 it is _styles_project.scss, last in the compiled bundle.

typography: technical remains the name for “use the preset’s bundled faces”. The preset decides which bundled faces those are (Paper: Plex Sans; Slate: Inter + Chakra Petch).

Reader state

Two independent dimensions:

Dimension Attribute Storage Values
Style data-td-preset on <html> localStorage['td-preset'] stable preset names
Mode data-bs-theme (+ .dark-mode, vendor data-theme mirror) localStorage['td-color-theme'] light, dark, auto
Situation Result
First visit Server renders data-td-preset="<site preset>" and data-td-site-preset; no script needed
Reader chooses a preset Applied at once, stored, td-preset-change dispatched
Reader chooses the preset marked “Default” Storage key removed; future site default changes reach this reader
Next page, refresh, other language Inline head script applies the stored value before first paint
Stored value no longer offered Removed; site default used
Storage unavailable Choice applies to the current page; the menu states that it will not persist
JavaScript disabled Site default preset renders in its light palette, as the current theme does without script; no style or mode control is usable
Style change Never writes td-color-theme; mode change never writes td-preset
Other tab changes the value storage event applies it

The inline script runs before the stylesheet, beside the existing dark-mode script. It validates the stored value against the allowed list embedded at build time, sets the attribute, and updates the theme-color meta and the pre-paint canvas colour for the preset and mode. It is emitted only when the menu offers more than one preset. Independently of the menu, the static pre-paint <style> and the resolved theme-color meta in head.html are rendered from the site default preset’s canvases instead of the current hard-coded #0b0d12, #ffffff, and #000000.

On switch the runtime sets data-td-preset-switching for one frame to suppress colour transitions, records the first visible heading or block as a scroll anchor, applies the attribute, and restores the anchor offset, again after document.fonts.ready because Plex Sans and Inter have different metrics. Focus, open menus, and form state stay untouched. Phase 1 uses no cross-fade or View Transition.

Appearance menu

Three options were compared:

Option Assessment
Keep the hover menu, add a style row Keeps the touch and keyboard gaps; hover-only discovery
Separate style and mode buttons Two icons in a crowded navbar; mobile drawer gets longer
One Appearance disclosure with two radio groups Chosen: one entry point, works with touch and keyboard, scales to more presets

Behaviour:

  • Trigger: one icon button (aria-expanded, aria-controls, label “Appearance”). It replaces the current theme button in the navbar and in the shell footer line. Sun means the current light state; moon means dark. The t shortcut keeps toggling light/dark.
  • Panel: a non-modal popover containing two native fieldset radio groups. The October 5 revision uses Style: icon-and-name buttons in two columns, with a preset-colored icon and no preview letters or experiment badges. The site default is identified by its tooltip and accessible name. Light: a segmented Light / Dark / System control. Selection applies immediately and the panel stays open so readers can compare.
  • Keyboard: Enter/Space or ArrowDown opens and focuses the checked radio; arrow keys move within a group (native radio behaviour); Tab moves between groups; Esc closes and returns focus to the trigger; focus leaving the panel or an outside click closes it.
  • Feedback: the selected option has a tinted background and accent border; keyboard focus has a separate outline. Changes are announced through native radio semantics; no extra live region.
  • Restore default: selecting the site’s default preset clears the stored choice. No separate reset button is needed.
  • Mobile (< 768 px): the trigger stays in the compact header and is also offered in the docs drawer footer and in a new row of the Landing mobile drawer. The panel opens as a bottom sheet with 44 px targets, the same two groups, and a close button. The sheet is a modal <dialog> opened with showModal(), so it lives in the top layer: the prototype showed that the sticky header’s backdrop-filter otherwise becomes the containing block of a position: fixed sheet and the drawer’s stacking context hides it.
  • Command palette: a switch_preset action next to switch_theme.

dark-mode.js keeps its storage key and attributes. It must sync the checked state of the Light radios and listen to their change events instead of the current aria-pressed buttons.

Token architecture

All presets are part of the single existing main.css. Fonts are declared with @font-face and are downloaded only when a rule uses them, so offering a preset costs CSS bytes but no font bytes until it is selected.

// Slate: existing selectors and values, unchanged
:root, [data-bs-theme='light'] { … }
[data-bs-theme='dark'] { … }

// Every other preset
[data-td-preset='paper'] { /* light tokens + font roles */ }            // (0,1,0)
[data-td-preset='paper'][data-bs-theme='dark'],
[data-td-preset='paper'] [data-bs-theme='dark'] { /* dark tokens */ }   // (0,2,0)

// Then: [data-td-typography='system'] font block (moved after presets)

Rules:

  1. Token parity. Each dark block redeclares every token of its light block, so Slate dark never leaks into another preset. A checker enforces it.
  2. Dark islands. The descendant form covers nested data-bs-theme="dark" islands (Landing code plate, previews).
  3. Font roles only at (0,1,0), so params.ui.fonts keeps winning.
  4. Accent indirection. Presets set --td-preset-accent (and -rgb, -hover); --td-accent defaults to it. theme_color keeps writing --td-accent and therefore overrides the preset in both modes.
  5. Slate stays attribute-free. data-td-preset="slate" matches no override block, so current site overrides of brand tokens behave exactly as today.
  6. Geometry is shared. Presets do not change grid columns, sidebar width, or breakpoints in phase 1.
  7. Preset-specific rules are few and scoped to [data-td-preset=X] in one partial per preset. Anything two presets need becomes a token.

New shared tokens required before Paper (phase 1): --td-shell-scrim, Landing --td-grid / --td-glow / primary-button tokens, --td-callout-tint, --td-code-inline-bg, --td-hairline, and a brand font role (--td-brand-font-family, default var(--td-display-font-family)) so the wordmark can keep Chakra Petch while Paper’s display headings use Plex Sans.

The original phase-two plan proposed global radius, shadow and density scales. The October 5 experiment instead scopes those changes to owned components; a wider token refactor is not a prerequisite for trying the designs.

Contract change: the architecture contract currently fixes inline code to a crimson pair. This proposal makes --bs-code-color a preset token (Slate keeps crimson, Paper uses an ink chip). theme_color still never touches it.

Fonts

Preset UI / body / heading Display Brand (wordmark) Meta Code New bytes
Paper IBM Plex Sans IBM Plex Sans Chakra Petch IBM Plex Sans IBM Plex Mono Plex Sans
Slate Inter Chakra Petch Chakra Petch IBM Plex Mono IBM Plex Mono none
Ink Inter Inter Inter Inter (tabular) IBM Plex Mono none
Terminal Plex Mono chrome, Plex Sans prose IBM Plex Mono IBM Plex Mono IBM Plex Mono IBM Plex Mono none after Paper

Paper vendors @fontsource-variable/ibm-plex-sans (OFL-1.1) into third_party/ with a VENDOR.json entry: Latin, Latin Extended, Cyrillic, Cyrillic Extended, Greek and Vietnamese subsets, normal and italic, weights 100–700. PG.CENTER’s normal-only 400–600 subset is 40,240 B (latin) + 25,868 B (latin-ext); exact sizes are recorded at vendor time. Italic is required because OINK prose uses emphasis and PG.CENTER’s synthesized italic is not acceptable. The full small subsets preserve the existing locale coverage; the browser loads only the ranges actually used. All 12 font files are recorded in VENDOR.json.

Chinese, Japanese and Korean use system stacks placed after the Latin face: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', sans-serif. IBM Plex Sans SC was rejected because its files are megabyte-scale. Monospace stacks insert CJK sans families before the generic monospace keyword so mixed code keeps a predictable CJK face.

typography: system continues to request no brand font: the system block follows every preset block and resets all roles, including brand.

Serif. Phase 1 uses no serif. Latin serif headings beside CJK sans headings look inconsistent, Windows’ default CJK serif renders poorly at heading sizes, and a serif costs another font. A later opt-in display-only serif can be reviewed with the side-by-side mockup produced for this proposal.

Preset specifications

Shared foundation

Belongs to every preset, not to Slate:

  • layout geometry, breakpoints, sidebar/TOC widths, ≈ 76ch prose measure;
  • body 1rem / 1.7 for prose, 0.875rem for chrome, 0.8125rem for meta;
  • type scale ratios (h1 2.25rem, h2 1.5rem, h3 1.25rem, h4 1rem) — presets tune weight and tracking, not size, in phase 1;
  • focus ring: 2 px accent outline with 2 px offset, never removed; forced-colors fallbacks unchanged;
  • semantic status colours (note, tip, important, warning, caution) keep their hue; presets change tint strength and frame;
  • syntax highlighting keeps the existing light/dark Chroma palettes in phase 1;
  • motion tokens 100/150/250 ms; prefers-reduced-motion disables transitions;
  • WCAG AA: 4.5:1 body, 3:1 large text and UI boundaries, in both modes.

Paper

Warm editorial minimalism. Warm paper, ink text, quiet hairlines, soft shadows, and generous but not loose reading rhythm. It serves long-form reading: lower blue light on large canvases, less chrome contrast, and a typeface (Plex Sans) with open counters that reads well at 16 px.

Token Light Dark
Canvas --bs-body-bg #f7f6f3 #161513
Raised --td-brand-elev, --td-pre-bg #ffffff #1f1e1a / #121110
Secondary surface #efede8 #1f1e1a
Body #21201c (15.09:1) #ece9e3
Secondary text #56534c (7.10:1) #b6b1a7
Tertiary text #6b665d (5.27:1) #958f84 (5.68:1)
Border ink 12 % light ink 13 %
Link / hover #2b5f8c (6.23:1) / #1d68a5 (5.43:1) #7db5e6 (8.36:1) / #a3cdf3
Accent (copper) #9c5530 (5.17:1) #d99a6c
Inline code ink on ink-6 % chip light ink on 8 % chip
Shadow sm / md 0 2px 10px / 0 14px 38px ink 7 % / 13 % black 35 % / 50 %
Radius code 12 px, cards 12 px, controls 8 px same

Rules specific to Paper: headings Plex Sans 600 with −0.006em (h1 −0.012em); h2 followed by an edge hairline; framed tables (radius 10, header band, no zebra); callouts with a 4 % (dark 6 %) semantic wash and a single 3 px rule; hairline blockquote; Landing without grid or glow, primary button from tokens with a warm shadow, hero title 600 / −0.025em; selected navigation rows on a warm neutral ground with 9 % (dark 12 %) accent mixed in. Links remain blue: a reading convention, not decoration. Motion 160 ms ease-out for hover and popovers; no movement on scroll.

Slate

Technical minimalism. The current OINK appearance, unchanged: cool blue-grey canvas, navy ink, steel blue and copper, Inter body, Chakra Petch display, Plex Mono labels and metadata, blueprint grid and hero glow, crimson inline code, 8–12 px radii. Selecting preset: slate must reproduce v1.1 token values; a checker compares them. Grid, glow, Chakra display headings, mono metadata and crimson inline code are Slate identity. Layout, focus, status colours, and the shell structure are shared foundation.

Ink

Typographic minimalism, Swiss-inspired information design. Black, white and neutral grey; one red accent; hierarchy carried by size, weight and alignment rather than colour, shadow or rounded surfaces.

Token Light Dark
Canvas #ffffff #0b0b0b
Body #141414 #ededed
Secondary / tertiary #474747 / #636363 #b5b5b5 / #8f8f8f
Surface #f4f4f4 #161616
Link ink, underlined; hover red light ink, underlined; hover red
Accent #c8102e (5.88:1) #ff5c4d
Radius / shadow 0 / none 0 / none

Differences from Slate: no tinted canvas, no blue, no grid texture, no shadows, no rounded corners; links are identified by underline, not hue; headings use Inter 700–800 with tight tracking instead of Chakra Petch. Differences from Paper: neutral not warm, flat not soft, ruled not hairline, underline links not blue. Distinctive rules: 2 px black rule above h2; h1 800 / −0.035em; uppercase tracked h4, table headers and callout titles; selected navigation row marked by a 3 px red bar, not a fill; tabular numerals.

Terminal

Terminal-inspired utilitarian design. Structure and information expression, not CRT effects: monospaced chrome, command and path notation, compact controls, strong panel borders, amber or teal accents.

Token Light Dark
Canvas #f4f5f2 #0c0f0e
Body #1d211f #d3dbd6
Secondary #4a514d #9aa59f
Surface #e9ebe6 #141a18
Link (teal) #0a6560 (6.31:1) #4cc9bd
Accent (amber) #935400 (5.47:1) #f0a73a
Radius 2 px 2 px

Mono scope: navigation, headings, labels, metadata, breadcrumbs, buttons and code use IBM Plex Mono. Prose paragraphs, lists and table bodies use Plex Sans with platform CJK fallbacks, because long monospaced paragraphs and mixed CJK/Latin mono lines read poorly. Distinctive rules: ## prefix before headings rendered with content: '## ' / '' so assistive technology ignores it; bracketed callout labels ([NOTE]); the selected navigation row is inverted with a ▸ marker; 1 px strong panel borders; static ▍ caret in the hero. No scanlines, glow, blinking, or typing animation.

Difference matrix

Paper Slate Ink Terminal
Temperature warm cool neutral neutral-green
Canvas light #f7f6f3 #f1f4f8 #ffffff #f4f5f2
Canvas dark #161513 #0b1119 #0b0b0b #0c0f0e
Prose face Plex Sans Inter Inter Plex Sans
Heading face Plex Sans 600 Inter 600–700 Inter 700–800 Plex Mono
Display / wordmark Plex Sans / Chakra Chakra / Chakra Inter / Inter Plex Mono
Link signal blue steel blue underline + red hover teal
Accent copper copper red amber
Radius 8–12 8–12 0 2
Shadow soft warm navy-tinted none none
Section rule h2 trailing hairline none 2 px top rule ## marker
Selected row warm tint accent tint red bar inverted + ▸
Inline code ink chip crimson ink chip ink chip, bordered
Landing texture none grid + glow none none
Chrome density standard standard standard compact

Page density

Density follows the task, not the preset: the Landing hero allows the largest display type and brand expression; Docs prose keeps 1rem / 1.7 and ≈ 76ch; sidebar, TOC, parameter tables, search results and the command palette keep compact rows (0.875rem, 1.4–1.5 line height). Presets may change paint inside these zones but not their spacing in phase 1. Terminal’s compact chrome is a phase 2 density token.

Runtime surfaces

Surface Phase 1 impact
Blog, Book, taxonomy Tokens only; Book captions keep the prose face
Search dialog and command palette Scrim tokenized; selected row uses --td-shell-primary-dim
Mermaid, ECharts Colours baked at init on data-bs-theme. Add a data-td-preset observer only if charts take preset colours; phase 1 keeps mode-only chart palettes
asciinema Surface tokens; re-mount only if the code face changes (not in phase 1)
giscus Needs one stylesheet per preset and mode, re-posted on td-preset-change
Swagger UI, ReDoc Keep vendor styling and current light/dark handling
Print Tokenize navy and cool greys; print always uses a light palette from the active preset
404 Its own <html> must carry the new attributes

Accessibility, security, and output

  • Every preset palette passes WCAG AA for body, secondary and tertiary text, links, and accents in both modes (values above). theme_color contrast warnings compute against the active site default preset’s canvases.
  • The menu uses native radios; no role="menu". Focus is never trapped except in the mobile bottom sheet, which is modal and restores focus.
  • prefers-reduced-motion and forced colors keep current behaviour.
  • The init script is inline, static, and derived from validated configuration; the stored value is matched against a build-time allowlist before use.
  • No external font or script request is added. Output adds two <html> attributes, one inline script, and CSS.

Compatibility and migration

Changing the default to Paper changes every site that does not set preset.

  • Sites that want the current look add params.ui.preset: slate; the upgrade note leads with this one line. Slate output must equal v1.1 tokens.
  • Sites with custom brand overrides in their own styles (_styles_project.scss up to 1.5.1, assets/css/project.css after it): light overrides on :root keep working under Paper by source order; dark overrides on [data-bs-theme='dark'] are outranked by Paper’s dark block. Such sites should choose Slate or move overrides to [data-td-preset='paper'][data-bs-theme='dark']. The upgrade note and brand guide document this.
  • theme_color, typography, and fonts keep their meaning and precedence.
  • Sites with dark_mode: false still get one light palette, now Paper.
  • The release that changes the default must state it as a visible change. Whether that release is a minor (1.x) or major version is an open decision.
  • A consumer inventory should report sites with brand overrides before the default change is published.

Implementation plan

Phase 1, in dependency order. Each step names its owning checker.

  1. Tokenize Slate leaks. Landing primary button, grid, glow, scrims, print colours, asciinema surfaces; add --td-preset-accent, brand font role, and per-preset canvas luminance in contrast-on-canvas.html. Slate output must stay byte-for-byte equivalent in computed colour. Checkers: check-landing.py, check-output.py, check-font-tokens.py.
  2. Vendor IBM Plex Sans. third_party/, VENDOR.json, licence file. Checker: check-vendor.py.
  3. Preset tokens. New assets/scss/td/_presets.scss (imported after _brand.scss); the implementation keeps Paper in that file instead of a separate presets/_paper.scss. After v1.5.1 the file is the plain CSS layer assets/css/td/presets.css, listed after brand.css. Place preset font roles before the system typography reset. Checkers: extend check-font-tokens.py (Plex Sans family, system block order, token parity between light and dark blocks).
  4. Configuration. hugo.yaml defaults (preset: paper, preset_menu: false); a resolver partial used by validate.html, document-attrs.html, layouts/404.html, and head.html (init script, theme-color, pre-paint canvas). Regenerate the schema. Checkers: check-params.py (accepted, invalid, reserved), generate-config-schema.py --check, check-namespace.py.
  5. Appearance menu. Shared partial used by navbar.html, shell/footer-line.html, and the Landing mobile drawer; preset.js runtime (or a section of dark-mode.js); dark-mode.js radio sync; palette action switch_preset; i18n strings in all 32 catalogs. Checkers: check-shell.py, check-actions.py, i18n checker, tests/js/preset.test.js, tests/js/dark-mode.test.js.
  6. Third-party surfaces. Per-preset giscus stylesheets and re-post.
  7. Documentation. EN/ZH architecture, shell and landing contracts; brand guide (presets, migration, fonts); configuration reference; changelog and upgrade note.
  8. Site validation. make -C ../oink.pgsty.com check, browser (add preset switching, persistence, storage failure, no-JS, EN/ZH, desktop/mobile, light/dark cases), and dev for visual review.

Acceptance criteria

The following are the original acceptance targets. Executed checks and remaining limits are recorded separately in the October 5 acceptance record:

  • With no preset key, output carries data-td-preset="paper" and renders Paper with JavaScript disabled.
  • preset: slate produces computed colours and font roles equal to v1.1 across the checker fixtures.
  • Switching style never changes td-color-theme; switching mode never changes td-preset; both survive navigation, reload, and language switch.
  • Invalid stored values are removed; storage failure leaves the page usable and shows the non-persistence note.
  • No first-paint flash between presets in Chromium, Firefox and WebKit at normal and throttled CPU.
  • Scroll position after a switch stays within one line of the anchor.
  • typography: system triggers no font request in any preset; params.ui.fonts overrides preset faces.
  • theme_color overrides the accent in both modes under Paper and Slate.
  • The menu is fully operable with keyboard, touch, and screen readers; axe reports no new violations.
  • All palettes meet the contrast table in both modes.
  • Presets add no external font or script dependency; explicitly configured services such as Giscus remain separate.

Open decisions

  1. Resolved for phase 1: preset_menu: false; the docs site enables it.
  2. Target resolved for release preparation: 1.2.0, with a prominent Paper-default notice and the preset: slate compatibility setting. Published in 1.2.0.
  3. Resolved for phase 1: the wordmark role is brand.
  4. Whether a display-only serif becomes a Paper option after phase 1.
  5. Whether charts (Mermaid, ECharts) should take preset colours in phase 2.

Ink and Terminal backlog

Implemented experimentally: both palettes, existing font roles, prose link and selection signals, heading treatments, scoped geometry, compact Terminal navigation, Giscus palettes, print and the existing switching mechanism. No new font file, animation or runtime is added. See the experiment record for actual output and verification.

Before stable promotion, review long-page red accent density and CJK underline weight in Ink; numbered headings, mono wrapping and dense parameter tables in Terminal; Windows/Android fallback faces and manual screen-reader speech. Mermaid/ECharts and API vendors remain mode-only for this experiment. Wider geometry/density tokens and preset-colored charts require a separate decision.

Decision log

Date Change
2026-10-04 Draft created with Paper/Slate phase-1 scope, Ink/Terminal research specs, Appearance menu choice, and token architecture
2026-10-05 Phase 1 implemented locally; defaults, brand role and mode-only chart scope accepted
2026-10-05 Subsequent explicit Ink/Terminal experiments implemented; stable menu policy retained; design acceptance remains open
2026-10-05 Release preparation targets 1.2.0; simplified Style/Light controls and current-state icons replace the earlier swatch proposal

18 - Stabilizing Ink and Terminal for reading

A conditional stabilization plan for two distinct reading styles, with a shared footer blocker and explicit bilingual accessibility gates.
Draft — dated October 26 snapshot; superseded in typography by v1.7.0

Enlarged text overflows the shared footer in the October 26 probe: at 320px with a 32px root/default font, English Ink reached 424px document width and Terminal 408px. OINK v1.7.0 later revised the typography of Ink (system serif / Song prose) and Terminal (all-mono screen, IBM Plex Sans print) — see the architecture contract and accepted decision for current behavior. Neither preset is yet promoted from explicit opt-in to the default pair.

Status, ownership and scope

Status and date: Draft, 2026-10-26; proposed design direction, not an implementation contract

Accountable owner: OINK maintainers; separate recorded acceptance for each preset

Delivery owners: Theme maintainers own CSS, resolvers and focused checkers; documentation maintainers own bilingual contracts, real-site fixtures and browser review; accessibility reviewers own manual task evidence

Baseline: OINK v1.4.0; local source identity and dirty-snapshot limits are recorded in the research

Affected surfaces: Architecture, Components, Shell, Landing and the visual preset decision

Release intent: A later release, subject to refinement and independent acceptance; no new preset recommended

Context and evidence

Ink and Terminal already exist as explicit experiments. Their shared shell is an advantage: readers retain navigation, search, appearance controls and content semantics when changing style. Their remaining problems are repeated decoration, typography outside ordinary prose, inconsistent owned geometry, and incomplete acceptance. Ink is already neutral sans editorial; making it serif would consume Folio’s separate territory. Terminal should become a readable engineering handbook, retaining mono technical roles alongside proportional explanations.

The dated research distinguishes source facts, measurements, design judgments and a limited CSS overlay. Normal-size measurements, spacing probes and focused checks are encouraging, but the whole-document footer failure survives them. Manual 200% text-resize and 400% browser-zoom checks remain separate from the 32px font-preference probe.

Goals and explicit exclusions

Preset Audience and primary task Distinct identity within the same shell
Paper Broad documentation readers; guides and sustained reading Warm Plex Sans reading surfaces and restrained rounded components; remains the default
Slate Existing technical/product sites; reference navigation and product presentation Established cool palette, Inter/Chakra/Plex roles and richer Landing presentation; compatibility choice
Ink Editors, authors and readers of essays, design rationale and long documentation Neutral Inter/CJK sans, square flat surfaces, visible prose underlines and sparse red or authored accents
Terminal Engineers and operators; procedures, configuration lookup and code explanation Plex Sans explanations, mono headings/controls/identifiers, teal/mint links, amber emphasis and flat 2px geometry

Both candidates must work across Docs, Book, Blog, galleries, Expo and Landing in EN/ZH, light/dark and narrow/wide views. Neither is a separate shell, accessibility mode or table-density mode. Exclude new renderers, global spacing changes, font downloads, runtime dependencies, terminal effects, moving selection tracks, raised Tabs, boxed Field names and Paper heading tails.

Two optional concepts remain outside 1.4 scope:

Concept Distinct future purpose Cost and disposition
Folio Academic/book publishing: serif reading roles and scholarly captions/notes, sans navigation/search, mono code Requires a matched EN/ZH serif strategy, licensing, local font payload and fallback/print/device acceptance. Keep the shared shell; no imported margin-note column. Credible future study, not an Ink replacement.
Canvas Playful geometric presentation for creators: existing sans faces, controlled lilac/ochre accents and a few geometric markers No inherent font cost, but added palette/state/shape rules, asset guidance, menu and full regression coverage. Evidence is weaker and overlap with Slate is substantial. Defer until creator tasks justify it.

Proposed behavior and boundaries

Preserve the palette, assign each role

Retain these source colors initially. Values below are light/dark pairs, not a new configuration authority; the preset stylesheet remains the implementation owner: _experimental-presets.scss in v1.4.0, and assets/css/td/experimental-presets.css after v1.5.1. Refine repetition before changing hue.

Role Ink light / dark Terminal light / dark
Canvas #ffffff / #0b0b0b #f4f5f2 / #0c0f0e
Body #141414 / #ededed #1d211f / #d3dbd6
Emphasis #000000 / #ffffff #111713 / #edf4ef
Secondary text #474747 / #b5b5b5 #4a514d / #9aa59f
Tertiary text #636363 / #8f8f8f #606b63 / #8b9990
Secondary surface / code header #f4f4f4 / #161616 #e9ebe6 / #141a18
Tertiary surface #ffffff / #161616 #f8f9f6 / #18201c
Code block #fafafa / #111111 #ffffff / #0a0d0b
Link #141414 / #ededed #0a6560 / #4cc9bd
Hover link #c8102e / #ff5c4d #084f4b / #7de0d7
Default accent #c8102e / #ff5c4d #935400 / #f0a73a
On-link foreground #ffffff / #0b0b0b #ffffff / #0c0f0e
Ordinary border Body RGB at 24% / 24% Body RGB at 32% / 32%
Strong line Body RGB at 55% / 50% Body RGB at 55% / 55%
Inline code Body foreground; body RGB fill 5% / 6% Body foreground; body RGB fill 5% / 7%

Success, warning, error and information retain their semantic tones, icons and labels. Red is not every Ink status; mint is not every Terminal status. Keep neutral badges distinguishable from success. Decorative separators may remain subtle; required control boundaries need independent contrast measurements.

Authored theme_color remains authoritative for accent surfaces. Actual documentation uses blue #245f94/#5da2dd, Book orange #9a3412/#fb923c, and Blog violet #6d28d9/#a78bfa. These do not replace the link/code text roles. Review both authored accents and preset defaults.

Keep reading roles and verify actual fallback

Role Ink default Terminal default
body Inter + platform sans IBM Plex Sans + platform sans
ui Inter + platform sans Code role: IBM Plex Mono + mono fallbacks
heading Body role UI role
code IBM Plex Mono + mono fallbacks IBM Plex Mono + mono fallbacks
display Heading role Heading role
meta UI role UI role
brand UI role UI role
print Body role Body role

Book captions, table descriptions and human-readable search titles/excerpts use the body role. Authored chapter numbers retain their meaning and follow their heading’s role. Technical paths, command controls and identifiers remain mono in Terminal. Field names stay unboxed, at weight 600. Descriptive Terminal table headers move to body 0.875rem/600; ordinary prose retains 1rem/1.7 and the shared reading measure. Display titles retain page-specific scale and wrap; do not shrink mobile prose to accommodate mono chrome.

The existing sans fallback order is -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans SC, generic sans-serif and emoji. The mono list follows IBM Plex Mono with SFMono-Regular, Cascadia Code, Roboto Mono, Menlo, Consolas, Liberation Mono, Sarasa Mono SC, Noto Sans Mono CJK SC and generic monospace. Listed names do not install fonts. YaHei precedes Segoe and can supply Latin too. Chinese glyphs need not occupy Latin mono cells. Preserve language metadata, typography: system, explicit roles and, in releases up to 1.5.1, legacy Sass precedence; inspect loaded, blocked, system and overridden font conditions on actual Windows/Android. (Font matching)

Compare Ink article h1 at weight 750/tracking -.025em, h2/h3 at 700/-.012em, and a 1px strong-token top rule instead of the current heavier rule. Chinese headings use zero tracking. Remove enforced uppercase/tracking from minor headings, table headings and callout titles. Terminal headings use 600/zero tracking; remove generated ##/### and callout brackets while preserving authored Book numbers, semantic labels and heading anchors. No fake prompts, blinking cursor effects or decorative heading tails.

Ink prose links remain natively underlined at rest, including lists, notes and citations. Terminal retains a persistent non-color link distinction; verify its existing semibold cue in real prose and use native underlines where that cue is insufficient. Navigation relies on its location and persistent current-state marks. Hover must not change layout, weight or hit area. (GOV.UK links)

Underline geometry remains a review decision. The overlay uses max(1px, .06em) thickness, .22em offset, with a Chinese .25em/skip-ink: none comparison. A blanket .25em rule is not accepted. Compare English .12–.18em and Chinese text-underline-position: under with only 0–.06em extra offset, starting with skip-ink: auto. Scope by actual language, including Chinese blocks inside English pages. Test mixed glyphs, punctuation, descenders, inline code and wrapped links; no line may collide with glyphs or adjacent lines. (CSS Text Decoration draft)

Make component states coherent

Owned component corner radii: Ink 0px, Terminal 2px, no elevation shadows; include FileTree’s currently hard-coded 0.6rem corner radius. Preserve image, avatar, status-dot and vendor geometry.

Current/selected: Ink keeps a static accent rail; Terminal keeps neutral inverse rows/marker. Programmatic state remains. Hover, selection and keyboard focus stay distinct; no traveling pill.

Focus: Immediate static indicator, independently measured on every adjacent surface, visible in forced colors; no global outline reset.

Text selection: Start from current authored-accent fill at 22% light/35% dark; measure composited text/inline-code pairs. Change through the owning role if needed; do not assume the opacity passes.

Tabs: Flat labels, static bottom selection rule, separate focus; no raised active tab. Preserve keyboard, hash/storage behavior, long labels and touch hit areas.

Fields and inputs: Unboxed technical Field names; descriptions remain prose. Actual input controls retain persistent labels, identifiable boundaries and associated error text; placeholder alone is insufficient.

Code and tables: Quiet single frame; preserve syntax semantics, comments, copying, captions, header associations and numeric alignment. Descriptive headers can wrap; no whole-table uppercase. Preserve authored width/overflow policy and local scroll access.

Notes, quotes, footnotes: Keep essential text visible; restrained semantic marker/rule, close attribution and usable reference/backlinks. No oversized quote ornaments, blanket Chinese italics or added margin column.

Cards, steps, badges, disclosures: Stable labels and geometry; distinguish clickable from static content, keep real step numbers, native disclosure semantics and labeled states.

Search and appearance: Body-role result titles/excerpts, mono technical paths; readable matching/selected/muted text. Preserve dialog focus/return, IME editing, loading/error/no-results feedback and reachability with a mobile keyboard.

Landing, Blog/gallery, Book, Expo: Preserve existing composition and media behavior; fit display titles, captions, bylines and utilities into each reading task. Do not turn image surfaces into squared global resets.

Preserve output, vendor and security boundaries

Mermaid/ECharts remain mode-only; API widgets retain vendor palettes and their existing mode behavior. Do not add preset recoloring inside vendor DOM. Giscus automatic palettes follow preset and mode; explicit overrides remain authoritative, but blocked remote frames are not accepted by this review. Print keeps the light preset on white paper; no-JavaScript output keeps the site-default light palette and readable content. Markdown/RSS preserve semantic content without decorative prefixes or control leakage. Keep existing escaping, validated font/color inputs, local assets and appearance storage behavior; no new network permission or script dependency.

Compatibility and migration

Keep preset names, independent mode/style state, shell columns, breakpoints, content syntax and author overrides. Retain Paper as default and maintained consumers’ explicit [paper, slate, ink, terminal] menu. A refinement can ship while a preset remains experimental.

Promotion changes the meaning of preset_menu: true: it offers stable presets plus the site default, so promoting either experiment expands that automatic set. Make that change explicit in layouts/_partials/preset-config.html, its checker and bilingual configuration/release guidance. Explicit lists retain their chosen membership. Promotion requires per-preset maintainer acceptance, not a status-label edit. Preserve reserved Folio/Canvas warning/fallback behavior.

Implementation and owning-checker plan

Stage / owner Work and evidence
Shared repair / shell maintainer Fix footer shrink/wrap behavior at its owner; add whole-document scroll-width and visible-content assertions through the footer for all four presets. Avoid clipping or hiding overflow as a remedy.
Refinement / theme maintainer Implement reviewed changes in existing preset, typography and component owners. Start with bin/check-presets.py, bin/check-font-tokens.py and affected component/output checks; preserve frozen Slate.
Integration / documentation maintainer Extend appearance, font, component and text-reflow suites on real EN/ZH pages; include full-page checks and annotated visual review. Run sibling-source make check, make browser, and make dev review.
Promotion / maintainers and reviewers Close the gates below; update owning implementation/checker and affected EN/ZH contracts together, then record durable rationale and user-facing migration guidance.

Runtime edits additionally require node --test 'tests/js/**/*.test.js'; schema edits require python3 bin/generate-config-schema.py --check.

Acceptance gates and open decisions

Distinguish accessibility requirements from project targets

WCAG 2.2 A/AA is the baseline (references accessed on 2026-10-26).

Gate Required assessment
Text and controls Normal text 4.5:1; qualifying large text 3:1 (24px regular or 18⅔px bold, equivalent CJK sizing). Required control/state cues 3:1 against adjacent colors; decorative dividers are different. Include code comments, placeholders and every selected/hover state. (1.4.3, 1.4.11)
Reflow and resizing Independently test 320 CSS px reflow, manual 200% text enlargement and 400% browser zoom from a 1280px viewport. Necessary two-dimensional regions require individual justification; code/tables are not blanket exemptions. Also close the separate 320px/32px-font stress blocker. (1.4.10, 1.4.4)
Spacing Tolerate simultaneous line-height 1.5, paragraph-after spacing 2em, letter spacing .12em and word spacing .16em without loss. These are user overrides, not default typography; assess applicable Chinese/mixed-script properties. (1.4.12)
Keyboard and meaning Visible focus; focused controls not entirely obscured by authored content; non-color state cues; correct language, headings, labels and table relationships. Character shortcuts need disable/remap/focus-only handling, not merely suppression in text inputs. Announce applicable search statuses without moving focus. (2.4.11, 2.1.4, 4.1.3)
Target minimum AA uses 24×24 CSS px or a qualifying exception. For its spacing exception, a 24px-diameter circle centered on each undersized target must intersect neither another target nor another undersized target’s circle; inline, equivalent, user-agent and essential exceptions also exist. (2.5.8)
Proposed stronger targets Routine touch controls 44×44px; main text 7:1; whole focused control/ring visible; static indicator at least a 2px-perimeter area with 3:1 change at the same pixels, plus adjacent-color contrast. These go beyond AA and need explicit adoption; they do not imply whole-page AAA. (2.5.5, 1.4.6, 2.4.13)

Record complete tasks before promotion

Require both languages and modes at 320/390/768/1440px, with normal, enlarged and overridden text. Review long pages at top/middle/footer, heading/Book numbering, URLs, Fields, tables, code, search, appearance, media and Landing. Inspect rest/hover/current/selected/focus/text-selection, forced colors, reduced motion and no-JavaScript/print/Markdown/RSS. Record actual color pairs and human review of axe incompletes.

Actual Windows Chrome/Edge and Android Chrome font/rendering work remains pending, as do branded macOS/iOS Safari checks. Record device/OS/browser/font conditions. Pending manual tasks use NVDA on Windows, VoiceOver with actual Safari, and TalkBack on Android: traverse headings and meaningful numbers, read tables/field errors, search with Chinese input, hear concise status feedback, open/close dialogs and regain focus.

Open decisions are the Chinese underline treatment, stronger project targets, any state-specific color repair, and the promotion of each preset. If gates remain incomplete, retain experimental status or defer refinement; unrelated 1.4 work need not wait for new styles.

Decision log

Date Proposed decision and status
2026-10-26 Keep Ink neutral sans editorial and Terminal a readable engineering handbook; preserve current palettes and author accents. Direction recommended; no stability acceptance.
2026-10-26 Prioritize shared enlarged-font footer repair; keep flat Tabs, unboxed Fields and no Paper tails. Remove decorative Terminal punctuation through existing owners.
2026-10-26 Chinese underline alternatives and stronger accessibility targets remain review decisions; exploratory probes do not close promotion gates.
2026-10-26 No new preset for 1.4; Folio/Canvas remain distinct future concepts. Per-preset promotion and automatic-menu expansion require explicit acceptance.

19 - Ink and News: the written page and the printed page

A partly implemented proposal that makes Ink the written style and News the printed style, with font coverage, light and dark palettes, detail specifications and acceptance gates.
Shipped in OINK v1.8.0 (2026-11-28)

Most of this proposal is implemented and ships in OINK v1.8.0; three parts remain open, see the implementation record. Current behavior is defined by the architecture contract and the visual presets decision.

Status and surface

Status and date: drafted 2026-11-28 and partly implemented in OINK v1.8.0

Owner: OINK maintainer

Baseline: OINK v1.7.0 plus the v1.8.0 preset pass: newsprint is renamed news; the menu puts Paper, Slate and GitHub above Ink, News and Terminal; dark Terminal becomes a phosphor screen; Ink takes Kai headings, Song text and Palatino for Latin. The visual presets decision records these changes.

Affected contracts: Architecture · Visual presets, Visual presets decision

Affected implementation: assets/css/td/tokens-typography.css, assets/css/td/brand.css (local font aliases), assets/css/td/experimental-presets.css, assets/css/td/print.css, layouts/_partials/_funcs/preset-canvases.html, assets/css/giscus-ink-*.css, assets/css/giscus-news-*.css, bin/check-presets.py

Release intent: OINK v1.8.0; both presets stay explicitly selected

Context and evidence

Four of the six presets have settled roles. Paper is the default warm paper surface, Slate is the technical look OINK has had since 1.1, GitHub reproduces how GitHub renders a README, and Terminal is a terminal: an engineering handbook in light mode and a phosphor screen in dark mode. The remaining two, Ink and News, both draw on paper and serif type, and they blur together.

  • Ink in 1.7.0 is a sans-serif editorial style: white ground, black text, a red accent. It reads like Hextra and other modern documentation themes, and it is hard to tell apart from Paper and GitHub. The working-tree draft turns it into brush writing.
  • News is the ivory Paper of 1.7.0, after Typora’s Newsprint theme. Its serif text, Song, Kai quotations and ivory sheet overlap heavily with a brush-written Ink. The draft dark News is an evening paper by candlelight: a warm brown ground, parchment-colored text and gold links, which uses the parchment and gold that Ink wants.

This proposal draws one line between them: Ink is written, News is printed.

Font coverage

The theme ships no font files and can only name fonts the reader already has. What each platform preinstalls decides how many readers see the design as drawn. The table follows the official font lists of Microsoft, Apple, AOSP, Ubuntu and Fedora as of 2026-11-28. “With Chinese” means the Chinese (Simplified) Supplemental Fonts that Windows installs when Chinese is added; “on demand” means a download, which macOS may make by itself when the system language is Chinese, though Apple does not document it.

Font class Windows, Chinese Windows, English macOS iOS / iPadOS Android Linux desktop
Hei (sans) Microsoft YaHei Microsoft YaHei Hiragino Sans GB, STHeiti (PingFang on demand since macOS 15) PingFang (on demand) Noto Sans CJK Noto Sans CJK
Song (serif) SimSun SimSun Songti SC (preinstalled) Songti SC (on demand) Noto Serif CJK, only as the serif fallback Noto Serif CJK
Fangsong FangSong none (with Chinese) STFangsong (on demand) on demand none none
Kai KaiTi none (with Chinese) Kaiti SC (on demand) on demand none AR PL UKai on Ubuntu installed in Chinese
Palatino Palatino Linotype Palatino Linotype Palatino Palatino none URW P052
Calligraphic Gabriola, Segoe Script same Apple Chancery, Zapfino, Snell Roundhand Zapfino, Snell Roundhand (Apple Chancery on demand) Dancing Script, only as cursive URW Z003
Newspaper serif Times New Roman, Georgia same Times New Roman, Georgia, Charter, Didot Times New Roman, Georgia, Charter, Didot Noto Serif Liberation Serif

Three conclusions follow:

  1. No Chinese face exists on every platform. By class, only Hei is everywhere; Song is nearly everywhere except iOS, where Chinese serif text probably falls back to PingFang; that is unverified.
  2. Fangsong and Kai have identical reach. Chinese Windows has both, macOS readers must download them, and phones and most Linux systems have neither. “Fangsong first, Song as the fallback” therefore works, but only readers on Chinese Windows or a Mac with the font downloaded see Fangsong. Everyone else sees Song.
  3. Lookup by name and local() give different results. On 2026-11-28, on a Mac where Kai had been downloaded, WebKit did not match font-family: "Kaiti SC" while Chromium did. Through an @font-face alias with local("Kaiti SC"), both engines matched it. The theme’s OINK Kai already uses an alias; Fangsong should do the same.

Goals and non-goals

Goals

  • Ink and News are distinguishable at a glance in light and dark mode, on Chinese and Latin pages.
  • Each has its own dark mode. Dark mode changes colors and a few details, never fonts.
  • The six dark modes do not collide: Slate and GitHub already hold blue-black, Paper holds warm grey, and Terminal holds phosphor green.
  • When Kai and Fangsong are missing, the two presets stay distinguishable; the style must not rest on fonts alone.

Non-goals

  • No font files, image assets or runtime scripts.
  • No vertical text, ink-wash backgrounds, cloud ornaments, images of brush lettering or seal images.
  • No changes to Paper, Slate, GitHub or Terminal.
  • No configuration renames: ink and news stay as they are.

The dividing line

Aspect Ink · written News · printed
Metaphor A scroll written by one hand: xuan paper or parchment A page set in columns by machine: newsprint and press ink
Rhythm Open: one column, a deep top margin Dense: masthead, kicker, deck, column rules
Hierarchy by Changing the letterform: Kai, italic, a red initial; no bold Changing weight: heavy headlines, light decks, thick-and-thin rules
Chinese Kai headings, Fangsong text (Song when missing), red emphasis dots Bold Song headlines (heavy Hei on Windows), Song text, bold emphasis
Latin Palatino text and italic headings; calligraphic faces only for titles, initials and the wordmark Charter / Georgia text, Times New Roman Bold headlines, a Didot masthead
Color Paper with two inks: black and vermilion Grey newsprint, press black and one spot blue
Where the reader is A vermilion dot A black column rule and bold
Dark mode Gold on indigo paper Darkroom

When Kai and Fangsong are both missing, Ink’s Chinese falls back to Song, the same class News uses. Four differences remain: Ink headings stay at regular weight with open spacing while News headlines take the heaviest weight with tight spacing; Ink marks emphasis with vermilion dots while News uses bold; Ink has a paper color with a radial shade while News is flat grey newsprint; Ink has no rules while News has them everywhere.

Ink: the written page

Type

Role Chinese Latin Note
Display (page title, Landing hero) OINK Kai Apple Chancery → Gabriola → URW Z003 → Palatino Italic Calligraphic faces at large sizes only; never the generic cursive, which Chrome on Windows resolves to Comic Sans
Headings (h2–h4) OINK Kai Palatino Italic Zapf drew this italic from Renaissance chancery hands
Text OINK Fangsong → Song Palatino → Palatino Linotype → URW P052 → TeX Gyre Pagella Fangsong is enlarged 8%, for Han only
Quotation OINK Kai Palatino Italic The shared quotation role
Interface (navigation, search, menus) Platform Hei Platform sans Song and Kai thin out at control sizes
Code Shared mono Shared mono Unchanged
  • Add an OINK Fangsong alias. It follows OINK Kai: local() names STFangsong, then Windows FangSong; unicode-range covers only Han and full-width punctuation; and size-adjust: 108% makes up for Fangsong’s light, small design. Both Fangsong faces have only a regular weight, so emphasis does not use bold (see the emphasis dots below).
  • Kai headings stay at regular weight. Only macOS Kaiti SC has a true bold; Windows KaiTi does not, and synthesized bold looks poor. Headings rank by size and space.
  • No Papyrus. It is the best-known overused “ancient” typeface, and Windows, Android and Linux do not have it. For a rougher look, Luminari and Trattatello on macOS can serve as display alternatives, outside the default stack.

Color

The light palette, “xuan paper and vermilion”, uses a manuscript’s two inks: black for writing and vermilion for marking.

Token Value Contrast on the darkest edge #e8dabd
Paper (canvas) #f3ead7 —
Paper edge (end of the radial shade) #e8dabd —
Code ground #e9dcc1 —
Ink (text) #241a10 12.35:1
Light ink (secondary) #574634 6.52:1
Pale ink (tertiary) #6e5c47 4.63:1
Vermilion (accent) #a8321b 4.84:1
Seal (wordmark ground) #b8371d, paper-colored text 4.88:1

Links keep the text ink with a vermilion underline and turn vermilion on hover.

Details

  • Vermilion dot: the current navigation item gets a vermilion dot instead of a tinted row.
  • Emphasis dots: Chinese strong is not bold. It takes text-emphasis: filled dot in vermilion under each character, the traditional Chinese mark of emphasis, scoped to :lang(zh). The cost is that Latin letters inside the same strong get dots too.
  • Initial: the first letter of the first paragraph is set three lines tall in a calligraphic face and vermilion, in Blog and Book text only, not Docs. Its float uses logical properties, so RTL pages mirror it.
  • Seal: the wordmark may sit in a vermilion box like a seal impression. This is the detail most likely to look kitsch; whether it is on by default is open.
  • Paper: a radial shade lies over the canvas, paper-colored at the center and slightly darker at the edges. No noise image; print drops it.
  • Top margin: more space above the page title.
  • Red stays small: dots, emphasis marks, the initial, the seal and underlines. Headings are never red; Fangsong text under a red title reads as a Chinese government circular.

The brush details already in the working-tree draft (a tapered stroke opening each section, a short dash for hr, quotations hung on a fading vermilion stroke) fit this direction and can stay.

Dark: gold on indigo paper

This palette follows sutras written in gold and silver on deep indigo-violet paper. East Asia wrote sutras in gold on indigo paper and Europe wrote gold on purple parchment, two traditions that arrived at the same practice, so the palette suits Chinese and Latin pages alike.

Token Value Contrast on the darkest edge #120f22
Indigo paper (canvas) #1b1730 —
Paper edge #120f22 —
Code ground #241f3d —
Silver (text) #e3ddd0 13.89:1
Gold (headings and accent) #dcb766 9.85:1
Secondary #b4ad9f 8.43:1
Tertiary #958e82 5.79:1
Seal, lifted #e06a4c, text in the paper color 5.23:1

The initial, emphasis dots and the current-position dot turn gold. The seal stays red, as collectors’ seals on such sutras are.

The draft dark Ink is a stone rubbing: a blue-black ground, paper-colored text and a vermilion seal. It ties more directly to calligraphy, since calligraphers learn from rubbings, but its palette is close to a generic dark theme and hard to tell from Paper’s warm grey dark (#161513). This proposal recommends gold on indigo and keeps the rubbing as the alternative.

News: the printed page

Type

Role Chinese Latin Note
Masthead (wordmark) Bold Song Didot → Bodoni 72 → Times New Roman Only macOS has Didot
Headlines Songti SC Black / Bold → Microsoft YaHei Bold Times New Roman Bold Times was drawn for The Times
Text Song Charter → Iowan Old Style → Georgia → Cambria The current stack
Kicker, byline, table heads, interface Platform Hei Platform sans, uppercase and spaced Papers set section labels and datelines in a sans
Quotation OINK Kai Serif italic As today

The deck (the page description) is italic in Latin. Han has no true italic, so a Chinese deck stays upright.

Color

The light palette, “newsprint”, is grey newsprint, press black and a single spot color.

Token Value Contrast on the code ground #e6e3da
Newsprint (canvas) #f0eee8 —
Code ground #e6e3da —
Press black (text) #161616 14.10:1
Secondary #4a4844 7.11:1
Tertiary #625f59 4.96:1
Spot blue (links and accent) #1f4f7a 6.66:1

The current clay accent (#9b4a28) and Ink’s vermilion are both red-brown and hard to tell apart side by side, so News moves to a single spot blue. The newsprint is greyer and darker than Paper’s #f7f6f3, and further from Ink’s yellower paper.

Details

  • Masthead: a double rule under the site header. The specimen’s date and edition between the lines would need new markup and are not implemented.
  • Kicker, deck and byline: the section name as a kicker above the headline in spot color and capitals; the page description as a deck below it; the byline and date between two thin rules. The current markup has the deck (.lead) and the date line (.td-article-info) but no kicker, which would need new markup and is not implemented.
  • Thick-and-thin rule: a heavy rule over a thin rule above each h2, in place of Ink’s brush stroke.
  • Pull quote: a heavy rule above and a thin rule below, a step larger, with no left bar. Quotations in documentation often run to several paragraphs, and centering would hurt them, so they keep their start alignment.
  • Column rules: Blog lists and section indexes set in columns with column-rule on wide screens. Article text stays in one column, because code blocks do not survive columns. Blog lists switch between cards, a table and a gallery at runtime, so columns are not implemented.
  • Tables: a press-black rule above and below, tabular figures, uppercase heads.
  • Where the reader is: a black column rule and bold on the current navigation item, with no color.
  • No drop cap: the initial belongs to Ink.

Dark: the darkroom

The darkroom where a newspaper developed its photographs: true black, the grey of silver prints and the orange of the safelight.

Token Value Contrast on the code ground #1a1a1a
Ground #0f0f0f —
Code ground #1a1a1a —
Silver (text) #d8d6d1 11.98:1
Headlines #f3f1ec 15.42:1
Secondary #a4a19a 6.75:1
Tertiary #8a877f 4.85:1
Safelight orange (links and accent) #f2804a 6.60:1

A faint orange radial glow (7% opacity) sits in the top corner, on screen only. Safelight orange sits about 20° redder than Ink’s dark gold and is more saturated, so the two stay distinct side by side.

The draft evening paper by candlelight uses a warm brown ground, parchment text and gold links, and parchment and gold belong to Ink in this proposal. Its warm brown is also close to Paper’s dark ground. This proposal recommends the darkroom. If a monochrome mood is preferred, microfilm is the alternative: a neutral black ground, silver-grey text and the spot blue lifted for links.

The six dark modes

Preset Canvas Text Accent Image
Paper #161513 #ece9e3 #7db5e6 Warm grey
Slate #0b1119 #e8eef6 #5da2dd Cool blue-black
GitHub #0d1117 #f0f6fc #4493f8 Primer dark
Ink (proposed) #1b1730 #e3ddd0 #dcb766 Gold on indigo paper
News (proposed) #0f0f0f #d8d6d1 #f2804a Darkroom
Terminal #020703 #7ee89a #3dff7a Phosphor screen

Other scripts

Ink’s principle of writing applies to every script: the display and heading roles use an installed face from that script’s calligraphic or handwritten tradition, and the text uses the script’s book face. Where no such face exists, the book face is enough. Japanese and Korean would need their own :lang(ja) and :lang(ko) stacks, or Han characters take Chinese forms. Preset font roles may only sit on the bare root selector, so that typography: system and params.ui.fonts still override them, so those stacks are not implemented and Japanese and Korean keep the theme’s existing handling. The Arabic and Hebrew calligraphic faces join the heading stacks by glyph fallback, which gives Persian Thuluth rather than Nastaliq.

Script Display and headings Text
Japanese Kyokasho (Windows UD Digi Kyokasho; macOS on demand) Mincho
Korean Gungsuh (Windows; macOS on demand) Myeongjo / Batang
Arabic Thuluth (macOS Diwan Thuluth) Naskh
Persian Nastaliq (Noto Nastaliq Urdu, preinstalled on macOS) Naskh
Hebrew Corsiva Hebrew (macOS) System Hebrew serif
Cyrillic Palatino Italic (the calligraphic faces lack Cyrillic) Palatino
Devanagari, Bengali No suitable calligraphic face; the text face System face

News needs no per-script rules: each script uses its book serif and bold headlines.

Output, accessibility and security

  • Contrast: every text color is checked against the darkest point of the canvas, the end of the radial shade, not the paper color at the center. check-presets.py must include that end color in its AA checks.
  • Print: the paper shade, glow, initial color and seal are dropped; print keeps each preset’s existing print palette.
  • Forced colors: shades, emphasis-mark color and rule color yield to system colors; the emphasis marks themselves stay.
  • RTL: the initial’s float and the navigation dot use logical properties.
  • Markdown, LLMS and RSS: unaffected; they carry no preset styling.
  • Network and assets: no font files, images or external requests; local() aliases take effect only where the reader has the font.

Compatibility and migration

  • ink shipped in 1.7.0. Sites that set preset: ink or list ink in the menu will see a clear change. It is an explicitly selected experiment, so this is acceptable, but CHANGELOG.md must say so.
  • news has not shipped, so changing it has no compatibility cost.
  • The reserved name folio was held for a serif book style, which overlaps Ink and News as proposed here. Whether to keep the reservation is the maintainer’s decision.
  • Both presets’ giscus palettes (giscus-ink-*.css, giscus-news-*.css) change with their palettes.

Implementation and checker plan

  1. Add the OINK Fangsong alias in brand.css, and rewrite Ink’s and News’s font roles in tokens-typography.css as tabled above.
  2. Rewrite Ink’s and News’s light and dark palettes and details in experimental-presets.css; update canvases and inks in preset-canvases.html to match.
  3. Drop the paper effects in print.css.
  4. Update the four giscus palettes.
  5. Add the shade-end AA check and token parity for the new palettes to check-presets.py.
  6. Review Ink and News on the documentation site in English and Chinese, desktop and phone, light and dark, including the fallback on Windows without Kai or Fangsong.

Acceptance criteria

  • With screenshots of all six presets side by side in the same mode, a reviewer can tell each one apart without reading a label.
  • Where Kai and Fangsong are absent (iOS, English Windows), Ink’s and News’s Chinese pages are still distinguishable.
  • Every text color meets WCAG AA at the darkest point of the canvas; body text reaches 4.5:1.
  • Print preview shows no shade, glow or seal.
  • check-presets.py and check-stylesheets.py pass, and the site’s make check and make browser pass.

Implementation record

On 2026-11-28 the theme was changed to this proposal, settling the open questions as it leaned: Fangsong text; the seal on by default, on the site header’s text wordmark only (the sidebar brand of the Docs, Book and Blog shells is untouched); the initial in Blog and Book only; gold on indigo paper and the darkroom for the dark modes; News without clay. Where the implementation departs from the design:

  • The display stack adds URW Z003 for Linux.
  • Per-language Japanese and Korean stacks, News’s kicker, the date and edition inside the masthead rule, and Blog list columns are not implemented, for the reasons given above.
  • Pull quotes keep their start alignment instead of centering.
  • The menu icons take each preset’s accent: Ink vermilion, gold in dark; News spot blue, safelight orange in dark.
  • A calibration after the maintainer’s review the same night dropped Ink’s calligraphic display faces and seal: Latin is Palatino everywhere and Han takes Kai in headings and the interface. News sets its interface, menus and lists in its text serif and squares its interface parts. The display-face table and the seal detail above no longer apply.

The theme’s check-presets.py, check-font-tokens.py, check-stylesheets.py, check-goldens.py and other checkers pass. The documentation site build failed at the time on a parallel change to the Social component, so the site checks run once that change lands.

Open questions

  1. Does folio stay reserved?

Decision log

Date Change
2026-11-28 Drafted. Separates Ink and News as the written and the printed page; proposes Fangsong text and calligraphic display faces for Ink, and the gold-on-indigo and darkroom dark modes. The design specimen was made outside the repository and is not part of the site
2026-11-28 Font coverage corrected against the official font lists of Microsoft, Apple, AOSP, Ubuntu and Fedora
2026-11-28 Partly implemented in the theme; see the implementation record
2026-11-28 Calibrated after review: calligraphic display faces and the seal removed; Ink’s and News’s interface fonts unified with their text