Skip to content

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

Return to the regular view of this page

Components

Pick the component that fits what you are writing and look up its shortest syntax, its form and whether it loads a script.

Components are what a documentation page needs beyond paragraphs: a warning the reader must not skip, install commands for three platforms, a diagram, a chart, a terminal recording. Most of them are ordinary Markdown with one attribute line, so the source still reads cleanly on GitHub, and the theme turns it into the richer version when Hugo builds the site. Pick one from the table below; each component’s page opens with the shortest source and its result, then the variations, then every parameter. Component presentation shows the most common ones side by side in each visual preset.

Cheatsheet

Form says how you write it: native is Markdown syntax plus an attribute line, fence is a code fence with a language tag, shortcode is {{</* … */>}}. Runtime says whether the reader’s browser downloads a script for it: none, per page (only on pages that use it), or site switch (off until you enable it in hugo.yml, then per page).

Writing & structure

Component Use it for Shortest form Form Runtime
Callouts A prerequisite, warning or aside the reader must not miss > [!NOTE] native none
Code Blocks Commands and source with a filename, exact copy, folding and line links ```sh fence per page
Tabs The same instructions for several platforms or languages attribute {tab="Linux"} native + shortcode per page
Tables Comparisons and matrices, full-width, captioned or numbered {.full-width} native tabs or .expand only
Fields Parameter lists with type, required and default chips {.fields meta="type default"} native + shortcode none
Steps A procedure the reader carries out in order {.steps} native + shortcode none
Badge A one- or two-word status beside a name, such as Beta {{</* badge text="Beta" */>}} shortcode none
Kbd Key names and keyboard shortcuts {{</* kbd "Ctrl" "K" */>}} shortcode none
Includes Reuse a file, print a site parameter, keep a note out of the output {{</* include file="parts/x.md" */>}} shortcode none

Diagrams, charts & math

Component Use it for Shortest form Form Runtime
Mermaid Flowcharts, sequence diagrams and Gantt charts drawn from text ```mermaid fence per page
PlantUML UML diagrams, rendered in the browser or by your own server ```plantuml fence site switch
Draw.io Diagrams readers can open in the Draw.io editor; needs an editor address ![alt](arch.drawio.svg) native site switch
ECharts Bar, line and pie charts declared as data ```echarts fence per page
Infographic AntV infographics that show order, hierarchy or comparison ```infographic fence per page
Markmap A Markdown outline drawn as a mind map ```markmap fence site switch
FileTree A directory layout with an aligned comment beside each entry ```filetree fence per page
Math Inline and display formulas, rendered by KaTeX at build time $$ … $$ native none
Maps Places as a list, plus an interactive map when enabled ```map fence site switch

Media & showcase

Component Use it for Shortest form Form Runtime
Images Screenshots and figures with captions, sizing, zoom and numbering ![alt](oink.webp) native site switch
Gallery A set of images browsed in one shared zoom dialog ```gallery fence site switch
Video Video files, looping demos, YouTube and Bilibili cards ![name](demo.mp4) native per page; players need a site switch
Audio Podcast episodes and voice samples in a titled player ![name](episode.mp3) native per page
Asciinema Terminal sessions replayed as selectable text {{</* asciinema file="images/x.cast" */>}} shortcode per page
Social Quote a social post without contacting its platform > [!SOCIAL] Name `@handle` native none
Cards A few parallel destinations for the reader to choose from {.cards} native + shortcode none
Timeline Dated or ordered events on an axis {.timeline} on a definition list native none
Update Changelog entries that stay headings in the table of contents ## v1.7 {.update date="2026-11-28"} native none

A few entries in the Runtime column depend on what is on the page:

  • A code block loads code-block.js only when some block on the page has a copy or fold control. A file tree loads filetree.js only when it has a comment column, which the reader can resize by dragging.
  • Images and galleries share one zoom dialog. It needs params.ui.image_zoom: true and at least one image on the page that can be zoomed.
  • Math loads the KaTeX stylesheet and fonts but no script, because the formulas are already HTML and MathML when the page is built.
  • Draw.io loads only on pages with PNG or SVG images, and it downloads each distinct image once to look for an editable copy.
  • Video and audio share media.js, loaded on any page with a local audio or video player (the theme’s control row, with native controls left only without JavaScript, and one audible player at a time) or a card whose platform is in params.video_embeds. A map loads Leaflet only when params.map is enabled (enable: true with valid tiles and attribution); otherwise it stays a list of places.

No component loads a script in print, Markdown or RSS output. Each component page says what those outputs contain when it differs from what you would expect.

Two forms

Prefer the native form: a blockquote, list, table, image or fence, followed by a {…} attribute line. It stays readable on GitHub and in any Markdown editor, and the page’s Markdown output keeps your source instead of rendered HTML.

Shortcodes cover what Markdown cannot express, such as tabs that hold prose, parameter lists whose descriptions contain code blocks, cards with icons and badges, and terminal recordings. They follow the same rules everywhere:

  • Write every shortcode as {{</* name */>}}. Only {{%/* steps */%}} uses %, because its body is page-level Markdown with headings.
  • Child shortcodes (tab, card, field) work only inside their parent.
  • Parameters such as titles, labels and captions are plain text, not Markdown. Only bodies are Markdown: the bodies of tab, card and field, files pulled in by include, and the Book fig, tbl and eg bodies.
  • A wrong parameter never stops the build. Hugo prints a warning with the file and line, and the component falls back to the behavior its page documents or leaves the unsafe part out, so read the warnings before you publish. See When a value is wrong.

Site prerequisites

Components rely on three Goldmark settings. Hugo does not take markup settings from a theme, so they must be in your site’s own configuration. OINK Starter already has them; on a site you set up yourself, add:

hugo.yml
markup:
  goldmark:
    renderer:
      unsafe: true # keep HTML that content emits
    parser:
      attribute:
        block: true # enable {…} attribute lines
      wrapStandAloneImageWithinParagraph: false # standalone images are not wrapped in <p>
  • renderer.unsafe: true keeps raw HTML in the rendered content. Without it, Goldmark drops that HTML and markup inside component bodies disappears.
  • parser.attribute.block: true turns on attribute lines. Without it, {.steps} and {caption="…"} show up as literal text.
  • parser.wrapStandAloneImageWithinParagraph: false stops Goldmark from wrapping an image that stands alone in a <p>, which is what lets it become a captioned figure with an attribute line.

A few components need more. Math written with $$, \[…\] or \(…\) needs Goldmark’s passthrough extension. PlantUML, Markmap, Draw.io, the image zoom dialog, in-page video players and maps each have a site switch, and Draw.io also needs an editor address. Each component page shows its setting, and Configuration has the complete markup block.

1 - Callouts

Write notes, warnings, and collapsible asides with colors, icons, and titles. Use > [!NOTE] blockquotes without shortcodes.

A callout lifts out the one thing a reader must not miss: a prerequisite, a destructive command, a version limit. It is an ordinary blockquote whose first line is a [!TYPE] marker, the syntax GitHub and Obsidian use, so the same source renders as an alert on GitHub and as a plain quote in any other Markdown reader.

Use them sparingly. When every other paragraph sits in a box, readers stop seeing the boxes, so if a sentence of prose does the job, write the sentence.

Shortest form

Source
> [!NOTE]
> Hugo Modules need Go on the machine; an offline archive does not.
Note

Hugo Modules need Go on the machine; an offline archive does not.

Without a title, the callout shows its type name in the page’s language: “Note” in English, 「说明」 in Chinese.

Ten types

GitHub defines the first five types and OINK adds five more; each has its own icon and color, and type names are case-insensitive. Choose the type by what happens when the reader skips the box: NOTE and TIP are safe to skip, IMPORTANT means the task fails without it, WARNING and CAUTION mean something breaks or slows down, and DANGER marks what cannot be undone.

Source
> [!TIP]
> `hugo server -D` previews drafts.

> [!IMPORTANT]
> Enable Goldmark block attributes in `hugo.yml`, or component attribute lines render as plain text.

> [!WARNING]
> `hugo --cleanDestinationDir` empties `public/`.

> [!CAUTION]
> The first build after deleting `resources/_gen` is much slower.

> [!SUCCESS]
> All 312 pages built; the site is ready to deploy.

> [!DANGER]
> `rm -rf public/` before a deploy also deletes files you placed there by hand.

> [!QUESTION]
> Should the site have comments? See [enabling comments](/docs/admin/comments/).

> [!EXAMPLE]
> `pgsty.com` is a documentation site built from callouts and tables alone.

> [!QUOTE]
> Documentation is a love letter that you write to your future self.
Tip

hugo server -D previews drafts.

Important

Enable Goldmark block attributes in hugo.yml, or component attribute lines render as plain text.

Warning

hugo --cleanDestinationDir empties public/.

Caution

The first build after deleting resources/_gen is much slower.

Success

All 312 pages built; the site is ready to deploy.

Danger

rm -rf public/ before a deploy also deletes files you placed there by hand.

Question

Should the site have comments? See enabling comments.

Example

pgsty.com is a documentation site built from callouts and tables alone.

Quote

Documentation is a love letter that you write to your future self.

Custom title

Text after the marker on the same line becomes the title, and it may contain inline code, bold text and links.

Source
> [!WARNING] Rewrites `public/`
> Check that `baseURL` points at the production domain before a production
> build, or every absolute link will be wrong.
Rewrites public/

Check that baseURL points at the production domain before a production build, or every absolute link will be wrong.

Body content

The body is ordinary Markdown: lists, fenced code, tables, images, even another callout. Every line starts with >, fence lines included.

Source
> [!TIP] Three commands to a live preview
>
> 1. Clone: `git clone https://github.com/pgsty/oink-starter my-docs`
> 2. Enter the directory and preview:
>    ```bash
>    cd my-docs && hugo server
>    ```
> 3. Open <http://localhost:1313/>
>
> | Port | Purpose |
> | --- | --- |
> | 1313 | Hugo development server |
Three commands to a live preview
  1. Clone: git clone https://github.com/pgsty/oink-starter my-docs
  2. Enter the directory and preview:
    cd my-docs && hugo server
  3. Open http://localhost:1313/
Port Purpose
1313 Hugo development server

Collapsing

Put - after the type to render the callout closed, or + to render it open with a toggle. Either way it is a native <details> element that works without JavaScript. Fold what most readers can skip: full command output, an alternative procedure, background reading.

Source
> [!NOTE]- Why is Go needed?
> Hugo downloads themes through Go's module system (`hugo mod get`). A submodule
> or an offline archive works without Go installed.

> [!TIP]+ Open by default, but the reader can close it
> The closed state is not remembered; a reload returns to the default.
Why is Go needed?

Hugo downloads themes through Go’s module system (hugo mod get). A submodule or an offline archive works without Go installed.

Open by default, but the reader can close it

The closed state is not remembered; a reload returns to the default.

The neutral disclosure, DETAILS

[!DETAILS] is a disclosure with no color and no icon, closed unless you write [!DETAILS]+. Use it when the content is neither a note nor a warning, just long: a complete configuration file, a full log, or an audio transcript placed right after a player.

Source
> [!DETAILS] Full `hugo version` output
> ```text
> hugo v0.170.1+withdeploy darwin/arm64
> ```
Full hugo version output
hugo v0.170.1+withdeploy darwin/arm64

Custom icon

To replace the type’s icon, put {icon="fa-solid fa-…"} (one Font Awesome class pair) on the line right after the blockquote, with no blank line between them.

Source
> [!TIP] PostgreSQL 18 is supported
> Pigsty v4 installs PostgreSQL 18 by default.
{icon="fa-solid fa-database"}
PostgreSQL 18 is supported

Pigsty v4 installs PostgreSQL 18 by default.

Nesting

Add one > per level. One level is usually enough; deeper nesting is hard to read.

Source
> [!WARNING] Back up before upgrading
> A theme version bump can change how a page renders.
>
> > [!TIP]- How to back up
> > `git tag pre-upgrade` is enough — rolling back is `git checkout pre-upgrade`.
Back up before upgrading

A theme version bump can change how a page renders.

How to back up

git tag pre-upgrade is enough — rolling back is git checkout pre-upgrade.

Unknown types and common slips

A misspelled type does not break the build or lose content. The block renders as a plain blockquote with the marker still visible, so the typo is easy to spot.

Source
> [!NOTICE] Not a valid type
> The marker stays on the page to tell you so.

[!NOTICE] Not a valid type

The marker stays on the page to tell you so.

Formatters such as Prettier cause the other two common slips:

  • They join the title line and the body. Keep an empty > line under the title.
  • They move attribute lines such as {icon=…}. Wrap the callout in <!-- prettier-ignore-start --> and <!-- prettier-ignore-end -->.

Output

Callouts load no script. Print and RSS show every callout expanded, and the page’s Markdown output keeps the original blockquote, marker and title included.

Parameter reference

The marker line > [!TYPE]± Title:

TYPE , enum , default—
NOTE TIP IMPORTANT WARNING CAUTION SUCCESS DANGER QUESTION EXAMPLE QUOTE DETAILS; case-insensitive; an unknown value renders as a plain blockquote
± , - / + / none , defaultnone
- collapses closed, + collapses open; bare DETAILS is closed
Title , inline Markdown , defaultthe localized type name
On the same line as the marker

The attribute line {…}, immediately after the blockquote:

icon , Font Awesome class pair , defaultthe type’s icon
For example fa-solid fa-database; DETAILS has no default icon
class , space-separated classes , default—
Validated class tokens for site CSS; data-* and aria-* pass through

Any other key, style included, is dropped with a build warning. Hugo strips on* handlers before the theme sees them, so they are dropped silently.

Limits

  • The type sets the color; there is no color parameter. When no type fits, take the closest one and let the title carry the meaning.
  • A reader’s open or closed choice is not remembered after a reload.
  • Inside a {.steps} item, indent every > line to the item’s text; inside a {{%/* steps */%}} step, write it unindented. See Steps.
  • Social — > [!SOCIAL] callouts for offline quoted social posts
  • Steps — callouts inside a procedure
  • Tabs — the same note split per platform
  • Writing pages — when to use a callout and when to use prose

2 - Code Blocks

Show commands, configuration and source code in a Markdown fence with a filename, exact copying, line numbers, highlighting, wrapping, folding and linkable lines.

Commands, configuration files and source code go in an ordinary Markdown fence. Hugo’s built-in Chroma highlighter colors it while the site builds, so the page ships highlighted HTML and the browser runs no highlighter. Attributes on the fence’s opening line add what readers of technical docs rely on: a filename above the code, a copy button that copies exactly the right text, line numbers, folding for long files, and links to individual lines. Fences for diagrams and data, such as mermaid, echarts and filetree, are separate components with their own pages.

Shortest form

Source
```sql
SELECT datname, numbackends FROM pg_stat_database ORDER BY numbackends DESC;
```
SELECT datname, numbackends FROM pg_stat_database ORDER BY numbackends DESC;

Every fence gets the full frame and a copy button, even without attributes; a block without a title simply has no title bar. The copy button sits at the top right and appears when the pointer is over the block or focus is inside it, and on touch screens it is always visible. The language is not displayed, but site CSS can read it from the block’s data-td-language attribute.

The language tag is a Chroma lexer name, and Chroma has a lexer for most languages and file formats. A diff fence, for example, shows added and removed lines in their own colors, with no extra component:

Source
```diff {title="a change to hugo.yml"}
 params:
   ui:
-    sidebar_menu_compact: true
+    sidebar_menu_compact: false
     sidebar_menu_foldable: true
```
a change to hugo.yml
 params:
   ui:
-    sidebar_menu_compact: true
+    sidebar_menu_compact: false
     sidebar_menu_foldable: true

Filename titles

title adds a title bar above the code, usually the file’s name or path, so readers know where the snippet belongs. It also becomes the block’s accessible name.

Source
```yaml {title="hugo.yml"}
markup:
  goldmark:
    parser:
      attribute:
        block: true
    renderer:
      unsafe: true
```
hugo.yml
markup:
  goldmark:
    parser:
      attribute:
        block: true
    renderer:
      unsafe: true

filename is an alias for title. If a fence has both, the build warns and uses filename.

Line numbers, start line and highlighting

lineNos="inline" puts line numbers in the code column, and lineNoStart sets the first number, which helps when the snippet is an excerpt of a longer file. hl_lines highlights the lines you want the reader to look at. It counts the lines inside the fence from 1, whatever lineNoStart says.

Source
```ini {title="postgresql.conf" lineNos="inline" lineNoStart=120 hl_lines="2 4-5"}
shared_buffers = 8GB
max_connections = 200
work_mem = 64MB
wal_level = replica
max_wal_senders = 10
```
postgresql.conf
120shared_buffers = 8GB
121max_connections = 200
122work_mem = 64MB
123wal_level = replica
124max_wal_senders = 10

lineNos="table" puts the numbers in a column of their own, so a reader who selects the code by hand does not pick up the numbers. The copy button leaves them out in both modes.

Source
```bash {title="deployment in three commands" lineNos="table"}
./configure -c rich
./install.yml
pig ext install pg_duckdb
```
deployment in three commands
1
2
3
./configure -c rich
./install.yml
pig ext install pg_duckdb

Hugo’s other highlighting options, such as tabWidth for the number of spaces a tab expands to, pass straight through to Chroma. style has no effect by default: OINK highlights with CSS classes so that code colors follow light and dark mode, and a Chroma style applies only after you switch to inline styles with params.highlight_classes: false.

Wrapping long lines

Long lines scroll sideways by default. wrap=true wraps them on screen instead, which suits long URLs and checksums; the source and the copied text keep their original lines.

Source
```text {title="config/artifacts.env" wrap=true}
ARTIFACT_URL=https://repo.pigsty.io/pkg/infra/v3.6.0/infra-pkg-v3.6.0.el9.x86_64.tgz
CHECKSUM=sha256:6d3dce4f7acb18f586469adcb80ab35f3e859f9837786e151cfbc2b3c0f587b2
```
config/artifacts.env
ARTIFACT_URL=https://repo.pigsty.io/pkg/infra/v3.6.0/infra-pkg-v3.6.0.el9.x86_64.tgz
CHECKSUM=sha256:6d3dce4f7acb18f586469adcb80ab35f3e859f9837786e151cfbc2b3c0f587b2

Wrapping does not combine with lineNos="table", because a wrapped line would no longer line up with its number in the separate column. With both, the build warns and turns wrapping off; use lineNos="inline" if you need both.

Folding long code

collapse=N shows the first N lines with a “Show all M lines” button under them, where M is the block’s total line count, so a complete configuration file does not push the explanation off the screen.

Source
```yaml {title="hugo.yml" collapse=8}
baseURL: https://oink.pgsty.com/
title: OINK
defaultContentLanguage: en
languages:
  en:
    languageName: English
    weight: 1
  zh:
    languageName: 简体中文
    weight: 2
params:
  offline_search: true
  ui:
    sidebar_menu_foldable: true
```
hugo.yml
baseURL: https://oink.pgsty.com/
title: OINK
defaultContentLanguage: en
languages:
  en:
    languageName: English
    weight: 1
  zh:
    languageName: 简体中文
    weight: 2
params:
  offline_search: true
  ui:
    sidebar_menu_foldable: true

Folding only hides lines on screen. The page contains the whole file, so it is complete without JavaScript, for screen readers and on paper. A block no longer than N lines gets no button. Folding works together with wrapping and never cuts a wrapped line in half.

What gets copied

The copy button copies the whole block, except for terminal sessions. In a console or shell-session fence it copies only the commands: it keeps the lines that start with a prompt, strips the prompt, and drops the output. The block below copies two commands, without $ and without the output lines:

Source
```console
$ pig ext list duckdb
name       version  category
pg_duckdb  1.0.0    OLAP
$ pig ext install pg_duckdb
INFO installing pg_duckdb
```
$ pig ext list duckdb
name       version  category
pg_duckdb  1.0.0    OLAP
$ pig ext install pg_duckdb
INFO installing pg_duckdb

Write copy="all" to copy prompts and output as well. Other lexers such as bash or sh cannot tell a prompt from a command or its output, so on them copy="command" warns and copies everything. When a command continues over several lines, start each continuation line with its prompt, usually >; otherwise it counts as output and is left out.

A session block with no prompt at all cannot be copied: the button shows an error icon and logs an error to the browser console, and the clipboard keeps its previous content rather than receiving the whole block.

copy=false removes the button, for a counter-example that nobody should paste:

Source
```yaml {title="counter-example: an invalid boolean" copy=false}
params:
  ui:
    image_zoom: sometimes   # wrong: use true or false
```
counter-example: an invalid boolean
params:
  ui:
    image_zoom: sometimes   # wrong: use true or false

params.ui.code_copy: false removes the button from every block that does not set copy itself (see Configuration). The button is an icon only; it changes icon and announces a localized status on success or failure. Copied text keeps indentation, blank lines and Unicode, leaves out line numbers, and ends with exactly one newline.

One-line commands

A single command the reader is meant to paste can be a compact command strip with its copy button in a column of its own: add {class="td-code-command"} to a one-line fence. A block with more than one line, line numbers or collapse warns and keeps the regular frame. See Component presentation for examples.

To link to “line 4” from your text, give the fence an id and set anchorLineNos=true. Each line number then becomes a link to #<id>-<line>:

Source
```sql {id="ex-explain" title="explain.sql" lineNos="table" anchorLineNos=true}
EXPLAIN (ANALYZE, BUFFERS)
SELECT relname, n_live_tup
FROM pg_stat_user_tables
WHERE n_live_tup > 1000
ORDER BY n_live_tup DESC;
```

Jump to [line 4](#ex-explain-4).
explain.sql
1
2
3
4
5
EXPLAIN (ANALYZE, BUFFERS)
SELECT relname, n_live_tup
FROM pg_stat_user_tables
WHERE n_live_tup > 1000
ORDER BY n_live_tup DESC;

Jump to line 4.

Write the id yourself whenever you plan to share a link. Without one, the theme generates an ID that is unique on the page but depends on the fence’s position, so adding a fence above it changes the ID and breaks old links. An id must not contain spaces or control characters, and must not repeat another ID on the page. An empty or invalid id warns and is replaced by a generated one; a duplicate id warns but is not renamed.

Numbered examples

In a book or a long manual, num and caption turn a fence into a numbered example that xref can refer to and that appears in the book’s list of examples. You write the number yourself; the theme never counts. The anchor defaults to eg-<num>.

Source
```sql {num="4-1" caption="Bloat ratio per table" #eg-bloat}
SELECT schemaname, relname, n_dead_tup, n_live_tup
FROM pg_stat_user_tables
WHERE n_dead_tup > n_live_tup * 0.2;
```

See {{< xref eg="4-1" anchor="eg-bloat" >}}.
Example 4-1 Bloat ratio per table
SELECT schemaname, relname, n_dead_tup, n_live_tup
FROM pg_stat_user_tables
WHERE n_dead_tup > n_live_tup * 0.2;

See Example 4-1.

num and caption go together: a caption without a number, or a number without a caption, warns and is dropped. A numbered example cannot also be a tab, so num with tab warns and ignores tab. Numbering for figures, tables and equations is covered in Publishing books.

A set of fences as tabs

Consecutive fences that each have a tab attribute become one tab set, which suits the same command for different package managers. A group on the first fence lets readers share a link to a tab, keeps groups with the same name in sync, and remembers the reader’s choice.

Source
```bash {tab="Homebrew" group="oink-install" value="brew"}
brew install hugo
```
```bash {tab="APT" value="apt"}
sudo apt install hugo
```
Homebrew
brew install hugo
APT
sudo apt install hugo

Tabs has the group syntax, URL hashes, synchronization and tabs that hold prose.

Common errors

  • A shortcode inside a fence still runs. A fence does not stop Hugo from parsing shortcodes, so writing {{< tabs >}} in a code block executes it. To show a shortcode as text, put a comment marker inside each delimiter: {{</* tabs */>}}, or {{%/* steps */%}} for the percent form. Every shortcode shown on this page is written that way.
  • Fences inside fences need a longer outer fence: four backticks outside, three inside, as in every “Source” block on this page. Add another backtick when the inner block contains fences of its own.
  • Attributes go on the opening line, after the language. Tables and images take their attribute line below the block, fences do not; a {…} line under a fence shows up as text.
  • Fences in list items must be indented to the item’s text (three spaces after 1.), or the fence ends the list.

Output

The copy and fold buttons appear only once the page script is running, and a page with no copy or fold control does not load that script at all. Print shows every block in full, without buttons and with its title bar, and long blocks may break across pages. The page’s Markdown output keeps each fence as written, attributes included.

Parameter reference

OINK’s attributes, inside the {…} after the language on the opening line:

title , non-empty string , defaultnone
The visible title bar (usually a filename) and the accessible name
filename , non-empty string , defaultnone
Alias of title; both together warn and use filename
copy , all command true false , defaultcommand for session lexers, all otherwise
true is all; command is allowed only on console/shell-session
wrap , boolean , defaultfalse
Visual wrapping, source unchanged; mutually exclusive with table line numbers
collapse , positive integer , defaultnone
Lines shown initially; ignored when the block is shorter
label , non-empty string , defaultderived from the title
Accessible name, not displayed; mutually exclusive with aria-label
id , non-empty token , defaultgenerated
Stable block ID and line-anchor prefix; no whitespace
tab , non-empty string , defaultnone
Tab label, see Tabs; mutually exclusive with num
group , ^[a-z][a-z0-9_-]*$ , defaultnone
On the first fence of a set; enables hash / sync / persistence; requires tab
value , ^[a-z0-9][a-z0-9_-]*$ , defaultnone
Required on every block of a grouped set; ungrouped it only names the panel; requires tab
num , [0-9A-Za-z.-]+ , defaultnone
Numbered example (Book eg); must appear with caption
caption , plain text , defaultnone
The numbered example’s caption; must appear with num
class , class list , defaultnone
Appended to the .td-code root element; td-code-command makes a command strip
data-* / aria-* / role , string , defaultnone
Passed through to the root element

title, filename and label already give the block an accessible name and role="group", so aria-label, aria-labelledby or role next to any of them warns and is ignored; those three pass through only on a block with neither a title nor a label. Unknown, unsafe and theme-reserved attributes warn and are ignored, and the warning lists the allowed names.

The same line also takes Chroma’s options, which the theme hands to Hugo unchanged:

lineNos , false inline table , defaultfalse
Line-number style; table is mutually exclusive with wrap=true
lineNoStart , positive integer , default1
First displayed number; does not affect how hl_lines counts
hl_lines , lines and ranges , defaultnone
For example "2 4-5", counted over the source lines in the fence
anchorLineNos , boolean , defaultfalse
Line numbers become anchor links prefixed with the block’s id
tabWidth , positive integer , defaultHugo’s default
Spaces a tab expands to

Limits

  • Chroma is the only highlighter. There is no Shiki, Twoslash, in-browser highlighting or runnable playground; for patches, use a diff fence.
  • copy="command" works only with the console and shell-session lexers; anywhere else it warns and copies everything.
  • A generated ID is not a permanent link. Write id for any line or block you link to from elsewhere.
  • mermaid, math, chem, markmap, plantuml, echarts, infographic, checksums, filetree, gallery and map fences are not code blocks. Each renders as its own component, without the code frame or copy button.
  • Tabs — the full rules for assembling adjacent fences
  • Include — pull a real file from the repository in as a code block
  • Publishing books — numbered examples, cross references, the list of examples
  • Print — what long code looks like on paper

3 - Tabs

Put equivalent alternatives such as package managers or config formats side by side, and let one reader choice follow them across every page.

Tabs put equivalent alternatives side by side, such as package managers, operating systems, YAML / TOML / JSON, or an environment variable and its configuration key, so each reader sees the one that applies to them. Do not use them for ordered steps or unrelated content: a reader sees one panel at a time and may never open the others.

There are two forms with the same runtime, markup and keyboard behavior. The common one is a tab attribute on adjacent code fences (as well as filetree, gallery and map data fences) or tables. When a panel needs prose, lists or callouts, use the tabs/tab shortcodes.

Shortest form

Write two fences with tab, separated by nothing but a blank line.

Source
```bash {tab="Homebrew"}
brew install hugo
```
```bash {tab="Debian / Ubuntu"}
sudo apt install hugo
```
Homebrew
brew install hugo
Debian / Ubuntu
sudo apt install hugo

The page itself contains two complete code blocks, each titled with its label, and the browser joins adjacent blocks into a tab set once the page loads. On GitHub, on paper and without JavaScript, readers see both blocks one after the other, so nothing is ever hidden from them.

Groups: links, sync and memory

Add group to the first block, and a value to every block of the set. The set then gets a shareable URL hash #<group>-<value>, stays in step with other sets of the same group, and remembers the reader’s choice.

Source
```bash {tab="npm" group="pkgmgr" value="npm"}
npm create hugo-site@latest
```
```bash {tab="pnpm" value="pnpm"}
pnpm create hugo-site
```
```bash {tab="Yarn" value="yarn"}
yarn create hugo-site
```
npm
npm create hugo-site@latest
pnpm
pnpm create hugo-site
Yarn
yarn create hugo-site

tab is the label people read and value is the identifier in URLs and storage, matching ^[a-z0-9][a-z0-9_-]*$, so you can reword a label without breaking links. The pnpm panel above is #pkgmgr-pnpm: open this page with that hash and it is selected.

Groups move together

The set below uses the same group="pkgmgr", so choosing a package manager in either set switches the other. The choice is saved in localStorage under td-tabs:v1:pkgmgr and applies to every pkgmgr set on every page of the site: a reader who picks pnpm once sees pnpm everywhere.

Source
```bash {tab="npm" group="pkgmgr" value="npm"}
npm run build
```
```bash {tab="pnpm" value="pnpm"}
pnpm build
```
npm
npm run build
pnpm
pnpm build

This set has no yarn panel. When the group switches to a value a set lacks, that set keeps its current panel, so a set always shows something. On load, a set takes the first of these that it can use: the URL hash, the stored choice, the shortcode’s default or the first block, the first tab. A hash selects a panel without overwriting the reader’s stored choice.

Tables can be tabs too

The same attributes on table attribute lines join adjacent tables into a set.

Source
| Parameter | Default |
| --- | --- |
| `shared_buffers` | 25% RAM |
| `max_connections` | 100 |
{tab="PostgreSQL 18" group="pgver" value="pg18"}

| Parameter | Default |
| --- | --- |
| `shared_buffers` | 128MB |
| `max_connections` | 100 |
{tab="PostgreSQL 13" value="pg13"}
PostgreSQL 18
Parameter Default
shared_buffers 25% RAM
max_connections 100
PostgreSQL 13
Parameter Default
shared_buffers 128MB
max_connections 100

A set holds only fences or only tables; an adjacent fence and table stay separate. To mix them, use the shortcode form.

A label and a filename together

A fence can carry both tab and title: the label goes in the tab bar and the filename stays in the title bar inside the panel.

Source
```yaml {tab="YAML" title="hugo.yml" group="conffmt" value="yaml"}
params:
  ui:
    sidebar_menu_foldable: true
```
```toml {tab="TOML" title="hugo.toml" value="toml"}
[params.ui]
sidebar_menu_foldable = true
```
YAML
hugo.yml
params:
  ui:
    sidebar_menu_foldable: true
TOML
hugo.toml
[params.ui]
sidebar_menu_foldable = true

A lone block is just a titled block

A set needs at least two adjacent blocks of the same kind. A single block with tab keeps the label as its title instead of growing a one-tab bar.

Source
```ini {tab="on its own"}
listen_addresses = '*'
```
on its own
listen_addresses = '*'

Only blank lines may come between the blocks of a set. Anything else ends it: a paragraph, heading or list, an HTML comment (often a stray <!-- prettier-ignore-end -->), or a block that declares its own group, which starts a new set.

Tabs around running text

When a panel needs paragraphs, lists, callouts or several blocks, use the tabs/tab shortcodes. Each tab body is full Markdown.

Source
{{< tabs group="deploy" default="pages" label="Deployment target" >}}
{{< tab label="GitHub Pages" value="pages" >}}
The repository ships `.github/workflows/`; a push to `main` builds and publishes.

> [!NOTE]
> `baseURL` has to be the repository's Pages address.
{{< /tab >}}
{{< tab label="Cloudflare Pages" value="cloudflare" >}}
Connect the repository in the Cloudflare dashboard; the build command is:

```bash
hugo --gc --minify
```
{{< /tab >}}
{{< /tabs >}}

The repository ships .github/workflows/; a push to main builds and publishes.

Note

baseURL has to be the repository’s Pages address.

Connect the repository in the Cloudflare dashboard; the build command is:

hugo --gc --minify

default picks the initial panel; it must match a child’s value and needs group. Without group, the theme numbers the tabs tab1, tab2 … itself, so a value is ignored with a warning, and the set switches locally without touching the URL or storage.

The shortcode form checks the whole set at build time. The attribute form checks each block’s own attributes at build time, but blocks only become a set in the browser, so problems of the set as a whole, such as a later block without value or two blocks with the same value, show up as warnings in the browser console.

Output

Only pages that use tabs load tabs.js. Until it runs, and in print, RSS and browsers without JavaScript, every panel is visible as a titled section with no tab bar. In the Markdown output the fence form keeps its source fences, {tab=} included, and each shortcode tab becomes its label in bold followed by its body.

Parameter reference

Attributes on a fence info line or a table attribute line:

tab , non-empty string , defaultnone
The visible label; on a lone block it is simply that block’s title
group , ^[a-z][a-z0-9_-]*$ , defaultnone
On the first block of a set only; enables the hash, in-page sync and persistence; requires tab
value , ^[a-z0-9][a-z0-9_-]*$ , defaultnone
Required on every block of a grouped set; ungrouped it only names the panel; requires tab

The tabs shortcode:

group , ^[a-z][a-z0-9_-]*$ , defaultnone
As above: hash, sync and persistence
default , a child’s value , defaultthe first child
The initially selected panel; requires group
label , plain text , defaultlocalized “Tabs”
Accessible name of the tab bar; not displayed

The tab shortcode:

label , plain text , required
The visible label
value , ^[a-z0-9][a-z0-9_-]*$ , required
Forbidden without a group, where tab1, tab2 … are generated

In a group, a panel’s ID is <group>-<value>. When the same group appears twice on one page, later sets get -2, -3 … suffixes and a deep link goes to the first set; ungrouped sets get generated IDs. The storage key is td-tabs:v1:<group>. A click or key press updates the hash with replaceState and writes storage, while arriving with a hash only changes the selection. Left and Right (mirrored on right-to-left pages), Home and End move to a tab and select it, and focus stays on the tab.

Limits

  • Invalid input warns and falls back to something safe, and build warnings name the source position. Unusable group, value or default settings are dropped, stray content inside tabs is ignored, a repeated shortcode value keeps both tabs, and a tabs without children renders nothing.
  • An attribute-form set in which some block lacks a usable value loses its group and switches locally; the theme never invents a value for a group. Adjacent blocks that repeat a value stay separate titled blocks.
  • A set holds only fences or only tables. Use the shortcodes to mix prose and code.
  • Tabs are not a way to fold content away. To collapse long output, use > [!DETAILS]; see Callouts.
  • group names are shared across the site, so picking pnpm on one page also picks it in every pkgmgr set on other pages. Name groups by meaning, such as pkgmgr or os, never tabs1.
  • Code blocks — the rest of the fence attributes (title, copy, line numbers, folding)
  • Tables — the rest of the table attribute line
  • Callouts — for folding rather than juxtaposing
  • Steps — tabs inside a procedure

4 - Tables

Turn an ordinary Markdown table into a captioned table, a compatibility matrix, a field list, a numbered book table or a tab set, and give wide technical tables room to read.

Tables are ordinary GFM pipe tables, so they read the same on GitHub and in any editor. OINK adds what long technical tables need: a wide table scrolls inside its own box instead of stretching the page, and one attribute line under the table turns it into a captioned table, a support matrix, a field list, a numbered book table or one panel of a tab set.

GFM has no merged cells, sorting or filtering, and OINK does not add them. Data that needs merged headers usually reads better as two tables or a matrix, and a cell that needs paragraphs or a list belongs in a field list.

Shortest form

A table without an attribute line renders as an ordinary table. The delimiter row sets each column’s alignment, and header cells become th scope="col".

Source
| Component | Port | Purpose |
| --- | :---: | --- |
| PostgreSQL | 5432 | Database |
| Pgbouncer | 6432 | Connection pool |
| Patroni | 8008 | High-availability orchestration |
Component Port Purpose
PostgreSQL 5432 Database
Pgbouncer 6432 Connection pool
Patroni 8008 High-availability orchestration

Wide tables scroll themselves

A table wider than the reading column scrolls sideways inside its own region, so the rest of the page keeps its width on a phone. Keyboard users reach the region with Tab and scroll it with the arrow keys; screen readers announce it as “Scrollable table” in the page’s language.

Source
| Cluster | Role | Version | State | Lag | Connections | Size | Backup |
| --- | --- | --- | --- | --- | --- | --- | --- |
| pg-meta | primary | 18.1 | running | — | 42 | 12 GB | 2026-08-17 |
| pg-test | replica | 18.1 | streaming | 12 ms | 8 | 12 GB | 2026-08-17 |
Cluster Role Version State Lag Connections Size Backup
pg-meta primary 18.1 running — 42 12 GB 2026-08-17
pg-test replica 18.1 streaming 12 ms 8 12 GB 2026-08-17

Captions

{caption="…"} adds a visible <caption> in plain text. It does not number the table; for “Table 9-1” use num.

Source
| Setting | Value |
| --- | --- |
| Port | 5432 |
| Data directory | `/var/lib/pgsql/18/data` |
| License | PostgreSQL License |
{caption="PostgreSQL defaults on a fresh EL 9 node"}
PostgreSQL defaults on a fresh EL 9 node
Setting Value
Port 5432
Data directory /var/lib/pgsql/18/data
License PostgreSQL License

Compatibility matrices

{.matrix} is for “what supports what” grids. The first column becomes a row header (th scope="row"), and the header row and first column stay pinned while the reader scrolls in either direction, so a cell deep in a large matrix still shows its row and column. Cells are centered unless the delimiter row sets another alignment. The ✅ and ❌ are ordinary characters you type; the theme gives them no meaning.

Source
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
| --- | :---: | :---: | :---: | :---: | :---: |
| EL 9 | ✅ | ✅ | ✅ | ✅ | ✅ |
| EL 8 | ✅ | ✅ | ✅ | ✅ | ✅ |
| Debian 13 | ✅ | ✅ | ✅ | ❌ | ❌ |
| Ubuntu 24.04 | ✅ | ✅ | ✅ | ✅ | ❌ |
{.matrix}
OS / PG PG18 PG17 PG16 PG15 PG14
EL 9 ✅ ✅ ✅ ✅ ✅
EL 8 ✅ ✅ ✅ ✅ ✅
Debian 13 ✅ ✅ ✅ ❌ ❌
Ubuntu 24.04 ✅ ✅ ✅ ✅ ❌

Using the whole canvas

{.full-width} lets the table leave the reading column and take the article’s full width. Use it for many short columns that would otherwise scroll.

Source
| Language | Code | Sidebar | Search | TOC | Print | Status |
| --- | --- | --- | --- | --- | --- | --- |
| 简体中文 | `zh` | ✅ | ✅ | ✅ | ✅ | Reviewed |
| English | `en` | ✅ | ✅ | ✅ | ✅ | Reviewed |
{.full-width}
Language Code Sidebar Search TOC Print Status
简体中文 zh ✅ ✅ ✅ ✅ Reviewed
English en ✅ ✅ ✅ ✅ Reviewed

Technical wide tables

Squeezed into the reading column, a table of configuration keys or environment variables breaks identifiers in odd places and grows very tall rows. .wide lets the table take its natural width (width: max-content) and scroll sideways when that is wider than the page. Cells break only between words (overflow-wrap: break-word, word-break: normal), and body cells have a soft max-width: 40ch, so a long description wraps into a readable column instead of one enormous line. A very long token can still wrap; the bound is not a fixed column width.

Source
| Variable | Required | Default | Configuration key | Description |
| --- | --- | --- | --- | --- |
| `HG_PD_GRPC_HOST` | Yes | None | `grpc.host` | Advertised gRPC hostname/IP; use container hostnames within a container network. |
| `HG_PD_INITIAL_STORE_COUNT` | No | `1` | `pd.initial-store-count` | Minimum Store count needed for cluster availability. |
| `HG_PD_ACTUATOR_EXPOSURE` | No | `health,metrics,prometheus` | `management.endpoints.web.exposure.include` | Public Actuator endpoint allowlist; `*` is forbidden. |
{.wide .expand}
Variable Required Default Configuration key Description
HG_PD_GRPC_HOST Yes None grpc.host Advertised gRPC hostname/IP; use container hostnames within a container network.
HG_PD_INITIAL_STORE_COUNT No 1 pd.initial-store-count Minimum Store count needed for cluster availability.
HG_PD_ACTUATOR_EXPOSURE No health,metrics,prometheus management.endpoints.web.exposure.include Public Actuator endpoint allowlist; * is forbidden.

.wide and .full-width solve different problems and combine as {.full-width .wide}. .full-width widens the box the table sits in, which suits many short columns; .wide changes how the table inside sizes its columns, which suits long identifiers. .wide applies on screen only: print and RSS keep the ordinary layout, and it has no effect on .fields. The older .td-table--wide class still works as a synonym.

Expand selected tables

.expand puts a small expand icon at the table’s top-right corner. It appears on hover or keyboard focus on desktop and stays visible on touch screens. One click opens the table in a dialog that fills the window, with the same text size, links and text selection; Close or Escape puts it back at the same reading position. On a narrow screen a wide table still scrolls sideways inside the dialog. Most examples on this page carry .expand, so you can try it on them.

Source
| Package | Version | Role |
| --- | --- | --- |
| `pgvector` | `0.8.1` | Vector similarity search |
| `pg_stat_statements` | `1.11` | Statement statistics |
{.wide .expand}
Example extension packages
Package Version Role
pgvector 0.8.1 Vector similarity search
pg_stat_statements 1.11 Statement statistics

Add it only to the few tables that need more room: there is no size threshold and no site-wide switch, because an icon on every table is noise. .expand works alone or with .wide, .full-width, .matrix, a caption, a number or a tab. Several classes can be written either way, {.wide .expand} or {class="wide expand"}.

Only pages with an .expand table load the small reader script. Without JavaScript or native <dialog> support, the reader sees the complete table inline and no dead button. Printing first returns an open table to the article. A table whose headers, aria-labelledby or aria-describedby points at something outside the table stays inline, because the dialog would cut those references. If your site CSS styles tables through an article ancestor, check how such a table looks inside the dialog.

Field lists

{.fields} renders the table as a definition list: the first column is the name, the last is the description, and the columns between are metadata. It is the form for configuration keys, command flags and API fields. See Fields for everything it can do.

Source
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `offline_search` | boolean | `false` | Build the local search index |
| `page_width` | string | `normal` | Width of the reading column |
{.fields meta="type default"}
offline_search , boolean , defaultfalse
Build the local search index
page_width , string , defaultnormal
Width of the reading column

Numbered tables

Books and long manuals refer to tables by number. Add num, with an optional #id and caption: the table is wrapped in a <figure> labeled “Table N.” in the page’s language, xref can link to it, and it appears in the book’s list of tables. You choose the numbers; the theme does not count. The id defaults to tbl-<num>.

Source
| Isolation level | Dirty read | Non-repeatable read | Phantom read |
| --- | --- | --- | --- |
| Read committed | no | yes | yes |
| Repeatable read | no | no | yes |
| Serializable | no | no | no |
{#tbl-iso num="9-1" caption="Anomalies each PostgreSQL isolation level permits"}

See {{< xref tbl="9-1" anchor="tbl-iso" >}}.
Isolation level Dirty read Non-repeatable read Phantom read
Read committed no yes yes
Repeatable read no no yes
Serializable no no no
Table 9-1 Anomalies each PostgreSQL isolation level permits

See Table 9-1.

Tables as tabs

Adjacent tables with {tab="…"} become one tab set, by the same rules as adjacent code fences. A group on the first table adds a shareable URL hash, syncing and a remembered choice, and then every table needs a value. See Tabs for the full rules. Even two short columns fill the panel. A wide table scrolls within it.

Source
| Directory | Contents |
| --- | --- |
| `content/` | Pages |
| `data/` | Landing and release data |
{tab="Content" group="repo-layout" value="content"}

| Directory | Contents |
| --- | --- |
| `assets/` | CSS and image resources |
| `static/` | Files copied verbatim |
{tab="Assets" value="assets"}
Content
Directory Contents
content/ Pages
data/ Landing and release data
Assets
Directory Contents
assets/ CSS and image resources
static/ Files copied verbatim

Output

In HTML each table sits in a focusable <div class="td-table-scroll">; .matrix and .full-width add modifier classes to that wrapper, while your own classes stay on the <table>. Ordinary tables load no script. Print and RSS show the complete static table, with no reader and no tab bar, and the Markdown output keeps the table and its attribute line as written.

Parameter reference

The attribute line on the row below the table:

.full-width , marker , defaultnone
Leaves the reading column and uses the article’s full width
.wide , marker , defaultnone
Sizes the inner table to max-content; for long technical identifiers
.expand , marker , defaultnone
Adds a corner action that opens the table in a larger dialog
.matrix , marker , defaultnone
First column becomes a row header; header row and first column are pinned; other cells are centered
.fields , marker , defaultnone
Renders a definition list; see Fields
caption , plain text , defaultnone
Visible table caption; on .fields it labels the list
meta , role list , defaultnone
Meaning of the middle .fields columns: type required default -; requires .fields
#id , identifier , defaulttbl-<num> when num is set
[A-Za-z][A-Za-z0-9_.:-]*; lands on the <table>, or on the <figure> of a numbered table
num , string , defaultnone
[0-9A-Za-z.-]+; registers a Book table target and prefixes the caption with “Table N.”
tab / group / value , see Tabs , defaultnone
Adjacent tables become a tab set
class , class list , defaultnone
Kept on the <table> for site CSS
data-* / aria-* , string , defaultnone
Passed through

Any other key, style included, is dropped with a build warning. Hugo strips on* handlers before the theme sees them, so they are dropped silently.

Limits

  • Some attributes exclude each other. .fields wins over .matrix, .full-width, .expand and num, and num wins over tab; the loser is dropped with a warning. group and value need tab, and meta needs .fields.
  • The attribute line must touch the last row: after a blank line Goldmark drops it without a warning and the table renders plain. Without markup.goldmark.parser.attribute.block: true, one of the site prerequisites, the braces show up as text. Formatters such as Prettier move the line; wrap the table in <!-- prettier-ignore-start --> and <!-- prettier-ignore-end -->.
  • No merged cells, sorting or filtering. Split a table with merged headers into two tables, or make it a matrix.
  • Cells hold inline content only. For several paragraphs, a list or a code block, use the fields/field shortcodes.
  • .matrix centers cells with CSS, so an alignment written in the delimiter row wins.
  • Fields — everything {.fields} can do
  • Tabs — adjacent tables as a tab set
  • Publishing books — numbered tables, cross references, the list of tables
  • Code blocks — where attributes go on the info line instead of the next line

5 - Fields

Document configuration keys, command flags and API fields as a field list that stays readable on a phone and gives every entry its own link.

A field list documents named settings: configuration keys, command-line flags, API fields. Each name sits on its own line with small chips for its type, whether it is required and its default, and the description runs underneath at full width, so a long description never gets squeezed into a narrow table column on a phone. Every entry also gets its own anchor, which you can paste into an issue or a chat to point at one setting.

A field list suits reference material. When readers compare many rows across the same columns, keep a plain table; when the content is a sequence of actions, use Steps.

Shortest form

Write a pipe table with at least two columns and put {.fields} on the line right after it. The first column is the name, the last column is the description, and every column in between is metadata.

Source
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `offline_search` | boolean | `false` | Build the local search index and enable the command palette |
| `offline_search_max_results` | integer | `10` | Maximum number of search results |
| `page_width` | string | `normal` | Reading column width: `normal` `wide` `full` |
{.fields}
offline_search , Typeboolean , Defaultfalse
Build the local search index and enable the command palette
offline_search_max_results , Typeinteger , Default10
Maximum number of search results
page_width , Typestring , Defaultnormal
Reading column width: normal wide full

Each metadata cell is shown as “Header: value”. The theme does not read meaning into header text, so Type here is only a label; to get the standard chips, assign roles with meta as described in the next section. Cells accept inline Markdown such as code, emphasis and links, and an empty metadata cell is left out.

Semantic columns with meta=

meta gives each metadata column a role, in column order: type, required, default, or - to keep the header as a plain label. With roles assigned, the table renders the same chips as the shortcode form.

Source
| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `baseURL` | string | yes | | Site address, subpath included |
| `title` | string | yes | | Site name, shown in the navbar and the tab |
| `defaultContentLanguage` | string | | `en` | Default language; decides which language unprefixed paths belong to |
{.fields meta="type required default"}
baseURL , string , required
Site address, subpath included
title , string , required
Site name, shown in the navbar and the tab
defaultContentLanguage , string , defaulten
Default language; decides which language unprefixed paths belong to
  • Write exactly one role per metadata column, which is the column count minus two. With too many or too few, the build warns and the table renders as if meta were absent.
  • Any non-empty required cell means required, and it shows the English required chip whether you wrote “yes”, “是” or “✔”. Leave optional rows empty, because “no” and “否” count as required too.
  • type and default values without inline markup of their own are set as code, matching the shortcode form.
  • The chips always appear in the order type, required, default, whatever the column order; - columns follow in their own order.

Mix - with roles to keep a column under its own label:

Source
| Environment variable | Type | Read by | Description |
| --- | --- | --- | --- |
| `PGHOST` | string | libpq clients | Server host name, or the directory of a Unix socket |
| `PGDATA` | path | server tools | Data directory used by `initdb` and `pg_ctl` when `-D` is not given |
{.fields meta="type -"}
PGHOST , string , Read bylibpq clients
Server host name, or the directory of a Unix socket
PGDATA , path , Read byserver tools
Data directory used by initdb and pg_ctl when -D is not given

Labels and container IDs

caption puts a visible label above the list and also names it for screen readers. id sets the ID of the outer container, so you can link to the whole list or style it from site CSS.

Source
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `image_zoom` | boolean | `false` | Turn image zoom on |
| `featured_image` | string | `none` | Article image mode: `none`, `banner`, `wash` or `hero` |
{.fields caption="params.ui" id="zoom-params" meta="type default"}

params.ui

image_zoom , boolean , defaultfalse
Turn image zoom on
featured_image , string , defaultnone
Article image mode: none, banner, wash or hero

Every entry is linkable

Each entry gets a field-<name> anchor, and a link icon appears beside the name on hover. page_width in the first list on this page, for example, is #field-page_width. When a name occurs twice on one page, the second anchor gets -2, the third -3 (unlike headings, which Goldmark suffixes -1, -2).

To keep an anchor that other pages already link to, give the field shortcode an explicit id, such as id="guc-work-mem"; an empty, duplicate or unsafe value warns and falls back to the generated anchor. Local search indexes each anchored entry, so searching for a parameter name opens the page at that entry.

The shortcode form

A table cell cannot hold paragraphs, lists or code blocks. When a description needs them, write the list with the fields and field shortcodes instead.

Source
{{< fields label="Common pig flags" >}}
{{< field name="--config" type="path" required=true >}}
Path to the configuration file. Relative paths resolve against the working
directory.

When `PIG_CONFIG` is also set, the command-line flag wins.
{{< /field >}}
{{< field name="--log-level" type="string" default="info" >}}
Log level, from low to high:

- `debug`: print every remote call
- `info`: the default
- `error`: output only on failure
{{< /field >}}
{{< field name="--dry-run" type="boolean" default=false >}}
Print what would happen and change nothing:

```bash
pig ext install pg_duckdb --dry-run
```
{{< /field >}}
{{< /fields >}}

Common pig flags

--config , path , required

Path to the configuration file. Relative paths resolve against the working directory.

When PIG_CONFIG is also set, the command-line flag wins.

--log-level , string , defaultinfo

Log level, from low to high:

  • debug: print every remote call
  • info: the default
  • error: output only on failure
--dry-run , boolean , defaultfalse

Print what would happen and change nothing:

pig ext install pg_duckdb --dry-run

Write required=true and default=false without quotes, because quoted they are strings rather than booleans. default accepts any scalar and shows default=0 and default="" as written, the empty string as ""; without default, no default chip appears. Every field needs a non-empty body and must sit directly inside fields.

Which form to use

Situation Use
One-sentence descriptions that fit in a table cell table + {.fields}
Descriptions with paragraphs, lists or code blocks the fields/field shortcode
Readers comparing many rows across the same columns a plain table, not a field list
Content that is a sequence of actions Steps

Prefer the table form whenever it fits: GitHub still shows it as a readable table, and the page’s Markdown output keeps it as one.

Output

Field lists load no script. Print and RSS show the complete list without entry anchors, because a print view joins many pages into one document where the anchors would collide. In the page’s Markdown output the table form stays the source table, while the shortcode form becomes a bulleted list, “name — type; required; default: value”, with each description indented beneath its entry.

Parameter reference

The table attribute line, on the line right after the table:

.fields , marker , defaultnone
Required; renders the table as a field list
meta , role list , defaultnone
Space-separated type required default -; one per middle column; semantic roles cannot repeat
caption , plain text , defaultnone
Visible label and the list’s accessible name
id , identifier , defaultnone
ID of the outer container
class , class list , defaultnone
Passed through for site CSS
data-* / aria-* , string , defaultnone
Passed through

The fields shortcode:

label , non-empty string
Visible label; the same thing the table’s caption does
id , identifier
Container ID; no whitespace, quotes, <, > or &
class / data-* / aria-* , string
The same policy as the table attribute line

The field shortcode:

name , non-empty string , required
The field name
id , identifier
Replaces the generated field-<name> anchor; no whitespace, quotes, <, > or &, and unique among the fields on the page
type , non-empty string
Type label such as boolean, string[], duration
required , boolean
true shows the untranslated required chip; defaults to false
default , scalar
String / boolean / integer / float; false, 0 and "" all display

Limits

  • The first column must be non-empty and unique within the table; a row with an empty or duplicate name warns and is skipped.
  • .fields cannot be combined with .matrix, .full-width, .expand or num, and meta works only on a table that has .fields.
  • Table cells cannot hold block content; switch to the shortcode form for paragraphs, lists and code blocks.
  • required and default stay in English in every language, because they are API vocabulary rather than interface text.
  • There is no kind, since, deprecated or location metadata, no per-field link and no nesting, and nothing is generated from TypeScript or OpenAPI schemas.
  • Tables — the rest of the attribute line and the exclusion rules
  • Configuration — the full site parameter table, itself a field list
  • Front matter — the full front matter table
  • Steps — ordered actions do not belong in a field list

6 - Steps

Add {.steps} to an ordered list for a numbered procedure. Use the steps shortcode when each step needs a table-of-contents heading.

Steps present a procedure as a numbered column of dots joined by a line, so a reader following an installation or an upgrade can see at a glance which step they are on and how many remain. Add a {.steps} line under an ordinary ordered list; CSS draws the dots and the line, and no script loads. Use steps only when the order matters. Options and related links belong in a plain list or in cards.

The ordered list is the form to reach for first. Switch to the {{% steps %}} shortcode when each step needs its own heading in the table of contents; Which form to use compares the two.

Shortest form

Number every item 1. and let Markdown count, so you can add, remove or reorder steps without renumbering, and the content indent is always three spaces.

Source
1. Install Hugo
1. Clone OINK Starter
1. Start the local preview
{.steps}
  1. Install Hugo
  2. Clone OINK Starter
  3. Start the local preview

Put {.steps} on the line right after the last item. With a blank line in between, Goldmark drops it without a warning and the list renders as a plain numbered list.

What goes in a step

A step can hold any block content: paragraphs, fenced code, callouts, tables, nested lists and images. Indent it to the item’s content column, three spaces.

Source
1. Clone OINK Starter; it is the small project template for the theme.

   ```bash
   git clone https://github.com/pgsty/oink-starter my-docs
   cd my-docs
   ```

1. Start the local server.

   ```bash
   hugo server
   ```

   > [!NOTE]
   > The first build fetches the theme through the Go module proxy, which needs
   > Go on the machine.

1. Replace three things and it is your site.

   | Where | Replace with |
   | --- | --- |
   | `title` in `hugo.yml` | your site name |
   | `baseURL` in `hugo.yml` | your domain |
   | `content/` | your content |
{.steps}
  1. Clone OINK Starter; it is the small project template for the theme.

    git clone https://github.com/pgsty/oink-starter my-docs
    cd my-docs
  2. Start the local server.

    hugo server
    Note

    The first build fetches the theme through the Go module proxy, which needs Go on the machine.

  3. Replace three things and it is your site.

    Where Replace with
    title in hugo.yml your site name
    baseURL in hugo.yml your domain
    content/ your content

Shortcodes written as {{< … >}}, such as tabs, cards and badges, work inside a step too. The {{% … %}} form does not; see Limits.

Splitting one step per platform

When one step differs by platform, write adjacent {tab=} fences inside that list item; they still combine into one set of tabs.

Source
1. Install Hugo.

1. Install the dependencies:

   ```bash {tab="EL / RHEL" group="stepdemo" value="rpm"}
   sudo dnf install golang git
   ```
   ```bash {tab="Debian / Ubuntu" value="deb"}
   sudo apt install golang-go git
   ```

1. Run `hugo server` to preview.
{.steps}
  1. Install Hugo.

  2. Install the dependencies:

    EL / RHEL
    sudo dnf install golang git
    Debian / Ubuntu
    sudo apt install golang-go git
  3. Run hugo server to preview.

Continuing the numbering

When prose interrupts a procedure, start the next group with its real step number. Markdown writes that number as the list’s start, and the dots continue from it; starts from 2 to 40 are supported.

Source
4. Configure `baseURL` and the deployment workflow.
1. Push to `main` and wait for GitHub Actions to finish.
{.steps}
  1. Configure baseURL and the deployment workflow.
  2. Push to main and wait for GitHub Actions to finish.

Steps with headings

A long procedure is easier to navigate when every step has a heading that appears in the table of contents and can be linked to. Wrap the procedure in {{% steps %}}: its body is ordinary page Markdown, not indented, and each direct child heading starts a step. The three headings below are in this page’s table of contents.

Source
{{% steps %}}

### Install the toolchain {#install-toolchain}

Install Hugo and Go; [Get started](/docs/start/) lists the versions.

### Run the server {#run-server}

{{< tabs group="oink-os" default="macos" >}}
{{< tab label="macOS" value="macos" >}}
`brew install hugo go`
{{< /tab >}}
{{< tab label="Debian" value="debian" >}}
`sudo apt install hugo golang-go`
{{< /tab >}}
{{< /tabs >}}

### Publish {#publish}

Push to `main`; the workflow the repository ships builds and publishes.

{{% /steps %}}

Install the toolchain

Install Hugo and Go; Get started lists the versions.

Run the server

brew install hugo go

sudo apt install hugo golang-go

Publish

Push to main; the workflow the repository ships builds and publishes.

steps is the theme’s only shortcode written with percent delimiters. That form hands its body to Goldmark as page Markdown, which lets each step carry headings that enter the TOC. The cost is that it cannot sit inside a list item or inside another percent container, another steps included. Give every step in one procedure the same heading level.

Which form to use

Situation Use
A step is a sentence or two plus a command ordered list + {.steps}
Each step needs a heading, a link and a place in the TOC {{% steps %}}
The procedure itself has to nest inside another list item ordered list + {.steps}

Optional presentation

For a short procedure, {.steps .td-steps-compact} and steps variant="compact" tighten the spacing; numbering, nesting and heading anchors work as before. The presentation page shows both next to the regular form.

Output

Steps load no script, so they look the same with JavaScript off. Print keeps the numbers, content and connecting line; the Markdown output keeps the source as written, and RSS shows a plain list or titled sections.

Parameter reference

{.steps} , Whereline below the ordered list
Required; has no effect on an unordered list
{.steps .td-steps-compact} , Whereline below the ordered list
Compact spacing for a short procedure
1. , Whereevery item
Let Markdown count; the content indent is always three spaces
4. (first item) , Wherefirst item
Emits <ol start="4"> and continues from 4; supported for 2–40
{{% steps %}} , Wherearound a set of headings
Direct child headings (##–######) are the steps; the body is not indented
variant="compact" , Whereon {{% steps %}}
Compact spacing; any other value warns and uses the regular layout

Limits

  • Do not put a {{% … %}} shortcode inside a list item: its multiline output ends the list early. To put a {{% … %}} shortcode in a step, use the shortcode form.
  • Formatters such as Prettier may separate {.steps} from its list. Wrap the list in <!-- prettier-ignore-start --> and <!-- prettier-ignore-end -->.
  • {.steps} works only on ordered lists; a - list gets no numbers.
  • Steps do not collapse, expand or track progress; there is no “done” state.
  • Tabs — commands split per platform
  • Callouts — prerequisites and warnings inside a step
  • Code blocks — the commands in a step
  • Cards — “what next” once the procedure is done

7 - Badge

Mark a feature, version or table cell with a short status label such as Beta or deprecated, in one of five semantic tones.

A badge is a small inline label that sits after a name and states its status in a word or two: Beta, deprecated, v0.5, needs a server. You choose what the status means, one of five tones, and the theme picks colors that keep their contrast in light and dark mode. When the status needs a reason, a procedure or a deadline, write a sentence or a callout instead.

Shortest form

Source
{{< badge text="Beta" tone="warning" >}}
Beta

text is the only required parameter, and it must not be empty.

Five tones

Source
{{< badge text="Default" >}}
{{< badge text="Info" tone="info" >}}
{{< badge text="Supported" tone="success" >}}
{{< badge text="Experimental" tone="warning" >}}
{{< badge text="Deprecated" tone="danger" >}}

Default Info Supported Experimental Deprecated

Without tone a badge is neutral. Any value other than these five warns and falls back to neutral, and there is no way to set a custom color.

Inside a sentence

A badge follows the name it describes, on the same line:

Source
Logical replication {{< badge text="off by default" tone="neutral" >}} needs
`wal_level = logical`. The `pg_duckdb` extension {{< badge text="opt-in" tone="info" >}}
is installed separately, and the backup repository {{< badge text="needs a server" tone="warning" >}}
must point at an object store before the first backup runs.

Logical replication off by default needs wal_level = logical. The pg_duckdb extension opt-in is installed separately, and the backup repository needs a server must point at an object store before the first backup runs.

Next to a heading

Do not put a badge, or any other shortcode, in a heading. Hugo builds the table of contents before it expands shortcodes, so the heading looks right but its table-of-contents entry shows an internal Hugo placeholder. Put the badge at the start of the first paragraph instead:

Source
### OpenAPI pages {#openapi-example}

{{< badge text="new in 0.5" tone="success" >}} This section covers…

OpenAPI pages

new in 0.5 The badge sits right under the heading, the table of contents stays clean, and a shared link to the heading does not carry the badge text.

In table cells

In a comparison table, a column of badges is quicker to scan than a column of “yes” and “no”:

Source
| Component | Form | Status |
| --- | --- | --- |
| Callouts | `> [!NOTE]` | {{< badge text="stable" tone="success" >}} |
| Galleries | ` ```gallery ` fence | {{< badge text="stable" tone="success" >}} |
| PlantUML | ` ```plantuml ` fence | {{< badge text="opt-in" tone="info" >}} |
| The `image` shortcode | — | {{< badge text="removed" tone="danger" >}} |
Component Form Status
Callouts > [!NOTE] stable
Galleries ```gallery fence stable
PlantUML ```plantuml fence opt-in
The image shortcode — removed

In lists and steps

Source
1. Install Hugo {{< badge text="0.170+" tone="info" >}}
1. Create a site from OINK Starter and change `baseURL` in `hugo.yaml`
1. `hugo server` to preview {{< badge text="port 1313" tone="neutral" >}}
{.steps}
  1. Install Hugo 0.170+
  2. Create a site from OINK Starter and change baseURL in hugo.yaml
  3. hugo server to preview port 1313

On cards

A card has a badge parameter of its own, plain text shown beside the title, and its body can hold badge shortcodes as well:

Source
{{< cards >}}
{{< card title="Hugo Module" icon="fa-brands fa-golang" badge="recommended" >}}
One `hugo mod get` and you are done {{< badge text="needs Go" tone="info" >}}
{{< /card >}}
{{< card title="Offline archive" icon="fa-solid fa-box-archive" >}}
Builds on a machine with no network {{< badge text="manual upgrades" tone="warning" >}}
{{< /card >}}
{{< /cards >}}
Hugo Modulerecommended

One hugo mod get and you are done needs Go

Offline archive

Builds on a machine with no network manual upgrades

link turns the badge into a link. It accepts a site path, a relative path, an http(s): URL or a mailto: address:

Source
Current version {{< badge text="v0.5" tone="info" link="/blog/" >}};
for the upgrade steps see {{< badge text="Upgrading" tone="neutral" link="/docs/admin/upgrade/" >}}.

Current version v0.5; for the upgrade steps see Upgrading.

An invalid link warns and is dropped, leaving a plain badge.

Output

Badges load no script, and print and RSS show them as they appear on the page. A badge exists only as a shortcode, with no native Markdown form, so the page’s Markdown output turns it into bold text: **Beta**, or [**Beta**](/…) when it has a link.

Parameter reference

text , plain text , default—
Required, non-empty. What the reader sees
tone , enum , defaultneutral
neutral info success warning danger
link , URL , default—
Turns the badge into a link

Badges take named parameters only; there is no icon, class, color, outline or size. Mistakes warn and fall back: an unknown parameter is ignored, a missing or empty text renders nothing, an unknown tone becomes neutral, and an unsafe link is dropped.

Limits

  • The color only reinforces the text, so the text must state the status on its own. {{< badge text="🔴" >}} tells a screen reader nothing.
  • There is no icon parameter. For an icon, use cards or a callout.
  • Keep the text to a few words. A badge does not wrap, so longer text belongs in the sentence.
  • Use at most three badges in one place; a row of them buries the name they describe.
  • Cards — card has a badge parameter of its own
  • File trees — tone uses the same vocabulary
  • Keys — the other inline shortcode
  • Callouts — when the status needs explaining

8 - Kbd

Use kbd with one key name per parameter to display a semantic key sequence. Instructions remain readable in print and Markdown.

Use keys to show shortcuts and chords separately from prose. Supply one positional parameter per key. The theme draws keycaps, adds separators, and gives screen readers a readable sequence. Use inline code for command names, flags, and text to type. They are not physical keys.

Shortest form

Source
Press {{< kbd "Ctrl" "K" >}} to open the command palette.

Press Ctrl with K to open the command palette.

Quote each positional parameter and use one parameter per key. Missing, empty, or named parameters warn. Ordinary previews do not render invalid keys. Review the warning and rendered fallback before publication.

A single key

Each parameter represents one key. Write symbol keys as displayed on the keyboard.

Source
{{< kbd "Escape" >}} closes a dialog;
{{< kbd "/" >}} jumps to search;
{{< kbd "t" >}} cycles visual styles;
{{< kbd "y" >}} cycles light, dark, and system;
{{< kbd "x" >}} cycles through languages.

Escape closes a dialog; / jumps to search; t cycles visual styles; y cycles light, dark, and system; x cycles through languages.

Chords

Multiple parameters display in order, separated by +. Assistive technology receives a localized connector instead of the visible plus sign.

Source
{{< kbd "⌘" "Shift" "P" >}} and {{< kbd "Ctrl" "Shift" "P" >}} are the same action.
For a literal plus, treat it as a key of its own: {{< kbd "Ctrl" "+" >}} zooms the page in.

⌘ with Shift with P and Ctrl with Shift with P are the same action. For a literal plus, treat it as a key of its own: Ctrl with + zooms the page in.

Platform differences

Use the reader’s keyboard labels: ⌘ on macOS and Ctrl on Windows and Linux. Never combine platform labels in one sequence. Labels such as Ctrl/⌘ cannot be read aloud correctly. Name the platform in the sentence or use tabs.

Source
On macOS press {{< kbd "⌘" "K" >}}; on Windows and Linux, {{< kbd "Ctrl" "K" >}}.

On macOS press ⌘ with K; on Windows and Linux, Ctrl with K.

Shortcut tables

Keys are common in cheatsheets. This table shows some global keys that the site supports:

Source
| Key | Action |
| --- | --- |
| {{< kbd "Ctrl" "K" >}} | Open the command palette ({{< kbd "⌘" "K" >}} on macOS) |
| {{< kbd "/" >}} | The palette's full search state |
| {{< kbd "t" >}} | Cycle visual styles |
| {{< kbd "y" >}} | Cycle light, dark, and system |
| {{< kbd "q" >}} / {{< kbd "e" >}} | Previous / next page |
| {{< kbd "w" >}} {{< kbd "s" >}} {{< kbd "a" >}} {{< kbd "d" >}} | Move, collapse and expand in the sidebar tree |
| {{< kbd "Escape" >}} | Leave the sidebar tree for the article |
Key Action
Ctrl with K Open the command palette (⌘ with K on macOS)
/ The palette’s full search state
t Cycle visual styles
y Cycle light, dark, and system
q / e Previous / next page
w s a d Move, collapse and expand in the sidebar tree
Escape Leave the sidebar tree for the article

The complete list of site-wide shortcuts is in keyboard navigation.

In steps

Source
1. Press {{< kbd "Ctrl" "K" >}} to open the command palette
1. Type `>` for the command-only state, or type a keyword to search
1. Select with {{< kbd "↑" >}} {{< kbd "↓" >}} and press {{< kbd "Enter" >}} to go
1. {{< kbd "Escape" >}} closes it and focus returns where it was
{.steps}
  1. Press Ctrl with K to open the command palette
  2. Type > for the command-only state, or type a keyword to search
  3. Select with ↑ ↓ and press Enter to go
  4. Escape closes it and focus returns where it was

Raw <kbd> tags

Raw <kbd> tags get the same styles, and GitHub also displays them. With raw tags, you maintain separators and accessible sequences yourself. Either form works for single keys. Use the shortcode for chords.

Source
Press <kbd>F5</kbd> to reload; in an editor, <kbd>Ctrl</kbd>+<kbd>S</kbd> saves.

Press F5 to reload. In an editor, Ctrl+S saves.

Output

  • HTML: <span class="td-kbd-sequence"> around one <kbd> per key; the visible + is hidden from screen readers, which get a localized connector.
  • Print: same as HTML, static.
  • Markdown: plain text: Ctrl + K, ⌘ + Shift + P.
  • RSS: same as print.

The instruction remains readable without CSS or JavaScript.

Parameter reference

Positional 1..n , string , default—
At least one; each must be non-empty and quoted; order is display order

Only positional parameters are supported. There is no separator, label, platform, class, or size parameter. Hugo cannot combine positional and named parameters in one shortcode call.

Limits

  • Each sequence represents keys pressed together. For consecutive keys, use two kbd calls and describe the order: press Escape, then Enter.
  • There is no platform detection. The page never replaces Ctrl with ⌘ based on the visitor’s operating system.
  • There is no key mapping or recording. Menu paths, gestures, and gamepads are outside the scope.
  • Quote every key: unquoted words happen to work, but an unquoted number such as 1 is not a string; it warns and is skipped.
  • Do not use keys for commands. hugo server is inline code; Ctrl is a key.

9 - Includes

Reuse one source across pages with include for shared fragments and files, param for site and page values, and comment for notes that never publish.

When the same installation steps appear on three pages, or the current version number on thirty, every copy is a chance for the pages to drift apart. These three shortcodes keep one source instead: include inserts the content of another file, param prints a page or site parameter, and comment holds a note for authors that no output ever shows. Content that only one page uses belongs on that page.

Shortest form

include has one required parameter, file:

Source
{{< include file="parts/install-oink.md" >}}

The included file is ordinary Markdown, kept under assets/:

assets/parts/install-oink.md
Installing OINK into an existing Hugo site takes three commands:

```sh
hugo mod init github.com/you/your-site
hugo mod get github.com/pgsty/oink
hugo server
```

> [!NOTE]
> `hugo mod get` needs Go on the machine; an offline archive or a submodule does not.

The current release is {{< param version >}}.

It renders exactly as if you had written it here, copy button and callout included:

Installing OINK into an existing Hugo site takes three commands:

hugo mod init github.com/you/your-site
hugo mod get github.com/pgsty/oink
hugo server
Note

hugo mod get needs Go on the machine; an offline archive or a submodule does not.

The current release is v1.8.0.

An included file is not a page: it has no URL, no sidebar entry and no translation of its own.

Where the file comes from

file is looked up in this order, and the first match wins:

  1. A page resource — a file in this page’s bundle, written as file="config.yaml".
  2. A global resource under assets/ — written as file="snippets/dsn.txt".
  3. A file under content/ — a leading / starts at the content root, otherwise relative to the page’s directory, written as file="notes/caveat.md" or file="/shared/notice.md".

Include never reads outside content/ and assets/. A path containing .., or one that matches nothing, warns and includes nothing.

Keep Markdown fragments under assets/ or content/, where the name you write is exactly the file you get. In a page bundle (step 1), Hugo files language-suffixed resources such as notice.zh.md under the name without the suffix, and asking the bundle for notice.md returns rendered HTML rather than source, which then leaks into the page’s Markdown output as <div class="td-code"> markup. Non-Markdown files such as .yaml, .sh or .txt are not affected.

Including code files

code=true shows the file as a code block, and lang= picks its highlighting. Including a real configuration file from the repository keeps the documentation in step with the file.

Source
{{< include file="parts/module.yml" code=true lang="yaml" >}}
module:
  imports:
    - path: github.com/pgsty/oink

The block gets the same highlighting, line numbers and copy button as a code fence. Fence attributes such as title=, collapse or hl_lines= cannot be passed through include; when you need them, write an ordinary code block.

What a fragment can contain

A fragment is ordinary Markdown rendered in the context of the page that includes it, so callouts, tables, lists, images, steps and shortcodes all work. That is why the last line of the example above shows this site’s current release: its {{< param version >}} expands on this page.

When two pages include the same fragment, each renders it separately with its own heading anchors and code-block IDs, so nothing collides. Good fragments are the things that must change everywhere at once: installation commands, connection strings, support matrices, legal notices.

Printing a site parameter

param prints one parameter, looking in the page’s front matter first and then in the site configuration, the same lookup as Hugo’s .Param.

Source
This site publishes {{< param version >}}, copyright from {{< param copyright.from_year >}},
and this page's front matter says `pigsty_pg_major: 18`, which reads back as {{< param pigsty_pg_major >}}.

This site publishes v1.8.0, copyright from 2026, and this page’s front matter says pigsty_pg_major: 18, which reads back as 18.

Join nested keys with .: copyright.from_year reads params.copyright.from_year. A missing parameter, or one whose value is a map or a list, warns and prints nothing.

Parameters inside commands, tables and links

param prints escaped plain text, so it also works inside code fences, table cells and link targets, which is where version numbers usually live:

Source
```sh
hugo mod get github.com/pgsty/oink@{{< param tdVersion.latest >}}
```

| Item | Value |
| --- | --- |
| Current version | {{< param version >}} |
| Visual preset | {{< param ui.preset >}} |

[Release notes](https://github.com/pgsty/oink/releases/tag/{{< param tdVersion.latest >}})
hugo mod get github.com/pgsty/oink@v1.8.0
Item Value
Current version v1.8.0
Visual preset paper

Release notes

Site parameters are set in Configuration, page parameters in Front matter.

Notes deleted at build time

Use comment for a to-do or a note to the next author. Its body is dropped from every output: HTML, print, Markdown and RSS. An HTML comment would not do, because it stays in the page source and reaches llms.txt.

Source
Since PostgreSQL 18, `pg_stat_io` breaks out WAL statistics.

{{< comment >}}
TODO: after v0.5 ships, bump the version above to 19 and add a pg_stat_io screenshot.
This text reaches no output at all, llms.txt included.
{{< /comment >}}

Verify the dashboards on a test database before upgrading.

Since PostgreSQL 18, pg_stat_io breaks out WAL statistics.

Verify the dashboards on a test database before upgrading.

There is a comment between these two paragraphs, and not even the page source shows it.

Output

None of the three shortcodes loads a script, and print and RSS show the same content as the web page. The page’s Markdown output keeps sources rather than rendered HTML: an included fragment appears as written, with shortcodes such as {{< param version >}} still unexpanded, include code=true becomes a fenced code block, param becomes its value, and comment leaves nothing.

Parameter reference

include (named parameters only):

file , path (required) , default—
Resolution order in Where the file comes from; a .., missing file, or empty value warns and emits nothing
code , boolean , defaultfalse
true renders as a code block; quoted code="true" warns and includes ordinary content
lang , string , default—
Code language; without code=true it warns and is ignored

Any other parameter name warns, with the file and line, and is ignored.

param (one positional parameter):

parameter name , string (required) , default—
Nested keys join with .; page front matter first, then site params; missing or non-scalar values warn and print nothing

comment takes no parameters. It is a paired shortcode, and everything between {{< comment >}} and {{< /comment >}} is discarded.

Limits

  • include is not a template: it cannot pass variables to a fragment, include one conditionally, or add fence attributes such as title= or collapse to an included code block. For per-platform variants, write two fragments and put them in tabs.
  • include has no language fallback and reads exactly the path you write. A fragment can serve every language, or you can keep one per language, as this page does with install-oink.md and install-oink.zh.md, and point each translation at its own.
  • param prints scalars only. Keep structured data such as version matrices or download lists in data/ and render it with the matching component.
  • comment discards its content on every build. To take a whole page offline for a while, set draft: true.
  • If a page needs ten fragments, readers are better served by ten links than by one page assembled from includes.
  • Code blocks — every fence attribute, and the pipeline include code=true reuses
  • Tabs — per-platform or per-language fragments
  • Configuration — the site parameters param can reach
  • Front matter — page parameters, which win over site configuration

10 - Mermaid

Use a mermaid fence for flowcharts, sequence diagrams, Gantt charts, class diagrams, and state diagrams. Bundled Mermaid follows the color scheme; source diffs show changes.

A mermaid fence turns a few lines of text into a flowchart, sequence diagram, Gantt chart, class or ER diagram, or state diagram. Because the diagram lives in the page as text, a change to it shows up in review as a readable diff and site search finds the words in it, which a screenshot cannot offer. The Mermaid engine ships with the theme and runs in the reader’s browser, so no external service sees your diagrams. When a picture needs pixel-level control, draw it as SVG and add it as an image.

Shortest form

Source
```mermaid
flowchart LR
  app["Application"] --> pool["PgBouncer"]
  pool --> primary[("Primary")]
  primary -->|streaming replication| replica[("Replica")]
```
flowchart LR
  app["Application"] --> pool["PgBouncer"]
  pool --> primary[("Primary")]
  primary -->|streaming replication| replica[("Replica")]

There is nothing to turn on: name the fence mermaid. Only pages that contain such a fence load the Mermaid runtime, and they load it once however many diagrams they hold.

Sequence diagrams

sequenceDiagram shows messages passing between participants over time, which suits request paths, handshakes and retries.

Source
```mermaid
sequenceDiagram
  autonumber
  participant App as Application
  participant Pool as PgBouncer
  participant DB as PostgreSQL
  App->>Pool: BEGIN
  Pool->>DB: borrow a server connection
  App->>Pool: UPDATE accounts
  Pool->>DB: forward the statement
  DB-->>App: UPDATE 1
  App->>Pool: COMMIT
  Pool->>DB: COMMIT
  Note over Pool,DB: transaction pooling returns the connection after COMMIT
```
sequenceDiagram
  autonumber
  participant App as Application
  participant Pool as PgBouncer
  participant DB as PostgreSQL
  App->>Pool: BEGIN
  Pool->>DB: borrow a server connection
  App->>Pool: UPDATE accounts
  Pool->>DB: forward the statement
  DB-->>App: UPDATE 1
  App->>Pool: COMMIT
  Pool->>DB: COMMIT
  Note over Pool,DB: transaction pooling returns the connection after COMMIT

Gantt charts

gantt draws intervals on a time axis. This chart shows the five years of community support each PostgreSQL major version receives from its release date; 1825d is five years.

Source
```mermaid
gantt
  title Five-year community support per PostgreSQL major version
  dateFormat YYYY-MM-DD
  axisFormat %Y
  section PG 15
  released 2022-10-13 :2022-10-13, 1825d
  section PG 16
  released 2023-09-14 :2023-09-14, 1825d
  section PG 17
  released 2024-09-26 :2024-09-26, 1825d
  section PG 18
  released 2025-09-25 :active, 2025-09-25, 1825d
```
gantt
  title Five-year community support per PostgreSQL major version
  dateFormat YYYY-MM-DD
  axisFormat %Y
  section PG 15
  released 2022-10-13 :2022-10-13, 1825d
  section PG 16
  released 2023-09-14 :2023-09-14, 1825d
  section PG 17
  released 2024-09-26 :2024-09-26, 1825d
  section PG 18
  released 2025-09-25 :active, 2025-09-25, 1825d

Class and ER diagrams

Use classDiagram for types, their members and how they relate, and erDiagram for entities and cardinality; both explain a data model faster than a paragraph can.

Source
```mermaid
classDiagram
  class Cluster {
    +string name
    +int port
    +failover()
  }
  class Instance {
    +string host
    +string role
    +promote()
  }
  class Database {
    +string name
    +string owner
    +backup()
  }
  Cluster "1" --> "1..*" Instance : runs on
  Cluster "1" --> "0..*" Database : hosts
```
classDiagram
  class Cluster {
    +string name
    +int port
    +failover()
  }
  class Instance {
    +string host
    +string role
    +promote()
  }
  class Database {
    +string name
    +string owner
    +backup()
  }
  Cluster "1" --> "1..*" Instance : runs on
  Cluster "1" --> "0..*" Database : hosts
Source
```mermaid
erDiagram
  pg_database ||--o{ pg_namespace : "contains schemas"
  pg_namespace ||--o{ pg_class : "contains relations"
  pg_class ||--o{ pg_attribute : "has columns"
  pg_class ||--o{ pg_index : "is indexed by"
  pg_class {
    oid oid PK
    name relname
    char relkind
  }
  pg_attribute {
    oid attrelid FK
    name attname
    smallint attnum
  }
```
erDiagram
  pg_database ||--o{ pg_namespace : "contains schemas"
  pg_namespace ||--o{ pg_class : "contains relations"
  pg_class ||--o{ pg_attribute : "has columns"
  pg_class ||--o{ pg_index : "is indexed by"
  pg_class {
    oid oid PK
    name relname
    char relkind
  }
  pg_attribute {
    oid attrelid FK
    name attname
    smallint attnum
  }

State diagrams

stateDiagram-v2 shows states and the events that move between them, here the roles a PostgreSQL instance passes through in a high-availability cluster.

Source
```mermaid
stateDiagram-v2
  [*] --> Provisioning
  Provisioning --> Replica : base backup restored
  Replica --> Primary : promoted after failover
  Primary --> Replica : rejoined with pg_rewind
  Replica --> Lagging : lag above 1 GB
  Lagging --> Replica : caught up
  Replica --> [*] : decommissioned
```
stateDiagram-v2
  [*] --> Provisioning
  Provisioning --> Replica : base backup restored
  Replica --> Primary : promoted after failover
  Primary --> Replica : rejoined with pg_rewind
  Replica --> Lagging : lag above 1 GB
  Lagging --> Replica : caught up
  Replica --> [*] : decommissioned

Per-diagram title and configuration

Start the fence body with Mermaid’s own YAML header (it belongs to the diagram, not to Hugo’s front matter). title captions the diagram, and config overrides Mermaid settings for this diagram alone. Leave config.theme out: a diagram that sets it no longer follows the reader’s light or dark mode.

Source
```mermaid
---
title: Choosing a restore source
config:
  flowchart:
    curve: linear
---
flowchart TD
  Loss[Data lost] --> When{Restore to when?}
  When -->|latest state| Promote[Promote a replica]
  When -->|a point in time| PITR[Base backup plus WAL replay]
  When -->|one table| Dump[Restore that table from pg_dump]
```
---
title: Choosing a restore source
config:
  flowchart:
    curve: linear
---
flowchart TD
  Loss[Data lost] --> When{Restore to when?}
  When -->|latest state| Promote[Promote a replica]
  When -->|a point in time| PITR[Base backup plus WAL replay]
  When -->|one table| Dump[Restore that table from pg_dump]

Light and dark

Diagrams follow the reader’s color scheme: dark mode draws them with Mermaid’s dark theme, light mode with the theme your site configures. Switching redraws them in place without a reload, and each diagram keeps its height while it redraws, so the text around it does not jump.

Set site-wide defaults under params.mermaid in lowercase; the theme matches each key back to Mermaid’s own casing.

hugo.yml
params:
  mermaid:
    theme: neutral
    flowchart:
      diagrampadding: 6

The Mermaid configuration reference lists the accepted keys and values.

Inside tabs and steps

The tab attribute that groups adjacent code fences into tabs does not apply to mermaid fences. To let readers switch between two diagrams, put them in the tabs shortcode.

Source
{{< tabs >}}
{{< tab label="Physical replication" >}}
```mermaid
flowchart LR
  Primary -->|WAL stream| R1[Replica 1]
  Primary -->|WAL stream| R2[Replica 2]
```
{{< /tab >}}
{{< tab label="Logical replication" >}}
```mermaid
flowchart LR
  Publisher -->|orders table| Reporting[Reporting database]
  Publisher -->|products table| Search[Search index]
```
{{< /tab >}}
{{< /tabs >}}
flowchart LR
  Primary -->|WAL stream| R1[Replica 1]
  Primary -->|WAL stream| R2[Replica 2]
flowchart LR
  Publisher -->|orders table| Reporting[Reporting database]
  Publisher -->|products table| Search[Search index]

A step of the {{% steps %}} shortcode is ordinary page Markdown, so it can hold a mermaid fence too; see Steps.

Enlarging a diagram

Each diagram has a corner button that opens it in a viewer, the same one local PlantUML diagrams use. The viewer reuses the drawing already on the page instead of rendering it again. Drag or use the arrow keys to pan; use the wheel, a pinch, + or - to zoom; choose Fit to window or press 0 to see the whole diagram; press Esc to close it and return focus to the button. A very wide diagram opens at its natural size so its labels stay readable, controls keep a touch-friendly size on phones, a color-scheme change keeps your place, and nothing animates when the reader prefers reduced motion.

Source shows the original text and Copy code copies it with arrows, quotes, ampersands and non-Latin text intact. Download SVG saves a styled, self-contained image; a diagram that depends on external images or styles cannot be exported, and a failed copy or export says so. The source disclosure under each diagram can be opened and copied as well.

Loading and output

A diagram renders once it is visible and within 320px of the viewport, so a long page does not pay for diagrams the reader never reaches. Diagrams share one engine and render one at a time. A diagram in a hidden tab, a closed disclosure or a zero-width container waits until it is shown, and browsers without IntersectionObserver fall back to scroll and resize checks. Pages without diagrams load neither the engine nor the viewer.

When JavaScript is off, the engine is blocked or the diagram has a syntax error, the reader sees the source instead. Printing a page from the browser scales finished light-mode diagrams to the paper; dark-mode and not yet rendered diagrams print as black-on-white source. To print pictures throughout, switch to light mode and scroll through the diagrams you need, opening any tabs or disclosures that hold them, before you print. Printing leaves the reader’s appearance setting untouched. The site’s Print view, the Markdown output and RSS always carry the source.

Parameter reference

Site parameters (hugo.yml):

params.mermaid , map , defaultunset
The whole map is passed to Mermaid’s initialize(); write keys in lowercase and the theme matches them back to Mermaid’s casing; keys absent from Mermaid’s default config are dropped silently
params.mermaid.theme , string , defaultdefault
The light-mode theme; dark mode always uses dark. Unless set, layout: dagre and look: classic are pinned as well

Settings for one diagram (title, config) go in the YAML header at the start of the fence body; they are Mermaid keys, not theme parameters.

Fence attributes accept only class, data-* and aria-*, which land on the diagram’s <figure> for site CSS. Any other key, such as height or align, warns and is ignored: the diagram’s own content and the column width set its size, and it is always centered.

Limits

  • A diagram is inline SVG rather than an <img>, so {#id num=} numbering does not apply. To number one, export it as an image and use image numbering.
  • To change a diagram’s width, change the diagram itself (flowchart direction, class-diagram layout) or style its class in site CSS.
  • Hugo does not parse Mermaid, so a syntax error does not fail the build. The page shows an alert and the source instead of the diagram, so open each changed diagram in a browser before you publish.
  • Print, Markdown and RSS carry source rather than pictures, so state the conclusion in prose as well as in the diagram.
  • PlantUML — UML diagrams, rendered locally or by a server you run
  • Markmap — outline-shaped hierarchies
  • ECharts — charts with numbers in them
  • Images — hand-drawn SVG and numbering

11 - PlantUML

Render sequence, class, component, activity and use-case diagrams in the browser with bundled assets and no rendering service.

PlantUML is the text format many teams already use for UML: sequence, class, component, activity and use-case diagrams. A plantuml fence renders it in one of two ways, and you choose by what the diagrams need:

  • Local mode, the default, renders in the reader’s browser with two scripts that ship with the theme. It needs no Java, Graphviz, npm package, CDN or rendering service, and the diagram source never leaves the browser.
  • Server mode sends each diagram to a PlantUML server you run, which you need only for features the browser bundle lacks, such as !include or the C4 library. It requires an endpoint that you configure explicitly; OINK names none.

Shortest form

PlantUML is off by default. Turn it on without an endpoint to get local mode:

hugo.yml
params:
  plantuml: true

plantuml: { enable: true } is equivalent. Pages without a plantuml fence load neither engine script. Then write the diagram in a fence:

Source
```plantuml
@startuml
actor Operator
participant Patroni
database PostgreSQL
Operator -> Patroni : switch over to replica-2
Patroni -> PostgreSQL : demote the old primary
Patroni -> PostgreSQL : promote replica-2
Patroni --> Operator : switchover complete
@enduml
```
@startuml
actor Operator
participant Patroni
database PostgreSQL
Operator -> Patroni : switch over to replica-2
Patroni -> PostgreSQL : demote the old primary
Patroni -> PostgreSQL : promote replica-2
Patroni --> Operator : switchover complete
@enduml

The fence may leave out @startuml and @enduml; local mode adds them.

Class diagram

Declare classes with their fields, then the relationships and their cardinalities.

@startuml
class Publication {
  + pubname : name
  + puballtables : bool
  + pubinsert / pubupdate / pubdelete : bool
}
class Subscription {
  + subname : name
  + subconninfo : text
  + subslotname : name
}
class ReplicationSlot {
  + slot_name : name
  + plugin : name
  + confirmed_flush_lsn : pg_lsn
}
Publication "1" -- "0..*" Subscription : subscribed by
Subscription "1" -- "1" ReplicationSlot : bound to
@enduml

Component diagram

Packages group components, and arrows show which one depends on which.

@startuml
package "Monitoring node" {
  [Grafana] as grafana
  [Prometheus] as prom
  [Alertmanager] as alert
}
package "Database node" {
  [node_exporter] as node
  [pg_exporter] as pgexp
  [PostgreSQL] as pg
}
pg --> pgexp : query the statistics views
node --> prom : /metrics
pgexp --> prom : /metrics
prom --> alert : rule fired
grafana --> prom : PromQL
@enduml

Activity diagram

Decisions and branches lay out a workflow, such as a backup verification job.

@startuml
start
:take a base backup;
:restore it on a scratch host;
if (restore succeeded?) then (yes)
  :run the smoke queries;
else (no)
  :page the on-call engineer;
  stop
endif
if (row counts match?) then (yes)
  :mark the backup verified;
  stop
else (no)
  :open an incident;
  stop
endif
@enduml

Use-case diagram

Actors and use cases show what each kind of user can do with a system.

@startuml
left to right direction
actor Reader as reader
actor Author as author
actor Maintainer as maintainer
rectangle "Documentation site" {
  reader --> (full-text search)
  reader --> (switch language)
  reader --> (export the print view)
  author --> (add a page)
  author --> (preview locally)
  maintainer --> (upgrade the theme)
  maintainer --> (publish)
}
@enduml

Dark mode

In local mode, diagrams follow the reader’s light or dark mode, and any skinparam settings you write still apply. A mode change discards renders that are no longer current, and an open viewer keeps its zoom and position.

Enlarge, source and download

In local mode each diagram has a corner button that opens the same viewer as Mermaid: drag or use the arrow keys to pan; use the wheel, a pinch, + or - to zoom; choose Fit to window or press 0 to see it all; and press Esc to close it and return focus to the button. The viewer reuses the image already on the page instead of rendering again.

Source and Copy code keep arrows, quotes, ampersands and non-Latin text intact. Download SVG saves a styled, self-contained file; a diagram that depends on external resources cannot be exported, and a failure shows a message in the toolbar. The source disclosure under each diagram can be opened and copied too. Server mode shows the image your server returns, without the viewer.

Optional rendering service

Switch to server mode when your diagrams need what the browser bundle lacks (see Limits) and you run a PlantUML server:

hugo.yml
params:
  plantuml:
    enable: true
    svg_image_url: https://plantuml.internal.example/plantuml/svg/
    svg: false

A nonempty svg_image_url selects server mode; delete it, or leave it empty, to return to local mode. The theme appends each encoded diagram to this URL, so it must end with the path separator your server expects, usually /. It must be an HTTP(S) URL with a host, or a same-site path. An invalid endpoint warns and turns PlantUML rendering off instead of silently switching to local mode.

Server mode sends each diagram’s encoded source to that endpoint, so use a server you trust with the content. svg: true inlines the returned SVG instead of showing an image. Local mode ignores svg and always shows the diagram as an image, so links and markup inside it never enter the page.

Loading and output

In local mode, the two engine scripts load once per page, when the first diagram comes within 320px of the viewport. A diagram in a hidden tab, a closed disclosure or a zero-width container waits until it is shown, and browsers without IntersectionObserver fall back to scroll and resize checks. Mermaid and PlantUML diagrams render one at a time on the main thread.

When JavaScript is off, the engine fails to download, or a diagram uses unsupported input or fails to render, the source stays readable, and the other diagrams on the page still render. Printing from the browser keeps rendered diagrams, scaled to the paper, and prints source for those not yet rendered; it cannot wait for the engines, so scroll through the diagrams you need, opening any tabs or disclosures that hold them, before you print. The site’s Print view, the Markdown output and RSS carry the original source and make no rendering request.

Parameter reference

params.plantuml , boolean or map , defaultdisabled
true enables local rendering
params.plantuml.enable , boolean , defaultfalse
The switch in the map form
params.plantuml.svg_image_url , string , defaultabsent
Server endpoint; a nonempty value selects server mode
params.plantuml.svg , boolean , defaultfalse
Server mode only: inline SVG instead of an image

The fence takes none of the code-block attributes (title, copy, line numbers, numbering, zoom); they warn and are ignored.

Limits

  • The browser bundle contains the core engine and Graphviz layout only, so !include, !includeurl, external themes, C4, AWS and the other optional sprite libraries are not available. A diagram that uses them stays as source. Make it self-contained, use a pre-rendered image, or switch to server mode.
  • The engine is @plantuml/core 1.2026.10 with Viz.js 3.31.0. The two scripts total about 4.6 MB, or 1.5 MB gzipped; they load only when a diagram approaches the viewport, and normal HTTP caching applies.
  • Local rendering uses JavaScript and WebAssembly. A site with a strict Content Security Policy must allow its own scripts, wasm-unsafe-eval for WebAssembly compilation, and blob: images; when any of these is blocked, diagrams stay as source.
  • Large diagrams cost the reader’s CPU and memory, and rendering runs on the main thread rather than in a worker. If the engine hits a timeout it cannot cancel, the remaining PlantUML diagrams on the page stay as source until the page is reloaded.
  • Diagrams are images, so links inside them are not clickable, and they cannot be numbered.
  • Mermaid — another bundled browser diagram engine
  • Images — pre-rendered diagrams, numbering and zoom
  • Configuration — site settings

12 - Draw.io

Publish a Draw.io export as an ordinary image that readers can open in the Draw.io editor, change and download.

A diagram exported from Draw.io can carry its own source. Put such an export in a page as an ordinary Markdown image and the theme adds an edit button that opens it in the Draw.io editor, so a reader or a teammate can change the diagram and download the result instead of redrawing it from a screenshot. There is no fence or shortcode: the only requirement is that you tick “Include a copy of my diagram” when you export the SVG or PNG. A diagram that only needs to be looked at is an ordinary image.

Shortest form

The edit button appears once the site sets params.drawio.enable: true and an editor address in params.drawio.drawio_server, as shown under The editor address. Until then, every diagram is shown as a plain image.

Write the diagram like any image. The .drawio.svg name is a convention that helps you find the editable files; the theme does not look at the name.

Source
![The Hugo build pipeline: content goes through Hugo and out as public](pipeline.drawio.svg)
{width="620" height="140"}
The Hugo build pipeline: content goes through Hugo and out as public

A pencil button appears at the bottom right of the diagram when the pointer is over it or keyboard focus reaches it; on touch screens and in forced-colors mode it is always visible. The button opens the configured editor over the whole page. When image zoom is also on, Edit and Zoom are two separate buttons, and Edit never opens the zoom dialog.

How the copy is detected

What decides is the content of the file: an export with an embedded Draw.io copy gets the button, and any other image does not. This hand-drawn SVG uses the same syntax and attribute line as the diagram above, but it carries no copy, so it has no button:

Source
![The three columns of the documentation shell: sidebar, article, table of contents](plain-shell.svg)
{width="620" height="140"}
The three columns of the documentation shell: sidebar, article, table of contents

With a caption

A Draw.io diagram is rendered by the ordinary image hook, so every image attribute applies. Add caption for a captioned figure; the edit button stays on the image.

Source
![The Hugo build pipeline](pipeline.drawio.svg)
{caption="Content, configuration and theme templates flow into Hugo and out as public/" width="620" height="140"}
The Hugo build pipeline
Content, configuration and theme templates flow into Hugo and out as public/

As a numbered figure

Add {#id num=…} to make it a numbered figure that xref can refer to and that appears in the list of figures:

Source
![The Hugo build pipeline](pipeline.drawio.svg)
{#fig_pipeline num="1-1" caption="From content to a static site" width="620" height="140"}
The Hugo build pipeline
Figure 1-1 From content to a static site

Publishing books has the complete numbering and cross-reference rules.

SVG or PNG

Both work. A PNG export keeps the editable copy in a text chunk of the image, and the button appears the same way:

Source
![The Hugo build pipeline (PNG export)](pipeline.drawio.png)
{width="620" height="140"}
The Hugo build pipeline (PNG export)

Prefer SVG for documentation: it stays sharp at any size, its labels are real text that search and screen readers can read, and its diffs are readable in review. Choose PNG for a very complex diagram or for a platform without SVG support. Hugo’s image processing works only on PNG; processing an SVG warns and keeps the original file.

What the button does

Edit hands the diagram to the editor and gives the reader a file back; nothing on the site changes.

The editor opens over the page

A full-screen dialog opens with the Draw.io editor inside it and a Close button in the reader’s language. Keyboard focus stays inside the dialog. Close it with that button, by clicking the background, or with Escape while focus is outside the editor, which handles its own keys. Focus then returns to the Edit button.

The diagram goes straight to the editor

When the editor is ready, the reader’s browser hands it the image together with its embedded copy. The diagram does not pass through your web server.

Saving downloads a new file

Save in the editor, and the browser downloads the diagram in its original format, SVG or PNG, under the original file name. Nothing is written back to the site: to publish the change, replace the file in content/ with the download and commit it.

The button lets readers take a diagram away and change it; it is not an online editor for the site.

The editor address

hugo.yml
params:
  drawio:
    enable: true
    drawio_server: https://drawio.internal.example/
  • enable: true without drawio_server warns and leaves editing off. The theme never picks a public service for you.
  • The address must be an http(s) URL or a local path; a local path follows the deployment subpath in baseURL. Whitespace, control characters, backslashes, protocol-relative URLs (//host/) and other schemes warn and turn editing off.
  • Query parameters and a fragment in the address, such as ?lang=en, are kept, and the theme adds Draw.io’s embed-mode parameters (embed=1, proto=json and others).
  • When diagrams must not leave your organization, run a self-hosted editor and point the address at it.
  • The public editor https://embed.diagrams.net/ works too, but the reader’s diagram is then opened in a third-party page.

Configuration defines both keys.

Output

The diagram appears as an ordinary image in print, RSS and the page’s Markdown output; only the HTML page gets the edit button.

Parameter reference

Draw.io has no parameters of its own on the page. The attribute line is the one from Images: caption, width, height, link, #id, num, command and options.

Site parameters (hugo.yml):

params.drawio.enable , bool , defaultfalse
With it off no script loads and an image is just an image
params.drawio.drawio_server , string , defaultnone
The editor address; required when enable: true

Limits

  • The edit check runs only on pages with PNG or SVG images, and it reads each distinct image address once to look for an embedded copy.
  • An export made without “Include a copy of my diagram” has no copy, so it gets no button.
  • Editing needs the editor to be reachable. Offline, diagrams display normally but the editor cannot load.
  • Saving only downloads a file; replacing it in the repository and committing is up to you.
  • An exported SVG has fixed colors that do not follow light and dark mode. Use none fills and neutral gray lines and text, as the diagrams on this page do, so that the diagram reads well in both.
  • Images — captions, numbering, sizing and zoom in full
  • PlantUML — UML diagrams; see its rendering modes and version requirements
  • Mermaid — diagrams from text with no server at all
  • Configuration — the full definition of params.drawio.*

13 - ECharts

Draw bar, line and pie charts by writing ECharts options as YAML or JSON in an echarts fence, with colors that follow light and dark mode.

An echarts fence draws a chart with axes, series and a legend: table sizes, release timelines, the share of each category in a total. You describe the chart as an ECharts option object in YAML or JSON, so the fence holds data, not code, and the numbers sit in your Markdown where a diff shows every change. Hugo checks the options while it builds, the theme’s bundled copy of ECharts draws the chart in the reader’s browser, and the colors follow light and dark mode. There is nothing to configure, and pages without a chart load nothing. For relationships and flows, use Mermaid; for order and hierarchy, use Infographic.

Shortest form

A bar chart needs xAxis, yAxis and series. This one shows the size of six tables in an application database:

Source
```echarts {height="320px"}
tooltip:
  trigger: axis
xAxis:
  type: category
  data: [customers, products, orders, events, sessions, audit_log]
yAxis:
  type: value
  name: GB
series:
  - name: size
    type: bar
    data: [4, 4, 8, 22, 15, 7]
```
tooltip:
  trigger: axis
xAxis:
  type: category
  data: [customers, products, orders, events, sessions, audit_log]
yAxis:
  type: value
  name: GB
series:
  - name: size
    type: bar
    data: [4, 4, 8, 22, 15, 7]

YAML and JSON both work; YAML is shorter because it needs no quotes or commas. If the options do not parse, or parse to a list instead of a mapping, the build warns with the source line and the page shows your source instead of an empty chart.

Multiple line series

series is a list, with one entry per line, and legend lets readers hide a line by clicking its name. This chart shows when each PostgreSQL major version was released and when the community’s five-year support ends:

Source
```echarts {height="360px"}
tooltip:
  trigger: axis
legend:
  data: [Released, End of support]
grid:
  left: 56
  right: 24
  top: 48
  bottom: 40
xAxis:
  type: category
  name: major version
  data: ["9.6", "10", "11", "12", "13", "14", "15", "16", "17", "18"]
yAxis:
  type: value
  min: 2015
  max: 2031
  name: year
series:
  - name: Released
    type: line
    smooth: false
    data: [2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025]
  - name: End of support
    type: line
    lineStyle:
      type: dashed
    data: [2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030]
```
tooltip:
  trigger: axis
legend:
  data: [Released, End of support]
grid:
  left: 56
  right: 24
  top: 48
  bottom: 40
xAxis:
  type: category
  name: major version
  data: ["9.6", "10", "11", "12", "13", "14", "15", "16", "17", "18"]
yAxis:
  type: value
  min: 2015
  max: 2031
  name: year
series:
  - name: Released
    type: line
    smooth: false
    data: [2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025]
  - name: End of support
    type: line
    lineStyle:
      type: dashed
    data: [2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030]

The version numbers are quoted because YAML reads a bare 10 or 9.6 as a number, and labels on a category axis must be strings.

Pie and doughnut charts

Give radius two values to cut a hole in a pie and get a doughnut. This one groups OINK’s 29 shortcodes by purpose:

Source
```echarts {height="340px"}
tooltip:
  trigger: item
  formatter: "{b}: {c} ({d}%)"
legend:
  bottom: 0
series:
  - type: pie
    radius: [42%, 70%]
    itemStyle:
      borderRadius: 6
      borderWidth: 2
    label:
      formatter: "{b} {c}"
    data:
      - { value: 14, name: Core components }
      - { value: 10, name: Book numbering and indexes }
      - { value: 3, name: Releases and downloads }
      - { value: 2, name: OpenAPI }
```
tooltip:
  trigger: item
  formatter: "{b}: {c} ({d}%)"
legend:
  bottom: 0
series:
  - type: pie
    radius: [42%, 70%]
    itemStyle:
      borderRadius: 6
      borderWidth: 2
    label:
      formatter: "{b} {c}"
    data:
      - { value: 14, name: Core components }
      - { value: 10, name: Book numbering and indexes }
      - { value: 3, name: Releases and downloads }
      - { value: 2, name: OpenAPI }

{b}, {c} and {d} are ECharts placeholders for the name, the value and the percentage. A formatter string with placeholders covers most labels and tooltips without a function.

Height and full width

height defaults to 400px and accepts px, rem, em, vh, vw and %. full=true lets the chart leave the reading column and use the whole content area, which gives many data points or long labels room:

Source
```echarts {height="260px" full=true}
tooltip:
  trigger: axis
grid:
  left: 48
  right: 16
  top: 24
  bottom: 32
xAxis:
  type: category
  data: ["00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"]
yAxis:
  type: value
  name: queries/s
series:
  - type: bar
    data: [310, 280, 260, 250, 255, 290, 420, 780, 1150, 1320, 1380, 1400, 1290, 1350, 1410, 1380, 1300, 1180, 960, 820, 700, 590, 470, 380]
```
tooltip:
  trigger: axis
grid:
  left: 48
  right: 16
  top: 24
  bottom: 32
xAxis:
  type: category
  data: ["00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"]
yAxis:
  type: value
  name: queries/s
series:
  - type: bar
    data: [310, 280, 260, 250, 255, 290, 420, 780, 1150, 1320, 1380, 1400, 1290, 1350, 1410, 1380, 1300, 1180, 960, 820, 700, 590, 470, 380]

An invalid height such as 360 or 36pt warns and uses 400px.

Light and dark

Without theme, a chart takes the reader’s current color scheme and redraws in place when the reader switches, without a reload; it also resizes with its container. Switch this page to dark mode to watch the charts above change their background and text.

A fixed theme keeps the same colors in both modes:

Source
```echarts {height="240px" theme="dark"}
xAxis:
  type: category
  data: [replica-1, replica-2, replica-3, replica-4]
yAxis:
  type: value
  name: lag (ms)
series:
  - type: bar
    data: [12, 8, 15, 9]
```
xAxis:
  type: category
  data: [replica-1, replica-2, replica-3, replica-4]
yAxis:
  type: value
  name: lag (ms)
series:
  - type: bar
    data: [12, 8, 15, 9]

dark is the only theme built into ECharts. Leave theme out unless your brand requires fixed colors, so that charts match the rest of the page.

For a theme of your own, define it on window.OinkEchartsThemes under the name the fence uses. ECharts loads only when the first chart comes on screen, so a site script has no moment to call echarts.registerTheme() itself; instead each chart registers every theme it finds there before it draws:

Source
<script>
  window.OinkEchartsThemes = window.OinkEchartsThemes || {};
  window.OinkEchartsThemes.brand = {
    color: ['#0b5394', '#e69138', '#6aa84f', '#a64d79'],
    backgroundColor: '#f7f9fc',
  };
</script>

```echarts {height="240px" theme="brand"}
legend: {}
xAxis:
  type: category
  data: [Mon, Tue, Wed, Thu, Fri]
yAxis:
  type: value
  name: queries (k/s)
series:
  - name: primary
    type: bar
    data: [42, 45, 51, 48, 39]
  - name: replica
    type: bar
    data: [31, 33, 36, 35, 30]
```
legend: {}
xAxis:
  type: category
  data: [Mon, Tue, Wed, Thu, Fri]
yAxis:
  type: value
  name: queries (k/s)
series:
  - name: primary
    type: bar
    data: [42, 45, 51, 48, 39]
  - name: replica
    type: bar
    data: [31, 33, 36, 35, 30]

A theme is a plain object in ECharts’ theme format, such as the JSON its theme builder exports. To offer it on every page, put the script in layouts/_partials/hooks/body-end.html instead of a page. A name defined nowhere draws with ECharts’ default colors and no warning, and an entry named dark replaces the palette that charts without theme use in dark mode.

Callbacks with $fn:

A fence holds data and cannot contain JavaScript. When an option needs a function, such as a tooltip that computes a share or a color that depends on the value, write the string "$fn:name" in the options and register a function under that name on window.OinkEchartsFunctions:

Source
<script>
  window.OinkEchartsFunctions = window.OinkEchartsFunctions || {};
  window.OinkEchartsFunctions.tableShare = function (params) {
    var p = params[0];
    return p.name + ': ' + p.value + ' GB, ' + Math.round((p.value / 60) * 100) + '% of the database';
  };
</script>

```echarts {height="300px"}
tooltip:
  trigger: axis
  formatter: "$fn:tableShare"
xAxis:
  type: category
  data: [customers, products, orders, events, sessions, audit_log]
yAxis:
  type: value
series:
  - type: bar
    data: [4, 4, 8, 22, 15, 7]
```
tooltip:
  trigger: axis
  formatter: "$fn:tableShare"
xAxis:
  type: category
  data: [customers, products, orders, events, sessions, audit_log]
yAxis:
  type: value
series:
  - type: bar
    data: [4, 4, 8, 22, 15, 7]

Hover over a bar to see the sentence the function builds. A name that is not registered becomes undefined, and the chart draws as if the option were missing, with no warning at build time or in the browser, so keep the script next to the fence where both change together. The script is your site’s own code: review it like any other, and on a site with a Content Security Policy allow it as described under Deploy. Use a function only when a formatter string with {b}, {c} and {d} cannot do the job.

Where the data lives

Hugo does not expand shortcodes, front matter values or data/ files inside a fence, so the numbers are written in the fence itself. Two charts cannot share one dataset this way, but each chart travels with its data and a diff shows exactly which number changed.

Data that changes often, such as version matrices or download lists, should not be a chart. Use a table, or the data/-driven components of a release page.

Output

Print and RSS show the fence’s option source instead of a chart, and the page’s Markdown output keeps the fence as written. Say what the chart shows in the surrounding prose, so that those readers get the conclusion too.

Parameter reference

The fence attribute line (```echarts {…}):

height , CSS length , default400px
A non-negative number plus px rem em vh vw %; anything else warns and uses the default
theme , string , defaultunset
Pin an ECharts theme and stop following the site’s color scheme; dark is built in, other names come from window.OinkEchartsThemes
full , bool , defaultfalse
true drops the reading-column limit and fills the content area; a value other than true or false warns and uses false
class , space-separated classes , default—
Passed through to the container for site CSS

Unknown attributes warn and are ignored; Hugo takes style as a highlighting option and strips on*, so both are ignored without a warning. An empty fence warns and renders nothing. The option keys themselves belong to ECharts and are listed in its option manual. ECharts has no site-level setting in hugo.yml.

Limits

  • A fence cannot contain JavaScript; functions go through $fn: and themes through window.OinkEchartsThemes, and a name that is not registered fails silently.
  • A fence cannot read data/, front matter or shortcodes; the numbers must be in the fence.
  • Quote category values such as 10, 9.6, on and yes, which YAML would otherwise turn into numbers or booleans.
  • Do not rely on color alone to tell series apart. Vary the line style or marker shape as well, and check the legend’s contrast in both color schemes.
  • Infographic — structure and order, not statistics
  • Tables — for few values that must be read exactly
  • Mermaid — relationship and flow diagrams
  • Code blocks — the general rules for fence attribute lines

14 - Infographic

Turn a title and a short list of items into a flow, timeline, funnel, grid or hierarchy graphic with an infographic fence and an AntV template.

An infographic turns a short list into a picture of its structure: three steps in a row, five years on a timeline, stages that narrow like a funnel, a two-level hierarchy. You write the title and the items as plain data in an infographic fence, name one of the AntV templates on the first line, and the browser draws it; on GitHub the fence stays readable as text.

Reach for an infographic when the shape of the information is the message. When readers need axes and exact numbers, use ECharts; for a flow with conditions and branches, use Mermaid.

Shortest form

The first line is infographic <template>, followed by a data block with a title and an items list in which every item has at least a label.

Source
```infographic
infographic list-row-simple-horizontal-arrow
data
  title Upgrading to a new PostgreSQL major version
  items
    - label Back up
      desc Take a base backup and prove it restores
    - label Upgrade
      desc Run pg_upgrade on a replica first
    - label Switch over
      desc Promote the upgraded node, retire the old one
```
infographic list-row-simple-horizontal-arrow
data
  title Upgrading to a new PostgreSQL major version
  items
    - label Back up
      desc Take a base backup and prove it restores
    - label Upgrade
      desc Run pg_upgrade on a replica first
    - label Switch over
      desc Promote the upgraded node, retire the old one

Indentation defines the structure, two spaces per level. Keep labels to a word or two and put the explanation in desc, because long labels get squeezed or cut off on a phone.

Timelines

The sequence-timeline-* templates place items along a time axis: label is the point in time and desc the event.

Source
```infographic {height="420px"}
infographic sequence-timeline-simple
data
  title The last five PostgreSQL major versions
  items
    - label 2021
      desc 14: another round of parallel query and logical replication work
    - label 2022
      desc 15: the MERGE statement
    - label 2023
      desc 16: logical replication from a standby
    - label 2024
      desc 17: incremental backup and JSON_TABLE
    - label 2025
      desc 18: the asynchronous IO subsystem
```
infographic sequence-timeline-simple
data
  title The last five PostgreSQL major versions
  items
    - label 2021
      desc 14: another round of parallel query and logical replication work
    - label 2022
      desc 15: the MERGE statement
    - label 2023
      desc 16: logical replication from a standby
    - label 2024
      desc 17: incremental backup and JSON_TABLE
    - label 2025
      desc 18: the asynchronous IO subsystem

Funnels

sequence-funnel-simple draws stages that narrow, such as the path from a first visit to production use.

Source
```infographic {height="420px"}
infographic sequence-funnel-simple
data
  title From first visit to production
  items
    - label Visited
      desc Landed on any page of the site
    - label Read Get started
      desc Opened the tutorial
    - label Installed
      desc Ran the installer on a test machine
    - label First cluster
      desc Created a cluster and connected to it
    - label In production
      desc Serves real traffic
```
infographic sequence-funnel-simple
data
  title From first visit to production
  items
    - label Visited
      desc Landed on any page of the site
    - label Read Get started
      desc Opened the tutorial
    - label Installed
      desc Ran the installer on a test machine
    - label First cluster
      desc Created a cluster and connected to it
    - label In production
      desc Serves real traffic

Grid cards

When the items have no order, list-grid-* lays them out as a grid of cards instead of a sequence. A desc under data adds a subtitle.

Source
```infographic {height="380px"}
infographic list-grid-compact-card
data
  title Four ways to install
  desc Pick the one that matches how you already run servers
  items
    - label Packages
      desc RPM and DEB from the project repository
    - label Containers
      desc One image per major version
    - label Ansible
      desc Playbooks that build whole clusters
    - label Source
      desc Build with your own flags
```
infographic list-grid-compact-card
data
  title Four ways to install
  desc Pick the one that matches how you already run servers
  items
    - label Packages
      desc RPM and DEB from the project repository
    - label Containers
      desc One image per major version
    - label Ansible
      desc Playbooks that build whole clusters
    - label Source
      desc Build with your own flags

Items with values

Templates that show proportions, such as pies, doughnuts and progress displays, read a value on each item.

Source
```infographic {height="400px"}
infographic chart-pie-donut-plain-text
data
  title Where a 200 GB database's disk goes
  items
    - label Tables
      value 120
    - label Indexes
      value 50
    - label WAL
      value 20
    - label Temporary files
      value 10
```
infographic chart-pie-donut-plain-text
data
  title Where a 200 GB database's disk goes
  items
    - label Tables
      value 120
    - label Indexes
      value 50
    - label WAL
      value 20
    - label Temporary files
      value 10

Hierarchy and hand-drawn style

Nest items with children, and a hierarchy-mindmap-* template draws two levels of structure. A top-level theme block changes the look of the whole graphic; its type is light, dark or hand-drawn.

Source
```infographic {height="320px"}
infographic hierarchy-mindmap-level-gradient-compact-card
theme
  type hand-drawn
data
  root
    label Hugo site
    children
      - label content
        desc pages
        children
          - label docs
            desc documentation
          - label blog
            desc articles
      - label assets
        desc build inputs
        children
          - label css
            desc site styles
          - label images
            desc processed images
          - label parts
            desc shared fragments
```
infographic hierarchy-mindmap-level-gradient-compact-card
theme
  type hand-drawn
data
  root
    label Hugo site
    children
      - label content
        desc pages
        children
          - label docs
            desc documentation
          - label blog
            desc articles
      - label assets
        desc build inputs
        children
          - label css
            desc site styles
          - label images
            desc processed images
          - label parts
            desc shared fragments

Each graphic sits on its own canvas, which does not follow the site’s light or dark mode. The default and hand-drawn styles use a white canvas, a background you set in the DSL wins, and a type dark graphic stays dark even on a light page. Switching the site’s mode leaves the graphic exactly as drawn, so if you set a transparent background or your own text colors, check the contrast in both modes.

Picking a template

Template names read structure-variant, and each structure comes in several visual variants. The common families:

Structure prefix What it expresses Example
list-row-* list-column-* Items in a row or a column list-row-simple-horizontal-arrow
list-grid-* A grid, no order between items list-grid-compact-card list-grid-badge-card
list-pyramid-* sequence-funnel-* Narrowing stages sequence-funnel-simple
sequence-timeline-* sequence-roadmap-vertical-* Timelines and roadmaps sequence-timeline-simple
sequence-steps-* sequence-snake-steps-* Ordered steps sequence-steps-simple
compare-binary-horizontal-* compare-quadrant-* Binary comparison and quadrants compare-binary-horizontal-simple-vs
hierarchy-mindmap-* hierarchy-structure-* Hierarchy, with children hierarchy-mindmap-level-gradient-compact-card
chart-pie-* chart-bar-* chart-column-* Illustrative charts, with value chart-pie-donut-plain-text
relation-network-* relation-dagre-flow Networks and flows, with relations relation-dagre-flow

Pick the simplest form that shows the relationship. The AntV Infographic gallery shows every template; the names match the version bundled with the theme.

Output

On the web the theme’s bundled AntV runtime draws the graphic as SVG when the reader scrolls near it, so a page with several graphics stays fast. Print and RSS draw nothing and show the DSL source in a <pre> block instead, so state the conclusion in the surrounding prose; the page’s Markdown output keeps the fence as written.

Parameter reference

The fence attribute line (```infographic {…}):

height , auto or a CSS length , defaultauto
A non-negative number plus px rem em vh vw %; anything else warns and uses auto
full , bool , defaultfalse
true drops the reading-column limit
class , space-separated classes , default—
Passed through to the container

Unknown attributes warn and are ignored; Hugo takes style as a highlighting option and strips on*, so both are ignored without a warning. An empty fence warns and renders nothing.

The top-level DSL keys, defined by AntV:

infographic / template
The template name, on the first line
data
title, desc, items (or sequences, compares, nodes, values, relations, root, depending on the structure), order
theme
type (light / dark / hand-drawn), palette, colorPrimary, stylize …
width / height
Canvas size at the DSL level; usually left to the fence’s height
design
Per-part tuning; rarely needed

Each entry under items accepts label, desc, value, icon, children, group and id. The AntV Infographic documentation defines the full DSL; the theme’s VENDOR.json records the bundled version and its checksum.

Limits

  • A misspelled template name does not fail the build, because Hugo checks only the fence attributes and the DSL is parsed in the browser. The graphic area shows an error line instead, so look at the page after changing a template.
  • SVG carries no semantic structure, and screen readers may not read the items in visual order. When a heading, a list or a table can say the same thing, prefer it.
  • Long labels are squeezed or cut off on narrow screens; check the page at phone width after editing.
  • ECharts — when you need axes and exact numbers
  • Steps — when the reader has to follow the procedure
  • Cards — a grid of clickable entry points
  • Mermaid — flows with branches and conditions

15 - Markmap

Use a markmap fence for an expandable mind map with zoom controls. Its source remains a readable Markdown outline.

A mind map shows the shape of a topic at a glance: what a guide covers, how a system breaks down, which checks belong together. A markmap fence draws one from an ordinary Markdown outline, so the source stays a readable list on GitHub, in print and in feeds, while readers on the site can fold branches, zoom and pan. When the relationships have a direction or a condition (this calls that, retry if it fails), draw a Mermaid flowchart instead.

Shortest form

Markmap is off by default, so turn it on in the site configuration. Until you do, the fence stays a plain code block and no map script loads.

hugo.yml
params:
  markmap: true

Then write the outline in a markmap fence:

Source
```markmap
# Backup strategy
## Physical backups
- full and incremental with pgBackRest
- continuous WAL archiving
## Logical backups
- pg_dump per database
- restore into a scratch instance
## Verification
- weekly restore drill
- checksum every backup
```
# Backup strategy
## Physical backups
- full and incremental with pgBackRest
- continuous WAL archiving
## Logical backups
- pg_dump per database
- restore into a scratch instance
## Verification
- weekly restore drill
- checksum every backup

The first heading is the root, and the other headings and list items hang below it by level. Click the dot on a node to fold or unfold its branch, scroll to zoom, and drag to pan. The map refits itself whenever the column changes width until you drag or zoom; after that it keeps your position, and the bottom-right icon controls let you Fit to window (showing the whole outline again and resuming automatic refitting) or Download SVG. Both controls work from the keyboard and are hidden in print.

Depth

Use as many heading and list levels as the topic needs; the map lays them out and scales the tree to fit.

Source
```markmap
# Operations handbook
## Install
### Requirements
### Single node
### Three-node cluster
## Configure
### Connection pooling
### Memory and WAL
### Access control
## Monitor
### Dashboards
### Alert rules
## Back up and restore
### Full and incremental backups
### Point-in-time recovery
### Restore drills
## Upgrade
### Minor versions
### Major versions with pg_upgrade
```
# Operations handbook
## Install
### Requirements
### Single node
### Three-node cluster
## Configure
### Connection pooling
### Memory and WAL
### Access control
## Monitor
### Dashboards
### Alert rules
## Back up and restore
### Full and incremental backups
### Point-in-time recovery
### Restore drills
## Upgrade
### Minor versions
### Major versions with pg_upgrade

Links, code and emphasis

Node text accepts inline Markdown: links are clickable and keep their text as the accessible name, inline code is monospaced, and bold and italic work as usual.

Source
```markmap
# Everyday commands
## Preview
- `hugo server` — open [localhost:1313](http://localhost:1313/)
- `hugo server -D` — **including drafts**
## Build
- `hugo --printPathWarnings`
- `hugo --gc --minify` — for publishing
## Theme
- `hugo mod get -u github.com/pgsty/oink`
- [theme repository](https://github.com/pgsty/oink)
- [site source](https://github.com/pgsty/oink.pgsty.com)
```
# Everyday commands
## Preview
- `hugo server` — open [localhost:1313](http://localhost:1313/)
- `hugo server -D` — **including drafts**
## Build
- `hugo --printPathWarnings`
- `hugo --gc --minify` — for publishing
## Theme
- `hugo mod get -u github.com/pgsty/oink`
- [theme repository](https://github.com/pgsty/oink)
- [site source](https://github.com/pgsty/oink.pgsty.com)

A paragraph, table or fenced code block under a heading or list item becomes that node’s note. The node shows a marker; clicking it, or pressing Enter or Space after tabbing to it, opens the note, and Escape closes it and returns focus to the marker.

Mathematics in nodes

Write $…$ in a node for a formula. Maps typeset these with MathJax, which ships with the theme and loads only for maps that contain math; formulas in ordinary page text still use KaTeX.

Source
```markmap
# PostgreSQL metrics worth watching
## Cache hit ratio
- $\frac{blks\_hit}{blks\_hit + blks\_read}$
- below 0.99, look at shared_buffers
## Replication lag
- $lsn_{primary} - lsn_{replica}$
## Transaction throughput
- $TPS = \frac{\Delta xact\_commit}{\Delta t}$
```
# PostgreSQL metrics worth watching
## Cache hit ratio
- $\frac{blks\_hit}{blks\_hit + blks\_read}$
- below 0.99, look at shared_buffers
## Replication lag
- $lsn_{primary} - lsn_{replica}$
## Transaction throughput
- $TPS = \frac{\Delta xact\_commit}{\Delta t}$

Controlling the initial depth

A large map is easier to read when it opens folded. Start the fence body with a Markmap YAML header (it belongs to the map, not to Hugo’s front matter): foldLevel: 1 shows the root and its direct branches and folds everything deeper, so readers open only the branches they care about. colorDepth sets the level from which each branch keeps a single color.

Source
```markmap
---
markmap:
  foldLevel: 1
  colorDepth: 2
---

# Incident runbook
## Primary is down
### Confirm from two monitors
### Promote the replica
### Repoint the connection pooler
## Replication lag
### Look for long-running queries
### Check network throughput
## Disk almost full
### Remove expired WAL archives
### Extend the volume
## Slow queries
### Read pg_stat_statements
### Look for missing indexes
```
---
markmap:
  foldLevel: 1
  colorDepth: 2
---

# Incident runbook
## Primary is down
### Confirm from two monitors
### Promote the replica
### Repoint the connection pooler
## Replication lag
### Look for long-running queries
### Check network throughput
## Disk almost full
### Remove expired WAL archives
### Extend the volume
## Slow queries
### Read pg_stat_statements
### Look for missing indexes

Folded into a disclosure

Every map is 300 pixels tall, so a few in a row push the prose apart. Put a large overview that only some readers need in a > [!DETAILS] disclosure; every line inside it, fence lines included, starts with >.

Source
> [!DETAILS] Everything the monitoring stack collects
> ```markmap
> # Metrics
> ## Host
> - CPU, memory and disk
> - network throughput
> ## PostgreSQL
> - connections and locks
> - replication lag
> - cache hit ratio
> ## Connection pooler
> - client and server connections
> - wait time
> ## Backups
> - last successful backup
> - WAL archive delay
> ```
Everything the monitoring stack collects
# Metrics
## Host
- CPU, memory and disk
- network throughput
## PostgreSQL
- connections and locks
- replication lag
- cache hit ratio
## Connection pooler
- client and server connections
- wait time
## Backups
- last successful backup
- WAL archive delay

Output

A map is drawn when the reader scrolls near it; until then, and wherever JavaScript is off or the engine fails to load, the page shows the outline source, so the whole hierarchy stays readable. Print, the Markdown output and RSS always carry the outline as written.

Parameter reference

Site parameter (hugo.yml):

params.markmap , bool , defaultfalse
With it off, the fence stays a code block and no runtime loads

Options for a single map, such as foldLevel, colorDepth and wrapWidth, go in the markmap: YAML header at the start of the fence body. They are Markmap 1 options; the Markmap documentation lists them all. Fence attributes do not change the map: its width fills the reading column and its height is fixed at 300px.

Limits

  • The 300px height comes from one theme rule, .markmap > svg, and a fence cannot change it. For a deep outline, fold it with foldLevel or split it into two maps. The map is inline SVG, so {#id num=} numbering and image zoom do not apply.
  • Node text follows the site’s text color, but the branch lines keep Markmap’s own palette. If your site changes colors, check maps in both light and dark mode.
  • Characters such as >, & and quotes display as written. HTML tags in a node are dropped, except image tags and Markmap’s magic comments.
  • If a map, a note or its math fails to load, that map falls back to its outline source and the other maps on the page keep working.

Older option names

If a map’s YAML header uses one of the option names on the left, rename it. The old name is ignored and the build warns about it.

Older option Current option
initialExpandLevel: N foldLevel: N-1 for a positive N; delete it if N is -1
maxWidth wrapWidth
spacingHorizontal levelGap
spacingVertical siblingGap
colorFreezeLevel colorDepth

foldLevel counts the root as depth 0, which is why the value drops by one. paddingX, lineWidth, extraJs, extraCss, embedAssets, htmlParser and activeNode no longer exist; delete them, because a map cannot inject its own scripts or styles.

16 - FileTree

Draw an annotated directory tree in a filetree fence, with aligned comments, per-entry icons and collapsible directories.

A file tree explains a directory layout one entry at a time: where the configuration lives, which directory holds data, what a reader may delete. You write it in a filetree fence, where indentation sets the depth, a trailing / marks a directory and the text after # is a comment. The theme lines the comments up in their own column and turns directories into folders that readers can open and close.

A file tree shows the part of a layout that matters and says why. When readers need to copy the exact listing, use an ordinary code block instead.

Shortest form

Source
```filetree
- content/
  - _index.md
  - docs/
  - blog/
- hugo.yml
- go.mod
```
  • content/
    • _index.md
    • docs/
    • blog/
  • hugo.yml
  • go.mod

The bullets (-, * or +) are optional and change nothing. An entry with children is a directory; an entry without children is a directory only when its name ends in /.

Adding comments

Everything after the first # that follows whitespace is a comment, shown in an aligned column on the right. Comments are plain text, so Markdown in them shows literally; write \# for a literal hash.

Source
```filetree
- content/          # every page, both languages in one directory
  - docs/          # the documentation tree you are reading
  - blog/           # release notes and articles
- assets/css/       # the site's own CSS, loaded after the theme's
- layouts/          # site-level template overrides, the fewer the better
- static/images/    # images that need no build-time processing
- hugo.yml         # site configuration: languages, menus, params.ui
```
  • content/every page, both languages in one directory
    • docs/the documentation tree you are reading
    • blog/release notes and articles
  • assets/css/the site's own CSS, loaded after the theme's
  • layouts/site-level template overrides, the fewer the better
  • static/images/images that need no build-time processing
  • hugo.ymlsite configuration: languages, menus, params.ui

You do not need to align the # signs in the source: the theme starts the comment column after the widest name, so every comment lines up anyway. The comment column takes between three tenths and half of the panel. Readers can drag the dashed splitter between the columns, or focus it with Tab and move it with the arrow keys, Home and End jumping to the limits. The splitter is the tree’s only script, so a tree without comments loads no JavaScript.

A long name or comment is cut off with an ellipsis inside its column, and hovering shows the full text:

Source
```filetree {title="truncation in both columns"}
- runbooks/
  - a-deliberately-long-runbook-filename-for-a-failover-drill.md  # an equally overlong comment, kept on one line so it has to be clipped inside the comment column
  - restart.md                                                    # short
```

truncation in both columns

  • runbooks/
    • a-deliberately-long-runbook-filename-for-a-failover-drill.mdan equally overlong comment, kept on one line so it has to be clipped inside the comment column
    • restart.mdshort

On screens narrower than the sm breakpoint the tree becomes a single column: each comment moves under its name and shows in full, and the splitter is hidden.

Wrap long comments

When the comments are the point of the tree and must be read in full, add wrap=true to the fence. Comments then wrap inside their column, even unbroken identifiers, and rows grow to fit; names keep their ellipsis. Everything else works as before: folding, the splitter, the narrow-screen layout and print.

Source
```filetree {title="Complete storage comments" wrap=true}
- storage/
  - metadata/ # Schema definitions: property keys, vertex and edge labels, indexes, and counters.
  - graph/    # Graph data: vertices, edges, index tables, and OLAP analysis data.
```

Complete storage comments

  • storage/
    • metadata/Schema definitions: property keys, vertex and edge labels, indexes, and counters.
    • graph/Graph data: vertices, edges, index tables, and OLAP analysis data.

Title bars

{title="…"} on the fence adds a title bar above the tree, which helps when the reader needs to know which machine or repository the tree describes.

Source
```filetree {title="pgBackRest repository on the backup host"}
- /pg/backup/
  - archive/         # WAL segments, needed for point-in-time recovery
  - backup/          # full, differential and incremental backups
- /etc/pgbackrest/
  - pgbackrest.conf  # stanza, retention and repository settings
```

pgBackRest repository on the backup host

  • /pg/backup/
    • archive/WAL segments, needed for point-in-time recovery
    • backup/full, differential and incremental backups
  • /etc/pgbackrest/
    • pgbackrest.confstanza, retention and repository settings

Indentation and depth

Indentation sets the depth. Two spaces, four spaces and tabs (counted as four columns) all work and may even be mixed in one tree, as long as every level you return to was opened earlier. That makes it easy to paste the output of the tree command as it is, root line and summary included; the summary line is dropped.

Source
```filetree
content/docs
├── about
│   ├── _index.md
│   └── features.md
├── components
│   ├── filetree.md
│   └── image
│       └── index.md
└── _index.md

3 directories, 5 files
```
  • content/docs
    • about
      • _index.md
      • features.md
    • components
      • filetree.md
      • image
        • index.md
    • _index.md

A line that returns to a level that was never opened warns, naming its line in the fence, and is skipped.

Folding and explicit types

Directories with children start open; {open=false} at the end of a line starts one closed, which keeps a large tree focused on the part you are explaining. Directories are native <details> elements, so they open and close with the keyboard and need no JavaScript. When the name alone does not reveal the type, {type=dir} or {type=file} sets it.

Source
```filetree {title="the content directory"}
- content/
  - docs/                # the documentation tree
    - components/         # 28 component pages    {open=false}
      - callout.md
      - filetree.md
      - image/            # page bundle: body + images  {type=dir}
    - customize/          # site-level configuration    {open=false}
      - config.md
  - blog/
    - release.md
```

the content directory

  • content/
    • docs/the documentation tree
      • components/28 component pages
        • callout.md
        • filetree.md
        • image/page bundle: body + images
      • customize/site-level configuration
        • config.md
    • blog/
      • release.md

Icons and tones

The theme picks each icon from the name. Directory icons follow the open or closed state. Files match first on the full name (LICENSE, Makefile, go.mod, package.json, .gitignore …), then on the extension (md yml toml json sh py go js sql css png svg pdf zip …), and anything else gets a generic file icon.

{icon=…} replaces the icon with one Font Awesome class pair. {tone=…} colors the icon with the badge vocabulary: neutral, info, success, warning, danger.

Source
```filetree {title="deployment layout: permissions and what matters"}
- /etc/pigsty/                 # 0755 root:root · configuration root        {icon="fa-solid fa-server" tone=info}
  - pigsty.yml                 # 0644 root:root · cluster inventory
  - ca/                        # 0700 root:root · self-signed CA, never commit  {icon="fa-solid fa-lock" tone=danger open=false}
    - ca.key                   # 0600 root:root
- /var/lib/pgsql/18/data/      # 0700 postgres:postgres · data directory    {tone=warning}
  - postgresql.conf            # 0600 postgres:postgres
- /usr/bin/pig                 # 0755 root:root · command-line tool         {icon="fa-solid fa-terminal" tone=success}
```

deployment layout: permissions and what matters

  • /etc/pigsty/0755 root:root · configuration root
    • pigsty.yml0644 root:root · cluster inventory
    • ca/0700 root:root · self-signed CA, never commit
      • ca.key0600 root:root
  • /var/lib/pgsql/18/data/0700 postgres:postgres · data directory
    • postgresql.conf0600 postgres:postgres
  • /usr/bin/pig0755 root:root · command-line tool

tone colors the icon and never the text, so put the meaning in the name or the comment; readers who cannot tell the colors apart still get it there.

Write an entry as [name](link) to make it a link, for example to the page that documents that file. Site paths, relative paths and http(s): URLs are accepted, and they pass the same URL checks as links in other components.

Source
```filetree {title="this site's component pages"}
- content/docs/components/
  - [callout.md](/docs/components/callout/)     # callouts
  - [filetree.md](/docs/components/filetree/)   # this page
  - [gallery.md](/docs/components/gallery/)     # galleries
  - image/                                      # page bundle
    - [index.md](/docs/components/image/)       # images
- [hugo.yml](https://github.com/pgsty/oink.pgsty.com/blob/main/hugo.yml)   # this site's configuration on GitHub
```

this site's component pages

One tree per platform

When the layout differs by platform, give each fence tab= (and group= / value=); adjacent fences then become one tab set, which can mix trees and code fences.

Source
```filetree {tab="Linux" group="platform" value="linux"}
- /etc/pigsty/          # configuration
- /var/lib/pgsql/       # data
- /usr/bin/pig          # executable
```
```filetree {tab="macOS" value="macos"}
- ~/Library/Application Support/pigsty/   # configuration
- /opt/homebrew/bin/pig                   # executable
```
Linux
  • /etc/pigsty/configuration
  • /var/lib/pgsql/data
  • /usr/bin/pigexecutable
macOS
  • ~/Library/Application Support/pigsty/configuration
  • /opt/homebrew/bin/pigexecutable

Output

Print shows every directory expanded, with comments wrapped instead of cut off and no splitter. The page’s Markdown output keeps the filetree fence as you wrote it, and RSS shows that same source in a <pre> block.

Parameter reference

Fence attributes, after ```filetree:

title , plain text , default—
Title bar above the tree; omitted when absent; must not be empty
wrap , boolean , defaultfalse
Wrap long comments and grow rows; names keep the ellipsis; an invalid value warns and uses false
tab , plain text , default—
Makes this tree one panel of a tab set
group / value , string , default—
Tab group and sync value; must appear with tab
class , class list , default—
Passed through for site CSS

Entry attributes, in the {…} at the end of a line:

icon , Font Awesome class pair , defaultmatched by name / extension
For example fa-solid fa-lock; a malformed value warns and uses the default icon
tone , enum , defaultneutral
neutral info success warning danger; colors the icon only
open , boolean , defaulttrue
Directories only; false starts it closed
type , enum , defaultinferred
dir or file, overriding the inference

The line syntax:

Indentation
Two spaces / four spaces / tabs / the │ ├── └── drawing from tree
- name
The bullet is optional; -, * and + are equivalent
name/
A trailing slash marks a directory; the name renders as written, slash kept
[name](url)
A linked entry
# comment
Everything after the first whitespace-preceded #; \# is a literal hash
N directories, M files
The tree summary line, dropped automatically

Unknown attributes or values, open on a file, a malformed {…} and a return to an unopened level all warn with the line number in the fence; the theme then uses a safe default or skips the line.

Limits

  • The filetree fence is the only form; there is no {.filetree} list marker and no shortcode.
  • Names and comments are plain text, so **bold** shows literally and the source stays readable in any Markdown viewer.
  • The tree reads nothing from disk. It is the text you wrote or pasted and does not follow later changes to the repository.
  • There is no search, multiple selection or copy-the-whole-tree control; use a code block when readers must copy the listing.
  • A dragged splitter position is not saved, so a reload restores the width computed at build time.
  • Code blocks — listings meant to be copied verbatim
  • Tabs — one tree per platform, side by side
  • Badges — tone uses the same vocabulary
  • Organizing content — how a real content directory is laid out

17 - Math

Use KaTeX for inline and display mathematics at build time. Readers download no script.

Write formulas in TeX and Hugo turns them into HTML and MathML with KaTeX while it builds the site, so readers download one local stylesheet and no script, and nothing is sent to a remote math service. Use \(…\) inside a sentence, $$…$$ or \[…\] for a formula on its own line, and the math and chem fences where you cannot change the site configuration. For TikZ drawings or macro packages KaTeX does not support, use a pre-rendered image.

Site prerequisites

The $$, \[…\] and \(…\) delimiters work only after you enable Goldmark’s passthrough extension in your site’s own configuration; Hugo does not inherit markup settings from a theme, so OINK cannot do it for you. A math: true key, in front matter or in params, does not enable anything: without this block, $$ stays on the page as literal text.

hugo.yml
markup:
  goldmark:
    parser:
      attribute:
        block: true # numbered equations need the attribute line
    extensions:
      passthrough:
        enable: true
        delimiters:
          block: [['\[', '\]'], ['$$', '$$']]
          inline: [['\(', '\)']]

A single $ is deliberately left out of the inline delimiters, so a price such as “$5” in prose is never read as the start of a formula. Configuration describes each key. The math and chem fences and the eq shortcode need none of this.

Shortest form

An inline formula sits in the sentence; keep the surrounding spaces and punctuation outside the delimiters.

Source
The shared buffer hit ratio is \(\mathrm{hit} = \frac{H}{H + R}\), where \(H\) is `blks_hit` and \(R\) is `blks_read`.

The shared buffer hit ratio is hit=HH+R\mathrm{hit} = \frac{H}{H + R}, where HH is blks_hit and RR is blks_read.

Display formulas

Put a formula in its own paragraph between $$ delimiters, or \[…\], to show it larger and centered.

Source
A B-tree with fan-out \(f\) over \(N\) keys has height:

$$
h = \left\lceil \log_{f} N \right\rceil
$$

A B-tree with fan-out ff over NN keys has height:

h=⌈log⁡fN⌉ h = \left\lceil \log_{f} N \right\rceil

A formula too long for the column scrolls sideways inside it instead of widening the page.

The math fence

A math fence is another way to write a display formula. It needs no passthrough configuration, and GitHub shows it as an ordinary code block.

Source
```math
N_{\text{conn}} = \lambda \cdot \bar{t}_{\text{resp}}
```
Nconn=λ⋅tˉrespN_{\text{conn}} = \lambda \cdot \bar{t}_{\text{resp}}

This is Little’s law applied to a connection pool: in steady state, the connections you need equal the arrival rate times the mean response time, which is why a pool can be much smaller than the number of clients.

Chemistry and units

A chem fence typesets a \ce{…} body with KaTeX’s mhchem extension, which also handles physical units.

Source
```chem
\ce{CO2 + H2O <=> H2CO3 <=> H+ + HCO3^-}
```
COX2+HX2O⇌HX2COX3⇌HX++HCOX3X−\ce{CO2 + H2O <=> H2CO3 <=> H+ + HCO3^-}

The mhchem manual documents the syntax.

Numbered equations

Put an attribute line under a display formula to number it. You write the number yourself in num, such as 3-1 or 5.3, because the theme does not count; the anchor defaults to #eq-<num>. The number appears at the right of the formula after a localized “Equation” label.

Source
$$
\text{WAL}_{\text{day}} \approx \text{TPS} \times \bar{s}_{\text{record}} \times 86400
$$
{#eq-wal num="3-1" caption="Estimating daily WAL volume"}

See [Equation 3-1](#eq-wal): multiply by the retention period for the floor on archive disk size.
WALday≈TPS×sˉrecord×86400 \text{WAL}_{\text{day}} \approx \text{TPS} \times \bar{s}_{\text{record}} \times 86400
Equation 3-1 Estimating daily WAL volume

See Equation 3-1: multiply by the retention period for the floor on archive disk size.

caption is optional plain text, and both #id and caption need num. An incomplete attribute line warns and drops the parts it cannot use; a duplicate target warns and keeps the first. On a narrow screen a long caption wraps inside the column.

Cross references

An ordinary link reaches a numbered equation on the same page, as above. To link across pages, or to have the “Equation N” label written for you, use xref:

Source
Capacity planning starts from {{< xref eq="3-1" anchor="eq-wal" />}}.

Capacity planning starts from Equation 3-1.

xref may come before the equation it points to. For a book-wide list of equations and the book-equations index, see publishing books.

The eq shortcode

eq renders with the same KaTeX engine for sites that cannot enable passthrough, such as a migrated manuscript or a site whose hugo.yml you do not control. Without parameters it is an unnumbered display formula; with num it matches the attribute-line form. Where you can enable passthrough, $$ is shorter.

Source
{{< eq >}}\sigma_{\text{idx}} = \frac{\text{rows}_{\text{matched}}}{\text{rows}_{\text{total}}}{{< /eq >}}

{{< eq num="3-2" caption="Where a sequential scan and an index scan cost the same" >}}
c_{\text{seq}} \cdot P = c_{\text{rand}} \cdot \sigma \cdot T
{{< /eq >}}
σidx=rowsmatchedrowstotal\sigma_{\text{idx}} = \frac{\text{rows}_{\text{matched}}}{\text{rows}_{\text{total}}}
cseq⋅P=crand⋅σ⋅Tc_{\text{seq}} \cdot P = c_{\text{rand}} \cdot \sigma \cdot T
Equation 3-2 Where a sequential scan and an index scan cost the same

Output

No form loads JavaScript. A page with formulas loads a local katex.min.css and the WOFF2 fonts it names; a page without formulas loads neither. Print shows formulas the same way, without scrolling. The Markdown output keeps the TeX source as written, except that an eq shortcode becomes **Equation 3-2.** caption followed by a $$ block. RSS carries rendered KaTeX HTML and MathML; a numbered $$ block gets a bold “Equation N.” line before it, and a numbered eq keeps its “Equation N” caption below the formula.

Parameter reference

The four ways to write a formula:

\(…\) , Placementinline
Needs the site’s passthrough configuration; takes no attributes
$$…$$ / \[…\] , Placementdisplay
Needs the site’s passthrough configuration; an attribute line below it numbers it
```math , Placementdisplay fence
Works without passthrough; takes no attributes
```chem , Placementdisplay fence
Works without passthrough; the body is \ce{…}

The attribute line {…} under a display formula:

num , string , default—
[0-9A-Za-z.-]+; registers a numbered equation and shows “Equation N” at the right
#id , identifier , defaulteq-<num>
[A-Za-z][A-Za-z0-9_.:-]*; the anchor and cross-reference target
caption , plain text , default—
Caption after the number; requires num

The eq shortcode:

num , string , default—
As above; without it the formula is an unnumbered display formula
id , identifier , defaulteq-<num>
Requires num
caption , plain text , default—
Requires num
class , class list , default—
Requires num; passed through for site CSS
Body , TeX , default—
Required, non-empty

Invalid TeX does not stop the build. It warns with KaTeX’s error message and the source position, and the page shows the expression as written, so search the build log for these warnings before you publish.

Limits

  • Only $$ blocks and eq can be numbered. The math fence takes no attribute line, so switch forms when you need a number.
  • The theme never counts or renumbers equations. When you reorder chapters, update num yourself.
  • Inline formulas take no attributes; the attribute line applies only to display formulas.
  • caption is plain text, so Markdown in it appears literally.

18 - Maps

List places in a map fence to get a numbered place list in HTML, Print and RSS, plus an interactive map once the site names a tile service.

A map fence suits places that belong together in an order: the stops of a trip, a company’s offices, the venues of a conference, the sites of a field survey. HTML, Print and RSS show a numbered list with names, notes, thumbnails and OpenStreetMap coordinates. The list works without JavaScript. Markdown and LLMS keep the original YAML fence.

The interactive map above the list is something your site turns on. Map tiles are images fetched from a third-party tile service in the reader’s browser, and every service has its own usage policy, quota and attribution terms, so the theme does not pick one for you: until you set params.map with a tile URL and its attribution, as described in Site configuration, pages show the list and make no map requests at all.

For addresses that need no map, a table is enough; a map that is a drawing belongs in an image.

Shortest form

Each place needs a name, a lat and a lng.

Source
```map
- name: Forbidden City
  lat: 39.9159
  lng: 116.3908
- name: Temple of Heaven
  lat: 39.8822
  lng: 116.4066
- name: Summer Palace
  lat: 39.9901
  lng: 116.2647
```
  1. Forbidden City 39.9159, 116.3908
  2. Temple of Heaven 39.8822, 116.4066
  3. Summer Palace 39.9901, 116.2647

This site has a tile service configured, so a map appears above the list, with markers numbered like the list and zoomed to fit every place. On a site without one, the same fence renders only the list. Each coordinate pair links to the place on openstreetmap.org; that is an ordinary link the reader may follow, not a request the page makes.

The body is parsed as YAML, and since JSON is valid YAML, [{"name": "Forbidden City", "lat": 39.9159, "lng": 116.3908}] works too.

Site configuration

Maps are off by default. To turn them on, choose a tile service and add it to hugo.yml. This site uses OpenStreetMap’s standard tiles:

hugo.yml — OpenStreetMap (light use)
params:
  map:
    enable: true
    tiles: https://tile.openstreetmap.org/{z}/{x}/{y}.png
    attribution: "© OpenStreetMap contributors"
    attribution_url: https://www.openstreetmap.org/copyright
hugo.yml — commercial service with dark tiles & subdomains
params:
  map:
    enable: true
    tiles: https://{s}.tiles.example.com/light/{z}/{x}/{y}{r}.png?apikey=YOUR_DOMAIN_RESTRICTED_KEY
    dark_tiles: https://{s}.tiles.example.com/dark/{z}/{x}/{y}{r}.png?apikey=YOUR_DOMAIN_RESTRICTED_KEY
    subdomains: abcd
    attribution: "© Example Maps, © OpenStreetMap contributors"
    attribution_url: https://www.openstreetmap.org/copyright
    max_zoom: 20
hugo.yml — self-hosted tiles with click-to-load
params:
  map:
    enable: true
    tiles: https://tiles.your-domain.example/styles/basic/{z}/{x}/{y}.png
    attribution: "Map data © OpenStreetMap contributors"
    attribution_url: https://www.openstreetmap.org/copyright
    loading: click
  • tiles is an https:// URL template containing {z}, {x} and {y} ({s} for subdomains, {r} for high-DPI tiles and {-y} for TMS row order are allowed). Any other placeholder, such as {apikey} or {accessToken}, has no value to fill: write the key into the URL itself, or the template warns and is ignored. An optional dark_tiles, with the same rules, is used in dark mode. Only {s} may vary in either host. Put tile coordinates in the path or query.
  • attribution is the plain-text credit the tile service requires; it appears in the corner of every map. Add attribution_url (https://) to turn the credit into a clickable link without accepting author HTML — OpenStreetMap’s attribution guidelines require interactive web maps to link to https://www.openstreetmap.org/copyright.
  • subdomains overrides Leaflet’s default abc when tiles uses {s} (for example abcd or "01234567"). Quote digits: YAML reads an unquoted 01234567 as a number, which warns and falls back to Leaflet’s default.
  • max_zoom is a whole number from 1 to 22 and defaults to 19.
  • loading is lazy (the default: a map loads once it is on screen, within 320px below the viewport, or anywhere above the reading position) or click (show a button naming every tile host the map may contact, dark_tiles included and {s} written as *, and send no tile requests until clicked; if the button still holds focus, it moves to the map on success or the first coordinate link on failure).
  • enable: true without a valid tiles and an attribution warns and leaves maps off, so a half-finished configuration never sends readers to a service you have not agreed to. Fences keep rendering their lists.
  • Surrounding whitespace in tiles, dark_tiles, attribution_url and subdomains is trimmed. An unknown key warns and is ignored, including a camel-case spelling such as maxZoom, which Hugo lowercases; write max_zoom.

Pick a service that fits your traffic. The OpenStreetMap Foundation’s tile usage policy allows light use of its standard tiles with linked attribution; a busy site should use a commercial tile service with a domain-restricted key, or host its own tiles. A key in the tile URL is visible to every reader, which is why the restriction to your domain matters.

Each tile request sends the reader’s IP address and the area being viewed to the tile service. Requests start only on sites that enable maps. Under the default lazy loading they start as a map nears the viewport, and a reader who opens a link to a later section loads every map above it at once, so the text being read is not pushed down later. If no tile request may happen before the reader agrees, set loading: click: nothing is requested until the button is pressed. Either way, mention the service in your privacy notice if you have one.

Place fields

Besides name and the coordinates, a place can carry a note, a thumbnail and a link:

One place with every field
- name: Forbidden City
  lat: 39.9159
  lng: 116.3908
  text: Enter through the Meridian Gate in the morning.
  image: forbidden-city.webp
  link: "#single"
  • name and text are plain text: Markdown and HTML in them show literally, and popups are built from this text, never from HTML.
  • image is resolved like any image: page resource, then global resource, then static path, then remote URL. Local raster images are resized to fit 480×360 for the list and the popup, and carry their width and height in both, so the popup keeps its size while the image loads; remote images are used as they are. Thumbnails are decorative (alt=""), since the name beside them already says what they show. The route map below uses four images stored beside this page’s index.md.
  • link turns the name into a link in the list and in the popup, typically to a #anchor on the same page. Quote it, because YAML reads an unquoted # as the start of a comment.
  • A place without a name, without numeric coordinates, or with coordinates out of range warns and is skipped. A quoted number such as lat: "39.9159" is a string, so that place is skipped too.
  • Unknown fields warn and are ignored. A fence with no valid place, including an empty list [], warns and renders nothing.

Routes, thumbnails and captions

route=true joins the places with a line in list order, and image adds a resized thumbnail to both the list entry and its marker popup. caption adds a plain-text caption under the list, and screen readers announce it as the name of the map.

Source
```map {caption="Beijing Central Axis walk" route=true}
- name: Forbidden City
  lat: 39.9159
  lng: 116.3908
  text: Start at the Hall of Supreme Harmony; close-up below.
  image: forbidden-city.webp
  link: "#single"
- name: Jingshan Park
  lat: 39.9245
  lng: 116.3904
  text: Climb Wanchun Pavilion to overlook the palace roofs.
  image: jingshan.webp
- name: Beihai Park
  lat: 39.9264
  lng: 116.3825
  text: Cross Yong'an Bridge toward the White Dagoba.
  image: beihai.webp
- name: Drum Tower
  lat: 39.9393
  lng: 116.3898
  text: End the walk at the northern drum plaza.
  image: drum-tower.webp
```
  1. Forbidden City Start at the Hall of Supreme Harmony; close-up below. 39.9159, 116.3908
  2. Jingshan Park Climb Wanchun Pavilion to overlook the palace roofs. 39.9245, 116.3904
  3. Beihai Park Cross Yong'an Bridge toward the White Dagoba. 39.9264, 116.3825
  4. Drum Tower End the walk at the northern drum plaza. 39.9393, 116.3898
Beijing Central Axis walk

Select a marker or a row in the list below to open its popup with the thumbnail, the name and the note; the first place links to the next section. The route is a straight line from place to place, not a computed walking or driving route.

One place and zoom

A single place opens at zoom level 15. zoom sets another level, from 1 (the whole world) to 22 (a street corner, capped by params.map.max_zoom), and height sets the map’s height as a CSS length.

Source
```map {zoom=16 height="18rem"}
- name: Forbidden City
  lat: 39.9159
  lng: 116.3908
  text: Hall of Supreme Harmony, centered inside the palace moat.
  image: forbidden-city.webp
```
  1. Forbidden City Hall of Supreme Harmony, centered inside the palace moat. 39.9159, 116.3908

With several places, zoom replaces the fitted zoom level but keeps the fitted center. Without height the map is min(26rem, 60vh) tall, so a reader on a phone can always scroll past it. height takes a positive number followed by px, rem, em, vh or vw. A percentage has no height to resolve against and a zero height leaves nothing to see, so both, like anything else, warn and keep the default.

The interactive map

  • The theme bundles Leaflet 1.9.4. Only pages with a map link its stylesheet, and the script loads when the first map is due: on screen, within 320px below the viewport, or anywhere above the reading position (or when the reader clicks the load button under loading: click).
  • Scroll-wheel zoom is off, and on touchscreens single-finger swipes keep scrolling the page instead of trapping the reader inside the map. Readers pan and zoom with two-finger pinch, the zoom buttons, a mouse or pen drag, or the keyboard (focus the map, then use the arrow keys and + / -; site-wide single-key shortcuts yield while focus is inside the map).
  • Selecting a marker by pointer or with Enter, or clicking a place entry in the list below, pans to the place and opens its popup. A popup opened with Enter takes focus, so its link and close button come next; Escape or the close button closes it and returns focus to the marker.
  • In dark mode the map switches to dark_tiles when the site configures them, and switches back when the reader changes the color scheme; without dark_tiles, light tiles are gently dimmed without inverting map colors. If every dark_tiles request fails, the map keeps the dimmed light tiles.
  • The map resizes and frames with its container, including when a tab panel is shown or a disclosure opens, without fetching tiles for hidden tabs ahead of time.
  • If Leaflet or all light tiles fail to load, the canvas hides and the list remains.

The list stays under the map as its interactive legend and accessible alternative, and it uses two columns on wide screens.

Coordinates

Coordinates are WGS 84 decimal degrees, the system used by GPS, photo metadata and OpenStreetMap. The explicit lat and lng keys avoid the mix-ups that GeoJSON’s [lng, lat] order causes. To look up a place, open it on openstreetmap.org: the address bar ends with #map=zoom/lat/lng.

Tile services in mainland China commonly use GCJ-02 or BD-09 coordinates, on which WGS 84 markers land hundreds of meters off. The theme does not ship unofficial coordinate transforms; choose a WGS 84 / CGCS2000 tile service (such as compliant self-hosted tiles, a global commercial provider, or Tianditu with subdomains: "01234567" — note that Tianditu splits base imagery and place labels into two separate layers while params.map.tiles configures one).

Output

Print and RSS show the list and the caption without a map, and RSS makes the thumbnail URLs absolute. On a site without a tile service, the HTML page has no map script, stylesheet or tile URL at all. The page’s Markdown output keeps the map fence as you wrote it.

Parameter reference

Place fields:

name , plain text , default—
Required. The list entry and the popup title
lat , number , default—
Required. WGS 84 latitude, −90 to 90
lng , number , default—
Required. WGS 84 longitude, −180 to 180
text , plain text , default—
A note under the name and in the popup
image , image source , default—
Page resource / global resource / static path / remote URL; local rasters are resized
link , URL , default—
Links the name; a same-page #anchor is typical

Fence attributes:

caption , plain text , default—
Caption under the list; also labels the map region
route , bool , defaultfalse
true connects the places in list order
zoom , whole number , defaultfit
1 to 22 (capped by params.map.max_zoom). Without it: 15 for one place, otherwise fit all places
height , CSS length , defaultmin(26rem, 60vh)
A positive number plus px rem em vh vw
tab , plain text , default—
Makes this map one panel of a tab set
group / value , string , default—
Tab group and sync value; must appear with tab
id , element ID , defaultgenerated
The figure’s ID, for links to the map
class , class list , default—
Passed through to the figure for site CSS

num and other unknown attributes warn and are ignored. Hugo consumes style and strips on* attributes before the theme sees the fence, so those are ignored without a warning.

Site parameters (hugo.yml):

params.map.enable , bool , defaultfalse
Turns on interactive maps; requires tiles and attribution
params.map.tiles , URL template , default—
https:// with {z}, {x}, {y} ({s}, {r} and {-y} allowed; other placeholders warn)
params.map.attribution , string , default—
The plain-text attribution the tile service requires
params.map.attribution_url , URL , default—
Optional https:// URL that turns attribution into a link
params.map.dark_tiles , URL template , default—
Optional; used in dark mode
params.map.subdomains , string , default—
Optional {s} subdomain characters as a quoted string (e.g. abcd, "01234567"); empty uses Leaflet’s abc
params.map.max_zoom , whole number , default19
1 to 22
params.map.loading , lazy | click , defaultlazy
lazy mounts on, near or above the reading position; click waits for a reader click

Limits

  • Coordinates are WGS 84 only; markers on GCJ-02 or BD-09 tiles appear offset.
  • Routes connect places directly in coordinate space and do not wrap across the antimeridian.
  • There are no GPX or GeoJSON tracks, no marker clustering, search or geocoding, and no custom marker icons.
  • Markers are not read from photo GPS metadata; write the coordinates.
  • name, text and caption are plain text; put rich text in a paragraph next to the fence.
  • Remote thumbnails are neither downloaded nor resized at build time.
  • Gallery — the photos from the places on the map
  • Images — where thumbnails come from
  • Tabs — one map per day of a trip
  • Expo layout — photo essays and exhibitions
  • Draw.io — another feature that stays off until the site names a service

19 - Images

Add images with plain Markdown, then use one attribute line for a caption, a size, zoom, a link, a figure number or Hugo image processing.

Screenshots and diagrams go in with ordinary Markdown, ![alt text](source "title"), so the same source still shows the image on GitHub or in any editor. When an image needs more, such as a caption, a display size, a figure number for a book or a resized copy made at build time, put it in its own paragraph and add one {…} attribute line under it. There is no image shortcode to learn.

Shortest form

Source
![The OINK documentation shell: sidebar, article and table of contents](oink-shell.webp)
The OINK documentation shell: sidebar, article and table of contents

The image file sits next to this page’s index.md, which makes the folder a page bundle. The theme reads the image’s size and writes width and height into the page, so the text does not jump while it loads, and every image is lazy-loaded. Always write alt text, because screen readers and search engines rely on it; leave it empty only for a decorative image, which also never zooms.

Where images come from

Put each image where it is easiest to maintain and use the matching path form:

Placement How it is written Suited to
Beside the page (a bundle: index.md plus the image) ![…](oink-shell.webp) A screenshot only this page uses; it travels with the page and is shared by translations
Current section bundle (_index.md and its resources) ![…](post/image.png) Images belonging to a section; use the resource path relative to that section
Global resource assets/images/… ![…](images/logo/oink.webp) Images several pages share, especially ones needing processing (resize / crop)
Static directory static/images/… ![…](/images/hero-light.webp) Large images and downloads that need no processing; supply width/height where the theme cannot measure them
Remote URL ![…](https://example.com/a.png) Rare: nothing is downloaded at build time and nothing can be processed

A relative path is looked up as a page resource, then a resource of the current section, then a global resource. When none matches, the path is published as a static path; the theme does not check whether static paths or remote URLs exist, so a typo shows up as a broken image in the browser. If an image asks for processing but no processable resource is found, the build warns and publishes the image unprocessed.

Alt text written in Markdown always wins over the resource’s metadata, including an empty alt that marks a decorative image. A resource’s params.alt must be a string; any other value warns and is ignored.

Inline versus block

An image inside a line of text is inline: it renders as a single <img> and takes no attributes. An image in a paragraph of its own is a block image, and only a block image can carry an attribute line.

Source
This little one ![shell thumbnail](oink-mini.webp) sits inside a sentence — an inline image.

![shell thumbnail](oink-mini.webp)
{width="100" height="64"}

This image shell thumbnail is inside a sentence, so it is inline.

shell thumbnail

An inline image shows at its own size, 50×32 here. An SVG without an intrinsic size would stretch to the full column width inline, so place SVGs as block images with an explicit width and height.

Note

Block images need markup.goldmark.parser.wrapStandAloneImageWithinParagraph: false in the site’s own hugo.yml; see the Goldmark prerequisites. Without it, Goldmark wraps every standalone image in <p> and prints the attribute line as text.

Captions

caption="…" turns the image into a <figure> with a <figcaption>. Captions are plain text; Markdown in them is not rendered.

Source
![Release card: version, publication date and asset buttons](release-note.webp)
{caption="The release card uses the page's release_url and date"}
Release card: version, publication date and asset buttons
The release card uses the page's release_url and date

The "title" part of the Markdown image stays a hover tooltip and never becomes the caption.

Size

width and height take positive integers and override the size the theme measured. Use them to reserve space for a static or remote image, which the theme cannot measure, or to show a large image smaller. The browser does the scaling; the file itself is unchanged.

Source
![The OINK home page illustration (light)](/images/hero-light.webp)
{width="450" height="300" caption="A 900×600 illustration from static/images/ shown at half size"}
The OINK home page illustration (light)
A 900×600 illustration from static/images/ shown at half size

Processed images

To publish a smaller or cropped copy instead of the original file, let Hugo process the image at build time. Give both command (Fit, Resize, Fill or Crop) and options in Hugo’s image-processing syntax. The page then links the processed copy, and when zoom is on, the dialog still opens the original.

Source
![shell thumbnail](oink-shell.webp)
{command="Fit" options="300x150" caption="Fit 300x150: scaled to fit inside a 300×150 box"}

![the left half of the shell](oink-shell.webp)
{command="Fill" options="300x150 Left" caption="Fill 300x150 Left: fills the box, cropped from the left"}
shell thumbnail
Fit 300x150: scaled to fit inside a 300×150 box
the left half of the shell
Fill 300x150 Left: fills the box, cropped from the left

Only page and global resources can be processed. A command on a static path, a remote URL or an SVG warns and publishes the image unprocessed. Anchors, quality and format conversion, such as 300x150 webp q80, are described in Hugo image processing.

There are two ways to make an image clickable, depending on whether it has a caption:

  • Without a caption, wrap the image in a Markdown link: [![alt](src)](href).
  • To make a captioned figure clickable as a whole, add link="…" to the attribute line, which then also needs caption or num.
Source
[![Go to the highlights page](oink-shell.webp)](/docs/about/features/)

![Release card](release-note.webp)
{caption="Click the image for the releases and downloads guide" link="/docs/write/releases/"}

Go to the highlights page

Release card
Click the image for the releases and downloads guide

A linked image never zooms, because a click follows the link. A link= without a caption or number warns and is dropped, and the warning suggests the [![…](…)](…) form.

Numbered figures

Books and long manuals refer to figures by number. Add num to the attribute line, and optionally an #id. You write the number yourself as a string such as 2-1 or 3.4, because the theme never counts; the caption then starts with a localized “Figure 2-1”, and the ID defaults to fig-<num>. Refer to the figure with an ordinary link such as [Figure 2-1](#fig-2-1) or with xref; Books covers the whole-book list of figures.

Source
![Release card](release-note.webp)
{#fig-release num="2-1" caption="The release card: version, date and assets"}

See [Figure 2-1](#fig-release).
Release card
Figure 2-1 The release card: version, date and assets

See Figure 2-1.

A numbered figure can also be processed (num with command) and can carry a link.

Zoom

Zoom lets readers open a screenshot at full size without leaving the page. It is off by default. Turn it on for the whole site with params.ui.image_zoom; image_zoom in a page’s front matter overrides the site setting for that page, in either direction:

hugo.yml
params:
  ui:
    image_zoom: true
One page's front matter: off for this page only
image_zoom: false

With zoom on, block images, figures and gallery images that have alt text become buttons that open the full image in a native <dialog>; Esc closes it and returns focus to the image. This page turns zoom on in its front matter, so you can click any image above. The button’s label exists only for screen readers, so copying the article copies the images and captions and no button text.

Inline images, decorative images with empty alt text, linked images and images marked data-no-zoom never zoom. The zoom script loads only on pages that have an image that can zoom.

Source: a decorative image does not zoom
![](oink-shell.webp)
{width="150" height="75"}

Light and dark images

There is no setting that swaps an image by color scheme. When a screenshot needs a light and a dark version, give each one a class and hide the wrong one in site CSS. The theme sets data-bs-theme on html, so these selectors show exactly one of the two:

Source
![Sidebar (light)](sidebar-light.webp)
{class="only-light"}

![Sidebar (dark)](sidebar-dark.webp)
{class="only-dark"}
assets/css/project.css
html[data-bs-theme="dark"] .only-light,
html:not([data-bs-theme="dark"]) .only-dark { display: none; }

Replace sidebar-light.webp and sidebar-dark.webp with your own images.

Output

Print shows images and figures as on the web, without the zoom buttons, and RSS rewrites each image src to an absolute URL. The page’s Markdown output keeps ![alt](src) and the attribute line as you wrote them.

Parameter reference

The attribute line {…}, on the line right after a block image:

caption , plain text , default—
Its presence makes a figure; not parsed as Markdown
#id , identifier , defaultfig-<num> when num is set
[A-Za-z][A-Za-z0-9_.:-]*; the anchor and the Book target ID
num , string , default—
[0-9A-Za-z.-]+; registers a Book figure target and prefixes the caption with “Figure N”
width / height , positive integer , defaultthe resource’s intrinsic size
Overrides the size; static and remote images use it to avoid layout shift
command , enum , default—
Fit, Resize, Fill, Crop; must accompany options; page and global resources only
options , string , default—
Hugo image processing options such as 600x300, 300x150 Left, 800x webp q80
link , URL , default—
Wraps the figure in a link; requires caption or num; a linked image does not zoom
class , class list , default—
Passed through for the site’s CSS
data-* / aria-* , string , default—
Passed through

style, alt, title, src and any other key on the attribute line warn and are ignored; Hugo strips on* handlers before the theme sees them, so they are dropped silently. Alt text, title and source belong in the Markdown image itself.

Limits

  • Captions and every other string parameter are plain text; put a longer explanation in a paragraph under the image.
  • title is not a caption: the c in ![a](b "c") is a hover tooltip.
  • Only resources can be processed, so move an image that needs processing from static/ into the page bundle or assets/.
  • Remote images are never downloaded at build time.
  • Zoom has no drag, pan or previous / next control; show a set of related images as a gallery.
  • Gallery — a set of images sharing one zoom dialog
  • Books — the list of figures and xref cross-references
  • Brand and appearance — where the site logo and favicon go
  • Cards — images on cards

20 - Gallery

Lay out a set of related screenshots as a responsive grid with a gallery fence, each with an optional description or link.

A gallery puts related images side by side so readers can compare them: the screens of a setup wizard, the light and dark versions of a dashboard, the same chart before and after a fix. You write one image per line inside a gallery fence, and the theme lays them out as a grid that drops columns as the screen narrows.

Use an image for a single picture. Images without an order or a comparison between them are better as separate figures in the text.

Shortest form

Each line is a Markdown image, ![alt](src).

Source
```gallery
![OINK's default documentation shell](/images/oink.webp)
![The classic Docsy layout upstream](/images/docsy.webp)
```

Always write the alt text. It is the item’s title, the only text a screen reader announces for it, and what makes the image eligible for zoom. There is no column setting: the grid follows the width of its container.

Descriptions

Put # after the image to add a description under it. Descriptions are plain text, so Markdown in them shows literally; write \# for a literal hash.

Source
```gallery
![The three-column layout of an OINK page](/images/oink.webp) # The default shell: sidebar, article, table of contents
![The classic Docsy documentation layout](/images/docsy.webp) # Docsy upstream — the content model is the same lineage
![A release notes page](/images/releasenote.webp) # Release cards use release_url and date; checksums blocks list download assets
```

Descriptions may differ in length: the items in a row line up with the tallest one, and a description that wraps does not push its neighbors around. The image is parsed before the description, so a # inside alt text or a path needs no escaping.

Add {link=…} at the end of a line to make that item a link, for example to the page that explains the screen. Site paths, relative paths and http(s): URLs are accepted.

Source
```gallery
![OINK's default documentation shell](/images/oink.webp) # Opens the Images component page {link=/docs/components/image/}
![A release notes page](/images/releasenote.webp) # Opens "Releases and downloads" {link=/docs/write/releases/}
```

A click on a linked item follows the link, so that item does not zoom. One gallery can mix both kinds: linked items open their page, the others open the full image.

Where images come from

Each source is looked up like a plain image: a page resource in the page bundle, then a global resource under assets/, then a static path such as /images/…, then a remote URL. The theme reads the size of local resources and writes it into the page, so the grid does not jump while images load. Remote images are neither downloaded nor measured at build time.

Source
```gallery
![OINK documentation overview (global resource)](images/content-primitives/oink.webp) # Under assets/images/…, eligible for build-time processing
![The light home page (static path)](/images/hero-light.webp) # Under static/images/…, published as is
```

A page or global resource that cannot be found is kept as a static path. The theme does not check whether static paths or remote URLs exist, so a typo there shows up as a broken image in the browser.

Decorative images and zoom

Empty alt text marks an image as decorative: it gets no title, screen readers skip it, and it never zooms.

Image zoom is off by default and turned on with params.ui.image_zoom for the whole site or with image_zoom in a page’s front matter; this page does the latter. Every image above that has alt text and no link opens at full size, and Esc closes it and returns focus to the image.

this page's front matter
image_zoom: true
Source: one decorative image, one ordinary one
```gallery
![](/images/docsy.webp) # Decorative, never zooms
![The Pigsty release notes page](/images/releasenote.webp) # Has alt text, so it opens
```

Galleries reuse the page’s single zoom dialog instead of bringing their own, and the zoom script loads only when the page has at least one image that can zoom. Images · Zoom lists the full rules.

Classes and tabs

class adds a CSS class for your own styles, either to the whole fence (after the language) or to one item (at the end of its line); the theme passes it through without interpreting it. A fence with tab= (and group= / value=) becomes one panel of a tab set, which suits one gallery per platform or per color scheme.

Source
```gallery {tab="OINK" group="shell" value="oink"}
![OINK's default documentation shell](/images/oink.webp) # Sidebar, article, table of contents
```
```gallery {tab="Docsy" value="docsy"}
![The classic Docsy layout upstream](/images/docsy.webp) # The same content-model lineage
```
OINK
Docsy

Output

Galleries load no script of their own, and every image is lazy-loaded. Print and RSS stack the images without zoom, and the page’s Markdown output keeps the gallery fence as you wrote it.

Parameter reference

The line syntax ![alt](src) [# description] [{key=value …}]:

![alt](src) , Requiredyes
Must start the line. alt is the item’s title; empty means decorative
src , Requiredyes
Page resource / global resource / static path / remote URL
# description , Requiredno
Plain text under the image; \# is a literal hash; must not be empty
{link=…} , Requiredno
Makes the item a link, and therefore not zoomable
{class=…} , Requiredno
Adds a site CSS class to that item

Fence attributes:

tab , plain text , default—
Makes this gallery one panel of a tab set
group / value , string , default—
Tab group and sync value; must appear with tab
class , class list , default—
Passed through for site CSS

There is no columns, caption or title attribute. A malformed line or attribute warns with its line number in the fence, and only the broken part or line is dropped.

Limits

  • The fence is the only form; there is no {.gallery} list marker and no shortcode. GitHub therefore shows the source rather than the images.
  • You cannot set the number of columns, and images keep their own proportions instead of being cropped to a common shape.
  • There is no slideshow, carousel or previous / next control; the zoom dialog shows one image at a time.
  • Remote images are not downloaded at build time, so their size is unknown until the browser loads them and the layout can shift.
  • Descriptions do not render Markdown; put rich text in a paragraph below the gallery.

For a whole album with a sidebar, page-by-page browsing and drag-to-pan viewing, use the Expo layout; a gallery fence is for a group of images inside a text page.

  • Images — single images, captions, numbering, the zoom switch
  • Cards — a grid of links with images
  • Tabs — one gallery per platform or theme
  • File trees — the same line syntax family

21 - Video

Embed product demos, screen recordings and muted loops that replace GIFs, and link YouTube, Bilibili or Vimeo talks without contacting the platform until a reader clicks.

A video is written like an image, ![name](tour.mp4), with an optional attribute line below it. A video file plays in the page’s own <video> element, so it needs no configuration and no third-party service. A YouTube, Bilibili or Vimeo URL in the same place becomes a card that links to the platform; it plays in the page only on a site that has opted that platform in, because playing there connects the reader to the platform.

Use a file for product demos, screen recordings and the short silent loops usually published as animated GIFs, and a platform card for talks and interviews that already live on a video site. A video file gets the theme’s control row under the picture: play, the elapsed time, one progress bar, the duration, speed, captions, sound and full screen. The bar is a single track in three colors: played time in the page’s accent color, buffered time a deeper neutral and the rest a light one. Clicking the picture also plays or pauses. Platform embeds use the provider’s controls.

Shortest form

Source
![A tour of three OINK pages](tour.mp4)

The file sits beside this page in its bundle: a 9-second, 1200×600 MP4 of 123 KB. The bracket text is the player’s accessible name, so write it as you would alt text. When it is empty the caption names the player, and when both are empty the theme warns and falls back to the file name (or the watch URL for platform links).

The player uses preload="metadata", so until the reader presses play the browser fetches only enough to show the duration. Without a known size the box reserves 16:9, then takes the video’s own shape once its metadata arrives; add a local poster or width and height if the video is not 16:9 and you want zero layout shift.

Like a block image, a video needs markup.goldmark.parser.wrapStandAloneImageWithinParagraph: false; see Images · Inline versus block.

Where videos come from

Video files resolve in the same order as images:

Placement How it is written Recognized by
Beside the page (a bundle) ![…](tour.mp4) Hugo media type video/*
Current section bundle ![…](post/tour.mp4) Hugo media type video/*
Global resource assets/… ![…](videos/tour.mp4) Hugo media type video/*
Static directory static/… ![…](/videos/tour.mp4) Extension mp4, m4v, webm, ogv or mov
Object storage or a CDN ![…](https://cdn.example.com/tour.mp4) The same extensions

A path that matches no resource is written out as a static path, and the theme checks neither static paths nor remote URLs. Only the path part decides the extension, so a signed URL such as …/tour.mp4?sig=… is still a video, while a destination with any other extension stays an image: https://example.com/stream?id=42 renders as a broken <img>.

Inline versus block

Only a video in a paragraph of its own becomes a player. Inside a sentence it is a plain link to the file, with the bracket text as the link text:

Source
Inside a sentence, ![the same tour](tour.mp4) is a link to the file.

Inside a sentence, the same tour is a link to the file.

An inline platform URL links to its watch page. Inline videos take no attributes.

Poster, subtitles and caption

Source
![A tour of three OINK pages](tour.mp4)
{caption="The documentation shell, its Docsy upstream and a release page, in nine seconds" poster="tour-poster.jpg" track="tour.en.vtt"}
A tour of three OINK pages
The documentation shell, its Docsy upstream and a release page, in nine seconds
  • poster is the picture shown before playback, found the same way as an image. A local raster poster also gives the player its width and height (1200×600 here), so the box has the right shape before the video loads.
  • track is one WebVTT subtitle file, found the same way. The theme writes kind="subtitles", takes srclang from the page language, labels the track with the language name and turns it on by default. Each translation names its own file: the Chinese page uses tour.zh.vtt. Keep .vtt files on the same origin (in the page bundle or static/) when possible; when track is a remote URL, <video> adds crossorigin="anonymous", so both the subtitle and video hosts must send CORS headers.
  • caption is plain text in a <figcaption>, exactly as for images; it is not parsed as Markdown.

num makes the video a numbered Book figure, as for an image: the caption gains a “Figure N” prefix in the page’s language, #id defaults to fig-<num>, and links and xref can reach the video. See Books.

Size

width and height take positive integers and must be given together; they set the player or card box’s aspect ratio, overriding the poster’s ratio while leaving the poster image’s own dimensions intact in Print and RSS. Use them for a video without a local poster whose shape is not 16:9:

Source
![A 4:3 screen recording](https://cdn.example.com/oink/settings.mp4)
{width="1024" height="768"}

Unlike image sizes they do not shrink a landscape player, which spans the reading width; portrait boxes still cap at 80% of the viewport height and center horizontally. A non-positive value or a single dimension without its pair warns and is ignored.

Looping demos instead of GIFs

Source
![OINK switching between light and dark](appearance.mp4)
{autoplay=true poster="appearance-poster.jpg" caption="A muted loop: it plays while in view and pauses when you scroll away"}
OINK switching between light and dark
A muted loop: it plays while in view and pauses when you scroll away

autoplay=true is for the short, silent demos usually published as animated GIFs, and it costs far less: this 6-second clip is 246 KB, while the same clip as a 15 fps GIF is 4.4 MB and cannot be paused.

The video is written out muted loop with a data-td-media-autoplay marker but without the autoplay attribute, and the small js/chunks/media.js runtime plays it only while all three of these hold:

  • at least half of the video is visible;
  • the page itself is visible, not in a background tab;
  • the reader has not asked for reduced motion.

It pauses as soon as one stops holding. If the reader pauses or plays the video, their choice wins until it next leaves the viewport. The control row stays, so the motion can always be stopped (WCAG 2.2.2, Pause, Stop, Hide) and the sound turned on. Without JavaScript nothing starts by itself: the reader sees the poster and presses play. autoplay=false is the same as leaving it out, and any other value warns and counts as false.

Video platforms

A YouTube, Bilibili or Vimeo URL renders as a card:

Source
![Pigsty: an OSChina interview](https://www.bilibili.com/video/BV1o3411w7hP)
{caption="OSChina talks with this site's author about Pigsty, 2022"}
OSChina talks with this site's author about Pigsty, 2022

The card is one link to the watch page, showing the poster or a plain surface, a play glyph, the bracket text and the platform name. The browser loads any poster you supply from its URL. The card fetches no platform thumbnail or player before activation. This site has opted Bilibili in, so a click on the card above loads the player in place; see the next section.

The accepted URLs:

  • YouTube: youtube.com/watch?v=ID, music.youtube.com/watch?v=ID, youtu.be/ID, youtube.com/shorts/ID, /live/ID, /embed/ID, and youtube-nocookie.com/embed/ID, with an 11-character ID. t, start or #t= sets the start time, in seconds (90) or as 1m30s. Shorts default to a 9:16 frame unless a poster or width/height overrides it.
  • Bilibili: bilibili.com/video/BV…, bilibili.com/video/av…, b23.tv/BV… / b23.tv/av…, or the src of Bilibili’s embed code, https://player.bilibili.com/player.html?bvid=… (or ?aid=…; prefix the // it is copied with by https:). An embed URL can select a part by its numeric cid. Otherwise p selects the part by number. t sets the start time.
  • Vimeo: vimeo.com/NUMBER, vimeo.com/manage/videos/NUMBER, or player.vimeo.com/video/NUMBER, with /HASH or ?h=HASH for an unlisted video. #t= or t sets the start time.

A start time in any other form, such as t=1:30, warns and the video starts at 0; write it as seconds or in 1h2m3s form.

Hosts may carry www. or m.. The theme validates the video ID and builds the player address from it, so no author text ever reaches an iframe. A URL on these hosts without a recognizable ID warns and renders a card without a player. So does an opaque b23.tv short link (such as b23.tv/abc), which cannot be resolved without the network; write the full bilibili.com/video/BV… URL instead.

Cards accept caption, num, id, poster, width and height; track and autoplay warn on a card. The theme never fetches the platform’s thumbnail, so save a still into the bundle as the poster if you want a picture.

Playing in place

Every platform card only links out until the site opts its platform in:

hugo.yml
params:
  video_embeds: [bilibili, youtube]

params.video_embeds is a list drawn from youtube, bilibili and vimeo, and it is empty by default. Playing in place loads the platform’s player in your page, and the reader’s browser then talks to the platform, which sees their address and applies its own privacy terms. Whether that is acceptable is the site owner’s decision, so nothing loads until you list the platform. A list rather than a switch lets you play one platform in place and only link to another that part of your audience cannot reach; this site plays Bilibili and YouTube in place and leaves Vimeo as a link. A value that is not a list warns and leaves every card as a link, and an unknown name warns and is ignored.

For an opted-in platform, a plain click replaces the card with the platform’s player and moves focus into it. The player takes the bracket text as its title, loads in a sandboxed iframe (allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox, allow="autoplay; picture-in-picture; fullscreen", referrerpolicy="strict-origin-when-cross-origin"), and starts at once from the URL’s start time. A click with Ctrl, Cmd, Shift or Alt, or with the middle button, still opens the link, and without JavaScript the card stays a link. Each player loads with its platform’s most private settings:

Platform Player host Privacy setting
YouTube www.youtube-nocookie.com The privacy-enhanced domain
Bilibili player.bilibili.com Danmaku (scrolling comments) off
Vimeo player.vimeo.com dnt=1, do not track

If your site sends a Content Security Policy, add the hosts of the platforms you list to frame-src: player.bilibili.com, www.youtube-nocookie.com and player.vimeo.com. Otherwise the browser blocks the player after the click.

Large files

A video in a page bundle is committed to Git with the page, which suits clips like the two on this page, 123 KB and 246 KB. Anything beyond a few megabytes makes every clone of the repository heavier, so upload it to object storage or a CDN and write its HTTPS URL. The poster and subtitle file can stay in the bundle:

Source
![Installing Pigsty on a fresh node](https://cdn.example.com/oink/install.mp4)
{poster="install-poster.webp" track="install.en.vtt" caption="A single-node install, start to finish"}

Use a stable public URL on a host that supports HTTP Range requests (standard on object storage and CDNs) so browsers can read metadata and seek without downloading the whole file. A signed URL that expires breaks the page later, and the theme does not check remote files. An H.264 MP4 plays in every current browser, and a command such as this keeps a screen recording small:

ffmpeg -i recording.mov -c:v libx264 -crf 28 -preset slow -pix_fmt yuv420p -an -movflags +faststart demo.mp4

-an drops the sound track, which a muted loop never plays, and +faststart puts the index first so the browser can show the duration without downloading the whole file.

Output

In HTML a video is a <figure class="td-media td-media--video"> around a native <video controls preload="metadata" playsinline>, whose controls the shared script swaps for the theme’s .td-media__controls row; a caption or number adds td-figure and a <figcaption>, and a platform URL is an <a class="td-media-card"> that carries data-td-media-embed when its platform is opted in. Paper and feeds have no player, so Print and RSS show the poster if there is one, the name as a link, the platform name when applicable, the full file or watch URL, and the caption, with absolute URLs in RSS. Printing the HTML page from the browser shows the poster or the current frame with the file or watch URL below it, and still prints the title, platform and watch URL even after an opted-in card has been replaced by an iframe. Markdown and LLMS output keep the image line and attribute line as written.

Parameter reference

The attribute line {…} directly after a block video:

caption , plain text , default—
Figure caption; not parsed as Markdown
#id , identifier , defaultfig-<num> when num is set
The figure’s anchor and Book target ID
num , string , default—
Book figure number; registers a fig target and prefixes the caption with “Figure N”
poster , path , default—
Image shown before playback, resolved like an image; a local raster supplies width/height
track , path , default—
One WebVTT subtitle file, on by default; srclang is the page language; files only
autoplay , true / false , defaultfalse
A muted loop that plays while in view; files only
width / height , positive integer , defaultthe poster’s size, else 16:9
Aspect ratio of the box; the player still spans the reading width
class , class list , default—
Passed through to the figure for site CSS
data-* / aria-* , string , default—
Passed through to the figure

link, command, options and other keys warn as unknown attributes and are dropped; style warns as unsafe. Hugo strips on* handlers before the theme sees them, so they are dropped silently.

The site setting:

params.video_embeds , list , default[]
Platforms whose player loads in place after a click: youtube, bilibili, vimeo

Limits

  • One subtitle track per video. Each language page names its own file; there is no track list or subtitle menu.
  • One source file: no codec fallbacks across several <source> elements, no adaptive streaming (HLS or DASH), and no chapters or playlists.
  • The captions button switches the one track on and off. Safari may start with it off when the reader’s system caption setting asks for that.
  • Full screen shows the picture with the control row below it. On iPhone the system player takes over with its own controls.
  • Site single-key shortcuts yield while focus is in the player’s controls.
  • Three platforms only. Other video sites and arbitrary iframe addresses are not supported; link to them in prose.
  • No remote thumbnails. A card shows your poster or a plain surface.
  • width and height set the aspect ratio, not pixel dimensions, and must be paired. A player or card is never taller than 80% of the viewport, so a portrait recording is pillarboxed inside <video> and a portrait card or embedded player centers within that height.
  • Static paths and URLs are recognized by extension only, so a streaming URL without a video extension renders as an image.
  • The theme measures no file sizes and checks no static or remote files.
  • Images — the same syntax, attribute line and figure numbering
  • Audio — recordings with a visible title and a transcript
  • Asciinema — terminal sessions as selectable text, not video
  • Books — numbered figures and xref cross-references

22 - Audio

Put a podcast episode, voice sample or recorded talk on a page with image syntax, as a titled player with its transcript beside it.

Write an audio file the way you write an image, ![title](episode.mp3), and it becomes a titled player. Use it for podcast episodes, voice samples, pronunciation guides and recorded talks. There is no shortcode to learn and nothing to configure. A small shared script gives the player the theme’s control row: play, the elapsed time, one progress bar, the duration, speed and sound. The bar is a single track in three colors: played time in the page’s accent color, buffered time a deeper neutral and the rest a light one. The script also pauses other audible players when you start a recording. With JavaScript off, the browser’s own controls remain.

Shortest form

Source
![Welcome to OINK](welcome-en.mp3)
Welcome to OINK

A recording has no picture, so the bracket text does the work alt text does for an image: it is both the visible title and the player’s accessible name (linked via aria-labelledby). If you leave it empty, the build warns and the file name becomes the title; Markdown inside the brackets is shown as plain text, and any Markdown "title" after the URL is ignored. Do not wrap an audio image inside a Markdown link ([![…](episode.mp3)](…)): the native player already contains a fallback link, so wrapping it produces invalid nested <a> markup.

The first six audio players on a page default to preload="metadata", so the duration appears without downloading the recording; from the seventh player onward, the default switches to preload="none" to avoid a burst of metadata requests on long sample pages. The count follows Hugo’s render order: players written directly in the page come first, then players inside shortcode bodies such as tabs, includes and cards. You can override either default with {preload="none"} or {preload="metadata"}; set {preload="metadata"} explicitly on a player inside a shortcode that must show its duration.

This file is an 8-second, 50 KB MP3 stored beside the page in its bundle. Like a block image, the player needs markup.goldmark.parser.wrapStandAloneImageWithinParagraph: false, one of the site prerequisites.

Where audio comes from

Audio files are looked up in the same order as images and video:

Placement How it is written Recognized by
Beside the page (a bundle) ![…](welcome-en.mp3) Extension mp3, m4a, aac, oga, ogg, opus, wav or flac, in any letter case
Current section bundle ![…](post/episode.mp3) The same extensions
Global resource assets/… ![…](audio/episode.mp3) The same extensions
Static directory static/… ![…](/audio/episode.mp3) The same extensions
Object storage or a CDN ![…](https://cdn.example.com/episode-12.mp3) The same extensions

Hugo defines no audio/* media type of its own. If your site declares one in mediaTypes, a page or global resource of that type is audio whatever its file name.

Query parameters and Media Fragments such as #t=30,60 are preserved on both local resources and remote URLs, exactly as written (percent-encoding included), so you can cue an excerpt without cutting a separate file:

Remote episode with time fragment
![Episode 12: Leaving Sass for plain CSS](https://cdn.example.com/podcast/episode-12.mp3#t=30,90)
{caption="OINK Radio · recorded November 2026" preload="none"}

A recording in a page bundle is committed to Git with the page, which suits short samples like the two on this page. Upload a full-length episode to object storage and write its HTTPS address instead, as described for large video files. The theme does not check that a static or remote file exists, so open the page and press play once after you publish.

Inline versus block

Only audio in a paragraph of its own becomes a player. Inside a sentence it is an ordinary link to the file, with the bracket text as the link text:

Source
Inside a sentence, ![the welcome recording](welcome-en.mp3) is a link to the file.

Inside a sentence, the welcome recording is a link to the file.

Inline audio takes no attribute line.

Captions and sample sets

caption adds a line of plain text after the title, which wraps below it on a narrow screen (and is linked to the player via aria-describedby). Audio figures that follow each other directly sit closer together, so a set of samples reads as one group, and starting one player automatically pauses any other active player on the page:

Source
![Welcome to OINK, in English](welcome-en.mp3)
{caption="The tagline read aloud"}

![Welcome to OINK, in Chinese](welcome-zh.mp3)
{caption="The same sentence in Simplified Chinese"}
Welcome to OINK, in English The tagline read aloud
Welcome to OINK, in Chinese The same sentence in Simplified Chinese

The caption is not Markdown. Leave the duration out of it: the player already shows one, and it cannot drift from the file the way typed text can. Add #id to give the figure an anchor that a link can point to. If another audio or video figure or a numbered figure on the page already uses that ID, the build warns and the later of the two loses it. Headings and plain images are not checked, so keep their IDs distinct yourself.

Transcripts

Put the transcript, show notes or lyrics right after the player as ordinary content. A folded [!DETAILS] callout placed directly after an audio figure tightens the gap between them so the pair reads as one unit, while keeping a long transcript out of the way until a reader wants it. Give each transcript a distinct title so screen-reader and keyboard users can tell them apart:

Source
![Voice sample 1 · English](welcome-en.mp3)

> [!DETAILS]- Transcript: Voice sample 1
> OINK is a local-first Hugo theme. Every component reads as Markdown,
> prints on paper, and needs nothing but the Hugo binary.

![Voice sample 2 · Chinese](welcome-zh.mp3)

> [!DETAILS]- Transcript: Voice sample 2
> OINK 是一个本地优先的 Hugo 主题。每个组件都能当作 Markdown 阅读,可以打印成纸面,而且只需要 Hugo 这一个程序。
Voice sample 1 · English
Transcript: Voice sample 1

OINK is a local-first Hugo theme. Every component reads as Markdown, prints on paper, and needs nothing but the Hugo binary.

Voice sample 2 · Chinese
Transcript: Voice sample 2

OINK 是一个本地优先的 Hugo 主题。每个组件都能当作 Markdown 阅读,可以打印成纸面,而且只需要 Hugo 这一个程序。

A transcript is the text alternative WCAG 1.2.1 asks for prerecorded audio, and it also serves anyone who cannot play sound where they are. Print and RSS show folded callouts expanded, so the transcript is complete there too. See Callouts · DETAILS.

Output

Paper and feeds cannot play sound, so static outputs replace the player with a usable link:

  • Dedicated Print (/_print/) and browser printing show the title, the caption, and the recording’s full clickable URL on its own line in ink on paper, regardless of the screen color mode.
  • RSS links the title directly to the recording’s absolute URL, with the caption beside it.
  • Markdown and LLMS keep your authored image line and attribute line as written, and a following transcript callout remains plain readable text.
  • Copying from the page preserves the title, caption, start alignment and clickable recording URL in rich text.

Parameter reference

The attribute line {…} directly after a block audio file:

caption , plain text , default—
Shown after the title and linked via aria-describedby; not parsed as Markdown
#id , identifier , default—
The figure’s anchor; one already used by another media figure or a numbered figure warns and drops
preload , metadata | none , defaultmetadata (first 6), none (7th+)
Controls whether the browser fetches audio metadata before playback
class , class list , default—
Added to the <figure class="td-media td-media--audio"> for site CSS
data-* / aria-* , string , default—
Passed through to the figure

num, poster, autoplay, track, width, height, link, command, options and any other key warn as unknown and are dropped; style warns as unsafe. Hugo strips on* handlers before the theme sees them, so they are dropped silently. A recording takes no figure number, because it is not a figure in the Book sense.

Limits

  • No cover art, chapters or waveform: the title and caption are the whole frame.
  • Single-active playback: a player that becomes audible, by starting with sound or by being unmuted while it plays, pauses the other audible <audio> and <video> players on the page. Muted or silent players, such as autoplay loops, keep running. Opening a platform card pauses audible players; once playing, that cross-site player cannot be paused locally.
  • The speed button cycles 1×, 1.25×, 1.5×, 2× and 0.75×. The volume bar opens beside the speaker button when you point at or focus it; touch screens use the device’s own volume buttons.
  • The control row looks the same in every browser and follows the preset and light or dark mode. Without JavaScript, the browser’s native player and its own styling remain.
  • Site single-key shortcuts yield while focus is in the player’s controls.
  • One source file per recording, with no fallback formats. MP3 plays in every current browser.
  • No podcast feed: the RSS output carries no <enclosure>, so podcast distribution is up to the site.
  • Video — the same syntax for video files and video platforms
  • Callouts — the folded [!DETAILS] block that holds a transcript
  • Images — the attribute line and image lookup order shared by media

23 - Asciinema

Embed a .cast terminal recording that readers can play, pause and copy text from, with the player shipped in the theme.

asciinema plays a .cast terminal recording in the page. Use it when a command-line procedure is easier to follow when watched: an installation, a migration, a long-running build. Unlike a video, the terminal output stays text, so readers can pause and copy a command out of the player, and the three-minute installation on this page weighs about 196 KB. For graphical interfaces, use screenshots or a video instead. The player and its styles ship with the theme, so nothing is downloaded at build time and no CDN is contacted.

Shortest form

file is the only required parameter:

Source
{{< asciinema file="images/install.cast" >}}

images/install.cast — /images/install.cast

This is a single-node Pigsty installation on Debian, recorded in a 120×36 terminal: 6 min 42 s of real time, which its 0.5 s idle limit plays back in about 3 minutes. To try it on your own site, download the sample recording to static/images/install.cast. file is a path from the site root, and the same value also finds a file under assets/, because the theme looks for a global resource first. Page-bundle files are not found. Without title, the window title shows the value of file.

Window title and theme

title names the window and theme sets the terminal colors:

Source
{{< asciinema file="images/install.cast" title="Pigsty single-node install" theme="dracula" >}}

Pigsty single-node install — /images/install.cast

The default, theme="auto", follows the site: td-light in light mode and td-dark in dark mode, and the player redraws in place when the reader switches. Any other value fixes the palette in both modes: the player’s own asciinema, dracula, gruvbox-dark, monokai, nord, seti, solarized-dark, solarized-light and tango, or the theme’s td-light and td-dark. A fixed light palette such as solarized-light looks out of place on a dark page, so prefer auto unless the recording needs its own colors. The terminal font is always the site’s code font.

Speed, start point and poster

For a long recording, speed sets the playback rate, startAt skips the opening, and poster chooses the frame shown before the reader presses play:

Source
{{< asciinema file="images/install.cast" title="From 60 seconds in, at double speed"
  speed="2" startAt="60" poster="npt:1:30" >}}

From 60 seconds in, at double speed — /images/install.cast

speed and startAt are numbers, startAt in seconds. poster uses the player’s npt: time notation, so npt:1:30 is the frame at one minute thirty: the player above shows that frame and starts playing from second 60.

idleTimeLimit shortens every silent stretch to at most that many seconds. This recording needs none, because its .cast header already sets idle_time_limit: 0.5; use it for a recording made without an idle limit.

Chapter markers

markers puts named chapters on the progress bar, so a reader can jump to the part of a long recording they came for. Write each chapter as time:label, with the time in seconds, and separate chapters with commas:

Source
{{< asciinema file="images/install.cast" title="Pigsty install in chapters" preload="true"
  markers="5:Download, 26:Deploy playbook, 56:Infrastructure, 118:PostgreSQL, 169:Recap" >}}

Pigsty install in chapters — /images/install.cast

Hover a mark to read its label; with the player focused, [ and ] jump to the previous and next chapter. The marks appear once the recording has loaded, so pair markers with preload="true" when they should show before the reader presses play. pauseOnMarkers="true" stops at every chapter, which suits a walkthrough the reader steps through.

Times count on the player’s clock, after the idle limit (idleTimeLimit, or the one in the .cast header) has shortened the silences, so take them from the player’s timer rather than from the .cast file. A label may contain colons but not commas, and a chapter written as a bare time has no label.

Size and fit

The player takes its terminal size from the .cast header and scales to the width of the column (fit="width"). cols and rows override the header:

Source
{{< asciinema file="images/install.cast" title="Only 16 rows tall" rows="16" >}}

Only 16 rows tall — /images/install.cast

A size smaller than the recording clips it: the player above shows 16 of the 36 rows. Use cols and rows to correct a header that has the wrong size, not to make the player smaller; for a shorter player, record again in a smaller terminal.

fit decides how the terminal scales: width (the default) fits the column width, height fits the container’s height, both fits both, and none keeps the font at its natural size, so a wide terminal overflows the column.

Looping and preloading

loop starts again at the end. preload fetches the recording as soon as the player appears, so it starts without a pause when the reader presses play:

Source
{{< asciinema file="images/install.cast" title="Looping: the first minute after login"
  startAt="0" speed="3" loop="true" preload="true" >}}

Looping: the first minute after login — /images/install.cast

autoplay="true" starts playback without a click. Avoid it: the reader’s “reduce motion” setting only turns off the player’s control animations, not autoplay, so a moving terminal is forced on everyone. If you must autoplay, keep the clip very short, add loop, and use one per page.

Inside steps

A recording works best beside the step it shows: the text says what to do, the recording shows what happens.

Source
1. Install the dependencies and fetch the installer:

   ```sh
   curl -fsSL https://repo.pigsty.io/get | bash
   ```

2. Run the install; the recording plays the process at four times speed:

   {{< asciinema file="images/install.cast" title="pig install" speed="4" >}}

3. Open `http://<node address>:3000` and sign in to Grafana with `admin / pigsty`.
{.steps}
  1. Install the dependencies and fetch the installer:

    curl -fsSL https://repo.pigsty.io/get | bash
  2. Run the install; the recording plays the process at four times speed:

    pig install — /images/install.cast

  3. Open http://<node address>:3000 and sign in to Grafana with admin / pigsty.

A page can hold any number of players; the script and styles load once.

Recording a cast file

Record with asciinema, for example asciinema rec --idle-time-limit=2 --cols=100 --rows=28 install.cast, and check the result with asciinema play install.cast before you commit it.

  • Keep the terminal under 100 columns so the text stays legible on a phone, and run clear before you start.
  • Remove secrets before you record. A .cast file is plain text, so every character typed or printed can be found with grep; read the file before committing it.
  • Commit the file to your site, for example as static/images/install.cast with file="images/install.cast", rather than pointing at another site’s .cast. A remote recording breaks when that site moves it.

Output

Print, RSS and the page’s Markdown output have no player: each shows the recording as a link with its title. Readers of a printed page, feed readers and tools that read llms.txt therefore get only that link and your prose, so write the key commands and their output beside the recording as text or code.

Parameter reference

file , path (required) , default—
Named, or the first positional parameter. Looked up as a global resource in assets/, then as a path from the site root; an http or https URL is used as is
title , plain text , defaultthe value of file
The window title
theme , enum , defaultauto
auto follows the site’s color scheme; or td-light td-dark asciinema dracula gruvbox-dark monokai nord seti solarized-dark solarized-light tango
fit , enum , defaultwidth
width height both none
cols / rows , positive integer , defaultfrom the .cast header
Override the terminal size; smaller than the recording clips it
speed , positive number , default1
Playback rate
startAt , number (seconds) , default0
Where playback starts
idleTimeLimit , number (seconds) , defaultfrom the .cast header
Longest a silent stretch plays for
poster , string , default—
The frame shown before playback, npt:mm:ss
autoplay , "true" / omitted , defaultoff
Play without a click; not recommended
loop , "true" / omitted , defaultoff
Replay at the end
preload , "true" / omitted , defaultoff
Fetch the recording as soon as the player appears
pauseOnMarkers , "true" / omitted , defaultoff
Pause at chapter markers
markers , time:label,time:label , default—
Named chapters on the progress bar, times in seconds on the player’s clock; see Chapter markers

The on/off parameters are on only when their value is the text true, so loop="true" and loop=true both work and anything else means off. Other invalid values warn and fall back: an unknown fit uses width, a speed that is not a positive number uses 1, a non-numeric startAt uses 0, and non-numeric cols, rows, idleTimeLimit or marker times are ignored. A file with another scheme, a protocol-relative //host address, or an empty value warns and renders nothing.

Limits

  • The player needs JavaScript. With scripts off, the window frame holds a link to the recording instead.
  • Site search indexes page text, not recordings, so a command that appears only in a recording cannot be found.
  • Few readers finish a recording longer than five or six minutes. Split a long procedure into short recordings, each with its own text.
  • Code blocks — the key commands and output, copyable
  • Steps — the recording beside the step it belongs to
  • Images — static screenshots: recordings for terminals, screenshots for graphical interfaces
  • Include — when the same commands appear on several pages

24 - Social

Quote a post from X, Bluesky, Mastodon, or another platform with a > [!SOCIAL] callout. The page supplies the quote and attribution without a platform script, and plain Markdown viewers show an ordinary blockquote.

When an article cites something posted on X, Mastodon or another network, a > [!SOCIAL] callout quotes it as a card: avatar, name, handle, platform icon, the post text and a dated link to the original. You write all of it into the page, so the quoted text stays readable after the original is edited or deleted. A local avatar and local attachments keep the card entirely on your site, and the card takes its colors from the site’s preset and color scheme.

The source is an ordinary blockquote. GitHub, an editor preview or Obsidian shows the name, the post text, its images and any quoted post without the theme. To quote a book or a paper, a plain blockquote is enough.

Shortest form

The callout title names the author. Write the handle as a code span after the name, then the post text in Markdown.

Source
> [!SOCIAL] Ron `@RonVonng`
>
> PostgreSQL is not just a relational database; it is a data-management framework capable of absorbing almost every workload. Replacing Kafka, Elasticsearch, MongoDB, and Redis with Postgres is a practical way to cut system complexity.
Ron @RonVonng

PostgreSQL is not just a relational database; it is a data-management framework capable of absorbing almost every workload. Replacing Kafka, Elasticsearch, MongoDB, and Redis with Postgres is a practical way to cut system complexity.

  • The title renders as written, inline Markdown included. Its code span is the handle: the card shows it under the name, isolated as left-to-right text. Writing the handle as code also keeps a Markdown viewer from turning @user@instance into an email link.
  • The empty > line after the title is optional for Hugo. It keeps a viewer that does not know [!SOCIAL], such as GitHub, from joining the title and the first line of the post into one paragraph.
  • Without avatar, the card draws the first character of the title’s plain text in a circle, after removing leading @, spaces, and invisible characters such as a zero-width space. Emoji and combining marks stay whole, and a person icon replaces an empty result. The card never requests a default image or a Gravatar.

A complete card

The other facts go in a block attribute line directly under the callout, with no blank line between them:

Source
> [!SOCIAL] Ron `@RonVonng`
>
> Released `pig`, the PostgreSQL extension package manager and Pigsty CLI. One command configures PG repositories on mainstream Linux distros and installs **hundreds of PostgreSQL extensions** through the native package manager.
>
> ![The pig.pgsty.com home page showing the Postgres Install Guide CLI](/case/pig/featured.webp)
{avatar="images/ron-vonng.webp" date="2024-12-23" url="https://x.com/RonVonng/status/1871040275575124082" platform="x"}
Ron @RonVonng · X

Released pig, the PostgreSQL extension package manager and Pigsty CLI. One command configures PG repositories on mainstream Linux distros and installs hundreds of PostgreSQL extensions through the native package manager.

The pig.pgsty.com home page showing the Postgres Install Guide CLI

· View original — Ron @RonVonng

  • avatar resolves like any image. A value with a URL scheme is a remote image that the reader’s browser loads directly. Any other value is looked up as a page resource (or a resource of the section’s branch bundle), then a global resource in assets/, and otherwise used as a path to the site’s static files. Prefer page or assets/ resources, which the build always finds. The name sits beside the avatar, so it is decorative (alt=""). The card shows it small and crops it to fill its frame, so use a square image.
  • date is plain text, shown as written. A year-month (2026-11), a date (2026-11-23), or a date and time with hours and minutes, optional seconds, and an optional Z or ±HH:MM offset (2026-11-23 08:30, 2026-11-23T08:30:00+08:00) on a real calendar day becomes a machine-readable <time datetime>; a space before the time is written as T in the attribute. Anything else, including fractional seconds or a +0800 offset, renders as plain text without <time>.
  • url turns the date line into a “View original” link. Give the post’s HTTP(S) address (which receives rel="external") or a site-internal path; an invalid URL warns and is dropped. It is optional, so you can still quote a post that no longer exists.
  • The attached image is an ordinary Markdown image. This page turns on image zoom, so it opens at full size.
  • Block attributes need markup.goldmark.parser.attribute.block: true, the setting OINK already requires for callout icons and native Book figures.

Platforms

platform selects the brand icon and the platform name that screen readers and RSS carry, and nothing else: every platform shares one layout, the preset owns the colors, and the card never imitates a platform’s own interface. Without platform the card shows no icon, so name the platform the post came from.

platform Icon
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 (default) None (omits icon and platform name)
Source
> [!SOCIAL] Ron `@ron@fosstodon.example`
>
> OpenAI runs a single unsharded PostgreSQL cluster (one primary with 40+ read replicas) for its core workload. Vertical scale plus disciplined indexing still goes a very long way.
{platform="mastodon" date="2025-05-19 11:27" url="https://fosstodon.example/@ron/1002"}

> [!SOCIAL] `@pigsty.io`
>
> PostgreSQL is the Linux of databases: one kernel, hundreds of extensions, zero vendor lock-in.
{platform="bluesky"}
Ron @ron@fosstodon.example · Mastodon

OpenAI runs a single unsharded PostgreSQL cluster (one primary with 40+ read replicas) for its core workload. Vertical scale plus disciplined indexing still goes a very long way.

· View original — Ron @ron@fosstodon.example

@pigsty.io · Bluesky

PostgreSQL is the Linux of databases: one kernel, hundreds of extensions, zero vendor lock-in.

The second card is quoted by handle alone, so it has no name, date or link. Screen readers hear the platform name, which the card carries as visually hidden text beside the decorative icon. An unknown or empty platform warns and shows no icon. The handle appears exactly as written, because the theme adds no @ and knows no per-platform rules: write @name for X and @user@instance for Mastodon.

The body

The body is the callout’s own Markdown, rendered with the page, so paragraphs, links, inline code, lists and footnotes work as usual. Everything else a post can contain is written with syntax OINK already has, which is why the card has no attributes for it.

Post content Write it as
Text, links, code Ordinary Markdown
One attached image A Markdown image; image zoom applies when it is eligible
Several images A gallery fence in the body
A quoted post A nested > [!SOCIAL]; see Quoted posts
A video A video written as an image, ![name](clip.mp4)
Source
> [!SOCIAL] Ron `@RonVonng`
>
> One PostgreSQL documentation theme, two color schemes:
>
> ```gallery
> ![The OINK home page in light mode](/images/hero-light.webp)
> ![The OINK home page in dark mode](/images/hero-dark.webp)
> ```
{avatar="images/ron-vonng.webp" date="2026-11-24" platform="x"}
Ron @RonVonng · X

One PostgreSQL documentation theme, two color schemes:

Quoted posts

When the post quotes another, write the quoted post as a nested callout in the body. Its attribute line carries one >, so it belongs to the inner callout; the outer line follows without one. The inner card is compact (a smaller avatar, name and handle on one line) and keeps its own date and link. Leave platform off the inner card to keep the icon from repeating, or give it for a cross-platform quote.

Source
> [!SOCIAL] Ron `@RonVonng`
>
> PostgreSQL 17 is out — billed as the world's most advanced open-source database. Before long, "open-source" may be the redundant part.
>
> > [!SOCIAL] PostgreSQL `@PostgreSQL`
> >
> > News: PostgreSQL 17 Released!
> {date="2024-09-26" url="https://x.com/PostgreSQL/status/1839292604854223176"}
{avatar="images/ron-vonng.webp" date="2024-09-27" url="https://x.com/RonVonng/status/1839521052843442618" platform="x"}
Ron @RonVonng · X

PostgreSQL 17 is out — billed as the world’s most advanced open-source database. Before long, “open-source” may be the redundant part.

PostgreSQL @PostgreSQL

News: PostgreSQL 17 Released!

· View original — PostgreSQL @PostgreSQL

· View original — Ron @RonVonng

Missing or invalid input

Invalid input warns, and as long as there is a body, the quoted words are kept.

Input Result
No title, with body Warns; the body renders as a plain blockquote, without the card. url survives only as the quote’s cite attribute; date, platform and avatar are ignored
No title, empty body, with url Warns; renders a plain blockquote linking to url
Empty body, with url Warns; a link-only card with the author line and “View original”
Empty body, no url Warns; nothing renders
Unknown or empty platform Warns; no icon
[!SOCIAL]- or [!SOCIAL]+ Warns; the fold marker is ignored
Invalid url or avatar Warns; the attribute is dropped
Static avatar not under the project’s static/ Warns when static/ exists (ID social:avatar-static); keeps the path
Static avatar that climbs above the site root with .. Warns (ID social:avatar-static); the avatar is dropped and the card draws the initial instead
Unknown attributes Warn; ignored. class, data-* and aria-* pass to the card

Hugo’s x shortcode

Hugo ships its own x shortcode, {{</* x user="…" id="…" */>}}, and OINK leaves it alone. It asks X’s oEmbed service for the post at build time, so a clean build needs network access and the quote disappears when the post does. Use a [!SOCIAL] callout for quotes that must build offline and stay readable.

Output

The card loads no JavaScript. Print switches the card to the paper palette regardless of screen color mode and prints the original URL after “View original”. The Markdown and LLMS output keep the callout as written, with its attribute line, so an agent reads the same blockquote the author wrote. RSS carries the body (omitting <blockquote> on link-only cards) and an attribution line with absolute URLs, without the avatar.

Reference

Title , inline Markdown , default—
The identity line, required. A code span in it is the handle
avatar , image source , default—
Remote URL / page or branch-bundle resource / global resource / static path; decorative. Without it, the card draws the first character (or a user icon)
date , plain text , default—
Shown as written; a year-month, date, or date-time (HH:MM, optional seconds, optional Z or ±HH:MM) on a real day renders as <time datetime>
url , URL , default—
Original post (HTTP(S) or site-internal path); links the date line
platform , enum , defaultnone
x bluesky mastodon threads weibo zhihu telegram linkedin none; selects the icon and the announced platform name
Body , Markdown , default—
The post; may contain images, a gallery fence, a video, footnotes, or a nested [!SOCIAL]

There are no attributes for engagement counts, verification badges, image lists or quoted posts; images and quoted posts go in the body.

Limits

  • What you may quote, and which avatars and media you keep in the repository, is your decision. When the original no longer resolves, remove url; the quote itself stays.
  • There are no likes, reposts, view counts or verification badges, because such numbers are snapshots that go stale.
  • Platforms differ only by their icon; there are no platform skins or brand colors.
  • Threads, replies and polls are not modeled. Quote several posts as several cards, separated by a blank line.
  • A plain Markdown viewer shows the [!SOCIAL] marker and the attribute line as text, and no avatar, because the avatar is an attribute.
  • The static avatar check reads only the project’s own static/ directory, and only when it exists. A file that a module mount or a custom staticDir publishes also warns; list social:avatar-static under the site’s ignoreLogs to silence that warning. The build skips remote avatar checks. Prefer page-bundle or assets/ images and inspect the rendered card before publishing.
  • Callouts — the blockquote form this card shares
  • Images — attached images, sources, and the zoom switch
  • Gallery — several images in one post
  • Video — a video attached to a post
  • Cards — link cards, not quotations

25 - Cards

Turn a Markdown link list into a grid of navigation cards, and use the shortcode when cards need icons, badges or images.

Cards lay out a few parallel destinations so the reader can pick one at a glance: where to start, what to read next, which of three paths fits. Each card is a linked title with a sentence under it, and the grid adapts to the width of the page. A plain Markdown link list with {.cards} under it is all it takes, so the source stays an ordinary list on GitHub. Do not use cards for prose, which reads better as paragraphs, or for image collections, which belong in a gallery. A section’s own landing page usually needs no hand-written cards at all, because the theme can generate them from the child pages (automatic cards).

Shortest form

Put {.cards} on the line after a link list. Each link becomes a card title, and the text after — becomes its description:

Source
- [Get started](/docs/start/) — Start with OINK Starter, preview locally, then replace the site details with your own.
- [Authoring](/docs/write/) — How pages are organized and which front matter keys exist.
- [Customization](/docs/customize/) — Navigation, search, branding, languages.
{.cards}
  • Get started — Start with OINK Starter, preview locally, then replace the site details with your own.
  • Authoring — How pages are organized and which front matter keys exist.
  • Customization — Navigation, search, branding, languages.

The whole card is the click target, not just the title. The number of columns follows the available width, down to one on a phone, so there is no columns parameter.

Title-only cards

The description is optional: one link per item is enough.

Source
- [Callouts](/docs/components/callout/)
- [Tabs](/docs/components/tabs/)
- [Steps](/docs/components/steps/)
- [Fields](/docs/components/fields/)
{.cards}

Loose lists and longer descriptions

When a description needs more than a sentence, write a loose list: the link in one paragraph, the description in the next, and a blank line between items. The title then sits on its own line above the description. {.cards} still goes directly under the last paragraph, with no blank line in between.

Source
- [Front matter](/docs/write/frontmatter/)

  Every page parameter is defined here exactly once: type, default, accepted
  values, and the page that explains it.

- [Configuration](/docs/customize/config/)

  Site parameters grouped by feature, each row linking back to the guide that
  explains it.
{.cards}
  • Front matter

    Every page parameter is defined here exactly once: type, default, accepted values, and the page that explains it.

  • Configuration

    Site parameters grouped by feature, each row linking back to the guide that explains it.

Single-column list

For a directory of resources, where readers scan down rather than across, write {.cards .td-cards-list} instead of {.cards}. The cards become one column inside a single frame, separated by dividers, and each row grows with its description. The shortcode form takes cards variant="list" for the same result; any other variant warns and keeps the grid. Component presentation shows the grid and the list one after the other.

Icons and badges

A link list cannot carry icons, badges, images or a description with several paragraphs; the cards and card shortcodes can. icon is exactly one Font Awesome class pair, and badge is a short plain-text label beside the title.

Source
{{< cards >}}
{{< card title="Get started" link="/docs/start/" icon="fa-solid fa-rocket" badge="start here" >}}
Use OINK Starter and establish a local preview before customizing.
{{< /card >}}
{{< card title="Release and download pages" link="/docs/write/releases/" icon="fa-solid fa-box-open" badge="v0.5" >}}
A release card from `release_url` and `date`, plus a `checksums` block for download assets.
{{< /card >}}
{{< card title="Keyboard navigation" link="/docs/customize/keyboard/" icon="fa-solid fa-keyboard" >}}
Site-wide shortcuts and focus order.
{{< /card >}}
{{< /cards >}}
Get startedstart here

Use OINK Starter and establish a local preview before customizing.

An icon that is not a single class pair such as fa-solid fa-rocket warns, and the card renders without it.

Markdown bodies

The body of a card is ordinary Markdown, so it can hold inline code, emphasis, links and lists. Parameters such as title and badge are plain text.

Source
{{< cards >}}
{{< card title="Hugo Module" icon="fa-brands fa-golang" >}}
`hugo mod get github.com/pgsty/oink`. The recommended way; upgrading is one
version line.
{{< /card >}}
{{< card title="Git submodule" icon="fa-solid fa-code-branch" >}}
No Go installation needed:

- `git submodule add`
- the theme lands in `themes/oink`
{{< /card >}}
{{< /cards >}}
Hugo Module

hugo mod get github.com/pgsty/oink. The recommended way; upgrading is one version line.

Git submodule

No Go installation needed:

  • git submodule add
  • the theme lands in themes/oink

A card without link, like these two, shows its title in bold and links nowhere.

Cards with images

image puts a picture at the top of the card. It is looked up like ![alt](src): page resource, then the current section’s resources, then a global resource in assets/, then a static path such as /images/…, then a remote URL. Local images carry their width and height, so the page does not jump while they load.

Every image needs exactly one of image_alt="…", for an image that carries information, or decorative=true, for one that is only ornament. With both, the build warns and keeps the alt text; with neither, it warns and treats the image as decorative.

Source
{{< cards >}}
{{< card title="The OINK shell" link="/docs/about/features/" image="/images/oink.webp" image_alt="An OINK documentation page: sidebar, article and table of contents" >}}
Sidebar, article, table of contents — each can be turned off on its own.
{{< /card >}}
{{< card title="Release notes" link="/docs/write/releases/" image="/images/releasenote.webp" decorative=true >}}
A decorative cover: `decorative=true` emits an empty alt and screen readers skip it.
{{< /card >}}
{{< /cards >}}
An OINK documentation page: sidebar, article and table of contents

Sidebar, article, table of contents — each can be turned off on its own.

A decorative cover: decorative=true emits an empty alt and screen readers skip it.

Card images do not open in the image zoom dialog, because clicking anywhere on the card already follows its link.

Automatic cards on section pages

A section’s landing page (_index.md) can list its child pages as cards with no list in the source: the theme builds one card per child from its title, description and icon. This site turns that on for every section:

hugo.yml
params:
  ui:
    section_index: cards # list | cards

A section can choose differently in its own front matter, and cascade passes the choice down to its whole subtree:

content/docs/customize/_index.md
section_index: list

Generated and hand-written cards share the same styles; only the source of the data differs. Let the theme list a section’s child pages, because a hand-written list drifts out of step with the sidebar as pages are added or renamed. Write cards by hand for anything else, such as external links or recommendations from other sections. Configuration defines these keys.

Which form to use

What you want Which form
A grid of links with one-sentence descriptions {.cards} link list
Icons, badges, images cards / card shortcode
Lists, code or several paragraphs in the description cards / card shortcode
A card with no link cards / card shortcode
This section’s child pages nothing at all — section_index: cards

Use the link list whenever it can hold your content: it still reads as a list of links on GitHub, while shortcodes do not.

Output

Cards are pure CSS and load no script. In print, link-list cards stack in one column, shortcode cards fall back to two columns, and no card breaks across a page. In the page’s Markdown output, a link list stays as written and each shortcode card becomes a line - [Title](link) (badge) — description.

Parameter reference

The native form:

{.cards} , list attribute line , default—
On the line after an unordered list; unordered lists only. Add .td-cards-list for the single-column list
First link in an item , Markdown link , default—
The card title and the whole card’s click target
Everything else , Markdown , default—
The description: after — in a tight list, its own paragraph in a loose one

card parameters (cards itself takes only an optional variant="list"):

title , plain text , default—
Required, non-empty. The card title
link , URL , default—
Site path, relative path, http(s):, mailto:; external links get rel="noopener"
icon , Font Awesome class pair , default—
For example fa-solid fa-rocket; a malformed value warns and is dropped
badge , plain text , default—
A small label beside the title
image , image source , default—
Page resource / global resource / static path / remote URL
image_alt , plain text , default—
With image, exactly one of this and decorative
decorative , boolean , defaultfalse
true marks a decorative image and emits an empty alt
Body , Markdown , default—
The card description

There is no cols, columns, accent, desc or color parameter. Unknown parameters warn and are ignored.

Limits

  • {.cards} works on unordered lists only; on a numbered list it does nothing.
  • {.cards} must sit directly under the list. A blank line before it, or indentation that puts it inside the last item, loses the marker without a warning: the build succeeds and the list stays a list. When no grid appears, check that line first.
  • A card outside cards, alone or inside another shortcode, warns and is skipped.
  • Only automatic section cards take a column count, through params.ui.section_index_columns; hand-written grids always follow the width.
  • A description longer than two lines belongs in a paragraph or a callout.

26 - Timeline

Turn a Markdown definition list into a vertical timeline of dated or ordered events, for milestones, incident write-ups, product history or an agenda.

A timeline lays events along a vertical axis, each beside its marker: a date, a time, a version, “Day 2”, whatever puts the events in order. Use it for project milestones, the sequence of an incident, a product’s history or an agenda; Where a timeline fits compares it with steps, update entries and Gantt charts.

You write an ordinary Markdown definition list, one term per marker and one definition per event, and put {.timeline} on the line below it. The theme adds only CSS, so the source stays plain Markdown and the page loads no script.

Shortest form

Write each marker on its own line and its event on the next line after : , with a blank line between entries. Put {.timeline} directly under the last event.

Source
2024-03-12
: **v1.0.** First stable release: single-node installs on EL 9 and Ubuntu 24.04.

2024-11-05
: **v2.0.** Streaming replicas and automatic failover.

2025-09-30
: **v3.0.** PostgreSQL 18 becomes the default version.
{.timeline}
2024-03-12
v1.0. First stable release: single-node installs on EL 9 and Ubuntu 24.04.
2024-11-05
v2.0. Streaming replicas and automatic failover.
2025-09-30
v3.0. PostgreSQL 18 becomes the default version.

Both kinds of line break matter. {.timeline} must touch the last event: after a blank line Goldmark drops the attribute line and renders a plain definition list, while the theme logs a build warning naming the page. The blank lines between entries are required too, because without one the next marker becomes a line of the previous event’s text and its event attaches to the previous marker.

Markers

A marker is one line of free text. The theme does not parse it, so 2026-11, 09:02, v1.6.0, Day 2 and Q3 2026 – Q1 2027 all work, and events stay in the order you write them. Markers are set small and semibold with tabular figures, so times and dates line up; plain text suits them best.

Source
09:02 UTC
: **Alert.** The deploy workflow fails on the production branch.

09:14 UTC
: **Cause found.** A new page links to a heading that was renamed, and the link check stops the build.

09:40 – 10:15 UTC
: **Fix.** The link is corrected and the site rebuilds.

10:30 UTC
: **Resolved.** Production serves the new page.
{.timeline}
09:02 UTC
Alert. The deploy workflow fails on the production branch.
09:14 UTC
Cause found. A new page links to a heading that was renamed, and the link check stops the build.
09:40 – 10:15 UTC
Fix. The link is corrected and the site rebuilds.
10:30 UTC
Resolved. Production serves the new page.

On wide screens the marker column grows with the longest marker up to 10rem, and a longer marker wraps inside it. A marker cannot continue onto a second source line: every line directly above a : line is a marker of its own, so two marker lines in a row leave the first without an event (the axis still bridges across them).

Event content

An event is a definition, so it can hold continuation paragraphs, lists and fenced code, indented two spaces to the column after : . A bold phrase at the start is the usual event title; it is a writing convention, and the theme styles it as ordinary bold text.

Source
2025-09-30
: **v3.0.** PostgreSQL 18 becomes the default, and PostgreSQL 13 leaves the supported list.

  A cluster still on PostgreSQL 13 upgrades in two moves:

  - take a fresh base backup;
  - run `pg_upgrade` on the primary, then rebuild the replicas from it.

  ```bash
  pg_upgrade -b /usr/pgsql-13/bin -B /usr/pgsql-18/bin -d /var/lib/pgsql/13/data -D /var/lib/pgsql/18/data --link
  ```

Next release
: **Logical replication.** One command sets up publications and subscriptions between clusters.
{.timeline}
2025-09-30
v3.0. PostgreSQL 18 becomes the default, and PostgreSQL 13 leaves the supported list.

A cluster still on PostgreSQL 13 upgrades in two moves:

  • take a fresh base backup;
  • run pg_upgrade on the primary, then rebuild the replicas from it.
pg_upgrade -b /usr/pgsql-13/bin -B /usr/pgsql-18/bin -d /var/lib/pgsql/13/data -D /var/lib/pgsql/18/data --link
Next release
Logical replication. One command sets up publications and subscriptions between clusters.

The axis runs along the start edge of each event, so it stays unbroken however tall an event grows.

Several events under one marker

Write more than one : line under a marker for events that share it. They follow one another on the axis under a single node.

Source
2025-10-14
: **v3.0.1.** Fixes a failover timeout on clusters with more than three replicas.
: **v3.0.2.** The same day, a patch restores air-gapped installs, which 3.0.1 broke.

2025-12-02
: **v3.1.** Point-in-time recovery from the command line.
{.timeline}
2025-10-14
v3.0.1. Fixes a failover timeout on clusters with more than three replicas.
v3.0.2. The same day, a patch restores air-gapped installs, which 3.0.1 broke.
2025-12-02
v3.1. Point-in-time recovery from the command line.

Where a timeline fits

Content Use
Dated or ordered events inside prose a definition list + {.timeline}
A procedure the reader carries out Steps
Changelog entries, each with a heading in the TOC Update
A schedule with durations and dependencies a Mermaid Gantt chart

How it renders

Condition Layout
Viewport 576px and wider Two columns: markers end-aligned against the axis, events beside them; the marker column fits its content up to 10rem
Narrower viewport or inside cards One column: each marker above its event, with the axis and nodes on the start edge
Ink and Terminal presets Square nodes (0px in Ink, 2px radius in Terminal) instead of round ones
Forced colors The axis and nodes use the system text color
Right-to-left pages The axis moves to the right, and the whole layout mirrors while keeping timestamps in natural order

The styles apply only to dl.timeline inside article content, so definition lists without the marker, and any element your site already calls .timeline outside the article, are left alone.

Prerequisites

Definition lists are a Goldmark extension that Hugo enables by default. The attribute line needs Goldmark block attributes, one of the site prerequisites every component shares.

hugo.yml
markup:
  goldmark:
    extensions:
      definitionList: true # Hugo's default
    parser:
      attribute:
        block: true # enable {…} attribute lines

With definition lists turned off, each marker and its event render as one paragraph with a literal colon.

Output

Timelines load no JavaScript. Screen readers announce each marker and event as a term and its definition, in source order; the axis and nodes are decoration. Print switches the timeline to paper ink regardless of the screen color scheme, keeps each marker with its event and avoids breaking inside short events; Markdown and LLMS output keep the list and its {.timeline} line as written, and feed readers show a plain definition list.

Parameter reference

The definition-list syntax:

Marker line , Requiredyes
One line of free text; plain text recommended. Each line directly above a : line is its own marker
: event , Requiredyes
At least one per marker. Continuation blocks are indented two spaces
Further : lines , Requiredno
More events under the same marker, sharing its node
Blank line , Requiredyes
Between entries; without it the next marker joins the previous event’s text
{.timeline} , Requiredyes
The line directly below the last event, with no blank line before it

A timeline has no attributes of its own: no icon, color, badge, link or compact variant. An id or further classes on the same line, as in {#history .timeline}, pass through Goldmark onto the <dl>.

Limits

  • When placing a timeline directly inside a callout (> [!NOTE] ...), leave one blank > line after the callout header; without it Goldmark absorbs [!NOTE] into the first marker and the theme logs a build warning.
  • Events take no icon, color, badge or link parameters. Put a link or a badge in the event text instead.
  • Because Hugo has no <dl> render hook, attributes on the {.timeline} line follow Goldmark’s default filtering (which strips on* handlers but passes style), unlike render-hook components.
  • GitHub and some editors do not render definition lists, but the source still reads naturally: a marker line followed by : event lines.
  • Markers are not parsed, sorted, grouped or localized; events appear in source order.
  • Events are not headings and do not appear in the TOC. Use update headings when they should.
  • Steps — numbered procedures the reader follows
  • Update — changelog entries that stay headings
  • Mermaid — Gantt charts and timeline diagrams for schedules

27 - Update

Write a changelog, a “What’s new” page or weekly notes as ordinary headings marked {.update}, with an optional date and tags under each entry.

An update is a changelog entry written as an ordinary Markdown heading with {.update} at the end. Each entry gets extra space and a separator rule above it, which gives a long stream of entries its rhythm, and optional date and tags attributes add a metadata line under the heading. Use updates for a one-page changelog, a “What’s new” page, weekly notes or a log of policy changes.

Because the entry is still a heading, it keeps everything a heading has: its table-of-contents entry, anchor, search section and print ID. No script loads. When each version needs a page of its own, use release pages instead.

Shortest form

Put {.update} at the end of the heading, with date and tags inside the same braces. Write an explicit #id first for version entries: Goldmark strips dots when building an anchor from heading text (v1.6.0 — … becomes #v160--…, and v1.10 collides with v11.0), while {#v1-6-0 .update …} keeps a clean, stable link even if the title changes.

Source
### v1.6.0 — PostgreSQL 18 by default {#v1-6-0 .update date="2026-11-23" tags="Breaking, Performance"}

New clusters get PostgreSQL 18, with asynchronous I/O turned on.

v1.6.0 — PostgreSQL 18 by default

, Breaking, Performance

New clusters get PostgreSQL 18, with asynchronous I/O turned on.

A changelog page usually writes each entry as ##. The examples here use ### so that they nest under this page’s own sections in the table of contents.

Date

date takes a year, a month or a day (YYYY, YYYY-MM or YYYY-MM-DD). It renders as <time datetime="…"> and shows exactly as written, so 2026-11 stays 2026-11.

## 2026 in review {.update date="2026"}
## November notes {.update date="2026-11"}
## v1.6.0 {.update date="2026-11-23"}

Any other value — including an impossible calendar date such as 2026-02-30 or 2025-02-29, a timestamp with a time or time zone, or an unquoted number such as date=2026 — warns, naming the heading and the page. The date is dropped while the heading, any valid tags and the rest of the entry stay. Leap days such as 2024-02-29 pass.

An unquoted full date such as {.update date=2026-11-01} goes further wrong: Goldmark cannot parse it, drops the whole attribute block and leaves it in the heading text. The build warns whenever a heading ends in an unparsed {…} block containing .update, with or without a leading #id, as in {.update date=2026-11-01} or {#v1-6-0 .update date=2026-11-01}. Quote every value.

Tags

tags is a comma-separated string of plain text (both , and full-width , separate items). Each item is trimmed and empty items are skipped, so tags=" Fix ,, Docs " gives two chips, Fix and Docs. A non-string value such as tags=true warns and is dropped. Every chip looks the same whatever it says, in a color set by the preset, and Markdown inside a tag shows literally.

These are not Hugo taxonomy tags: they create no term pages and link nowhere. The theme does not translate them, so write them in the page’s language.

Entries without metadata

Both attributes are optional. ## Unreleased {.update} is a valid entry with the entry spacing and separator rule but no metadata line, and the line is also left out when there is no date and tags holds only commas and spaces.

The text under an entry is ordinary Markdown, and lower headings inside an entry are ordinary headings that nest under it in the TOC without a marker.

Still a heading

The marker changes nothing a heading already does:

  • The TOC shows the heading text only, without the date or tags.
  • The anchor and the self-link that appears on hover work as usual.
  • Keyboard navigation stops at each entry with J and K.
  • Local search indexes the entry as a section titled with the heading text; when offline_search_index is content (the theme default), the date and tags are indexed as separated tokens inside that section’s text.
  • Multi-page Print namespaces the heading ID as it does for any heading.

The metadata line follows the heading rather than sitting inside it, so the heading text, its accessible name and its search title stay exactly as written. Without an explicit #id the anchor comes from the heading text (dots removed and titles turned into long slugs), and renaming the entry changes its link, so give an #id to every version entry and any entry that other pages link to.

A changelog on one page

A stream of entries, newest first. The three entries and the subsection below appear in the table of contents under this section.

Source
### Unreleased {#demo-unreleased .update}

One command sets up logical replication between two clusters.

### v1.6.0 {#demo-v1-6-0 .update date="2026-11-23" tags="Breaking"}

PostgreSQL 18 is the default version for new clusters.

#### Upgrade notes {#demo-v1-6-0-upgrade}

- Set `pg_version: 17` in the inventory to keep creating PostgreSQL 17 clusters.
- Rename `pg_backup_dir` to `backup_dir`.

### v1.5.1 {#demo-v1-5-1 .update date="2026-11" tags="Changed, Fixed"}

Failover no longer times out on clusters with more than three replicas.

Unreleased

One command sets up logical replication between two clusters.

v1.6.0

, Breaking

PostgreSQL 18 is the default version for new clusters.

Upgrade notes

  • Set pg_version: 17 in the inventory to keep creating PostgreSQL 17 clusters.
  • Rename pg_backup_dir to backup_dir.

v1.5.1

, Changed, Fixed

Failover no longer times out on clusters with more than three replicas.

Update or release pages

Need Use
One readable stream of entries on one page .update headings
One page per version, with its own URL, feed item, release assets or GitHub release release pages collected by layout: releases
A short dated sequence inside other prose Timeline

Choose one model as the source of truth for a product’s release notes — either a single .update changelog page or per-version release pages collected by layout: releases — rather than maintaining the same version in both places. If a separate “What’s new” page highlights a milestone that already has a release page, link to that release page instead of repeating its notes.

Output

Updates load no JavaScript. In HTML the heading gets class="update" and is followed by <div class="td-update-meta">, which holds the <time datetime> and one <span class="td-update-tag"> per tag. A comma that takes no space on screen sits between the items, so copied text, local search and feed readers get 2026-11-23, Breaking, Performance instead of 2026-11-23BreakingPerformance. Print uses the light paper colors in either color mode and keeps each heading on the same page as its metadata line. Markdown and LLMS output keep the heading line with its attribute block (raw Markdown viewers such as GitHub show {…} literally), and the page stays one page with one URL, so entries never become separate feed items.

Parameter reference

The attribute block at the end of the heading:

.update , marker , default—
Makes the heading an entry; any level, usually ##
date , string (YYYY, YYYY-MM or valid calendar YYYY-MM-DD) , default—
Rendered as <time datetime> and shown as written; non-strings and invalid dates warn and are dropped
tags , string (, or , separated plain text) , default—
One neutral chip per non-empty item, trimmed; non-strings warn and are dropped
id , anchor , defaultfrom the heading text
Recommended for version entries, written first: {#v1-6-0 .update …}

date and tags work only together with .update; on any other heading they warn as unknown attributes and are dropped.

Limits

  • There is no sticky label rail or two-column layout; the table of contents already tracks the entries.
  • Entries get no URLs or feed items of their own. Use release pages when each version needs one.
  • The TOC shows the heading text only, so put the date in the heading text when readers should see it there.
  • Tags are not translated, colored or linked.
  • Entries appear in source order, with no sorting, filtering or generation from data.

28 - Component presentation

Cards, disclosures, tabs, and compact procedures across OINK’s six visual presets.

This page shows the everyday components side by side with their compact variants, so you can judge how each looks before choosing it: switch between Paper, Slate, GitHub, Ink, News and Terminal, light or dark, from the Appearance menu and compare. Each variant is one extra class or a variant parameter on the Markdown you already write. None loads a script or changes links, keyboard use, copied text, print or Markdown output, and an unknown variant warns and falls back to the regular look.

Cards and card lists

The regular card grid:

For a compact directory of resources, {.cards .td-cards-list} turns the same link list into a single framed list with dividers, each row as tall as its description needs.

When the rows need icons, badges or longer descriptions, use the shortcode form with cards variant="list":

InstallationStart here

Build a local preview before changing the site configuration.

Notes and disclosures

Callouts have no variants; compare their colors and the disclosure row in each preset.

Keep a local preview

Review the page at a narrow width as well as on your desktop.

Check the destination

Confirm the destination before publishing a new version.

How does this work without JavaScript?

The disclosure is a native HTML details element. It remains usable with scripts disabled.

The title, chevron, and focus outline share one stable summary row.

Longer titles can wrap without displacing the chevron or reducing the interactive area

Each disclosure opens independently. Other content stays in its current state.

Tabs and commands

macOS / Homebrew
brew install hugo
Debian / Ubuntu
sudo apt install hugo

Add {class="td-code-command"} to a one-line fence to make it a command strip. The copy button gets its own column, so a long command scrolls or wraps without running under it.

hugo server --bind 127.0.0.1 --port 1313
hugo --environment production --baseURL https://example.com/documentation/ --destination public

wrap, copy and accessible labels work as on any code block. A command strip holds exactly one line, so a multiline, numbered or collapsed block with this class warns and renders as a regular code block.

Short procedures

For a short procedure, add .td-steps-compact to the marker: {.steps .td-steps-compact}. Keep the regular .steps for long tutorials, where the extra spacing helps.

  1. Review the configuration.
  2. Run the local preview.
  3. Check the generated output.

A procedure with headings uses the shortcode with variant="compact", written with percent delimiters:

Preview

Run the development server and open the changed page.

Review

Check the page in the language and appearance your readers use.

Tables and metadata

Tables, field lists, badges and key sequences have no variants either; they are here so you can check them against the rest of the preset.

View Purpose Input
Cards Related resources Link list
Steps Ordered procedure Ordered list
Tabs Equivalent alternatives Adjacent blocks
title , Typestring
A concise title that may wrap naturally.
description , Typestring
Supporting information, separate from the main label.

Preview Validated Review needed

Open search with Ctrl with K and move between results with the arrow keys.