Skip to content

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

Return to the regular view of this page

Authoring

Write documentation pages, blog posts, books, image albums, release pages and API references, and arrange them into a sidebar.

Everything a reader sees comes from Markdown files under content/, and this section shows how to write them: a documentation page, the folder tree that becomes the sidebar, and the content types that bring their own layout, such as blog posts, books, image albums, release pages and API references. They all share one Markdown dialect and one set of front matter keys, so what you learn in Writing pages carries over to every other type.

Find it by task

I want to… Read
Write a documentation page: front matter, heading anchors, links, images, drafts Writing pages
Add callouts, tabs, steps, cards or field tables with plain Markdown OINK’s Markdown extensions
Shape the tree and the sidebar: _index.md, weight, icons, folding, several sidebar roots Organizing content
Look up what a front matter key does Page parameters
Publish a blog post or a release announcement, with RSS Blog posts
Publish a book: chapter numbers, figures and tables, cross-references, whole-book print Books
Publish an image album: folder structure, metadata, layouts, the image viewer Expo albums
Build a release and download page: version cards, asset tables, checksums Releases and downloads
Publish an OpenAPI reference API reference pages
Write in two languages: paired files, aligned anchors, untranslated pages Languages
Look up a component’s syntax and parameters Components

1 - Writing pages

Create a documentation page, from where the file goes and the front matter it needs to stable anchors, links, images, drafts and the controls the theme adds at the end.

A documentation page is one Markdown file under content/: a few lines of YAML front matter, then the body. Where you save the file decides its URL and its place in the sidebar, so a new page needs nothing beyond the file itself:

content/docs/install.md
---
title: Install Pigsty
linkTitle: Install
description: Get a working PostgreSQL cluster onto a clean EL 9 machine.
weight: 20
---

## Prerequisites {#prerequisites}

A Linux machine you can reach over SSH, passwordless `sudo`, and Python 3.11 or
newer.

> [!IMPORTANT]
> The installer rewrites `/etc/yum.repos.d/`. Back it up first.

With hugo server running, the page appears at /docs/install/ and as Install in the sidebar. If your site does not build yet, start with Get started.

Creating a page

The path under content/ becomes the URL: content/docs/install.md is published at /docs/install/. A translation is a file of the same name with a language suffix, such as install.zh.md, in the same directory, and it shares the English page’s logical path.

A page with no files of its own is a single .md file. When it has screenshots, recordings or example configuration, make it a directory instead: name the page index.md and put its files beside it. Hugo calls this a page bundle, and the page refers to its files by their bare names:

the two page shapes inside content/

  • content/
    • docs/
      • _index.mdsection index, English
      • _index.zh.mdsection index, Chinese
      • install.mdsingle-file page → /docs/install/
      • install.zh.mdits Chinese translation
      • anatomy/page bundle → /docs/anatomy/
        • index.md
        • index.zh.md
        • shell.webppage resource, shared by both languages

Both shapes look the same in the sidebar. hugo new content docs/install.md creates the file with front matter from an archetype; writing it by hand works just as well. A bundle resource without a language suffix is shared by every language. File naming and resources explains language-specific resources and the one case that needs them: a page that exists only in Chinese.

The front matter you need

The YAML between the two --- lines at the top of the file is the front matter. Four keys belong on every page:

content/docs/install.md
---
title: Install Pigsty       # page heading, browser title, search result title
linkTitle: Install          # short name in the sidebar and breadcrumbs; falls back to title
description: Get a working PostgreSQL cluster onto a clean EL 9 machine.
weight: 20                  # ordering among siblings; use multiples of 10 to leave room
---

Write description as one sentence saying what the reader can do with the page. It appears on section index cards, in search results and on social cards, so it is what someone reads when deciding whether to open the page. weight orders the page among its siblings; Ordering explains ties and pages without one.

Every other key is optional: an icon, draft status, a search boost, comments, the page shell. Page parameters lists them all.

Heading levels and stable anchors

Start body sections at ##. The theme renders title as the page’s one # heading, so a # in the body would add a second. The outline in the right column lists headings from ## down to Hugo’s markup.tableOfContents.endLevel, which is ### unless you set it to 4 to include ####.

Give every ## and ### an explicit English ID:

Source
## Prerequisites {#prerequisites}

### Disk and memory {#disk-and-memory}

Without an explicit ID, Hugo derives one from the heading text, which causes two problems:

  • A translated heading gets a different ID (#前提条件 instead of #prerequisites), so a link that works in English lands at the top of the Chinese page. With the English ID on both, /docs/install/#prerequisites and /zh/docs/install/#prerequisites reach the same place; see Heading anchors must align.

  • Rewording a heading silently breaks every link to it. Treat a published ID as part of the URL, and when you must rename one, leave an empty anchor with the old ID so existing links still arrive:

    Source: leaving a target behind for the old anchor
    ## Getting started <a id="get-started"></a> {#quickstart}

Use lowercase English words joined by hyphens, unique within the page.

OINK’s Markdown extensions

The body is standard Markdown, rendered by Hugo’s Goldmark, plus the forms below. Each is ordinary Markdown with at most one attribute line, so the source still reads well on GitHub or in any editor:

Component Shortest syntax Page
Callouts > [!NOTE] on the first line of a blockquote; > [!SOCIAL] quotes a social post Callouts · Social
Code blocks {title="hugo.yml" copy=false} on the fence info line Code Blocks
Table extras A table followed by {.matrix} or {caption="…"} Tables
Field lists A table followed by {.fields meta="type default"} Fields
Tabs Two adjacent fences each carrying {tab="Homebrew"} Tabs
Steps An ordered list followed by a {.steps} line Steps
Timelines A definition list followed by a {.timeline} line Timelines
Updates A heading with {.update date="…" tags="…"} Updates
Cards A list of links followed by a {.cards} line Cards
Diagrams A mermaid fence (also plantuml, markmap, echarts) Mermaid
Maps A map fence with a YAML or JSON list of places Maps
File trees A filetree fence, one - name/ # comment per line FileTree
Mathematics A math fence, or display math wrapped in $$ Math
Images & media A standalone image/video/audio line followed by {caption="…"} Images · Video · Audio

The few components that need more than Markdown can express use shortcodes: badges, keyboard keys (bare <kbd> also renders as a keycap), file includes, terminal recordings, and the Book figure and table family. Their syntax is in Components.

The forms combine. Here a code fence and a callout sit inside steps:

Source
1. Install PostgreSQL 18:
   ```bash
   brew install postgresql@18
   ```
1. Start the server and connect to it:
   ```bash
   brew services start postgresql@18
   psql postgres
   ```
   > [!TIP]
   > `brew services list` shows whether the server is running.
{.steps}
  1. Install PostgreSQL 18:
    brew install postgresql@18
  2. Start the server and connect to it:
    brew services start postgresql@18
    psql postgres
    Tip

    brew services list shows whether the server is running.

Choose the form by what the link points at:

Form Example When to use it
Absolute site path [Configuration](/docs/customize/config/) The default. It names the published route, survives moving the source file, and is easy to find and replace across the site
Relative path [another page](../organize/), ![diagram](shell.webp) Resources in the same page bundle, or a neighboring page that should move with its source directory
The ref / relref shortcode [Configuration]({{</* ref "/docs/customize/config" */>}}) A target that must exist: a missing one fails the build instead of leaving a broken link

All three point at directory-style routes with a trailing slash (/docs/write/pages/), the way Hugo publishes pages by default. In a bilingual site, link to the logical page rather than to a .zh.md file, and use the same fragment IDs in both languages.

Plain Markdown links are not checked when the site builds, so:

  • Write internal links as absolute paths; after a restructure, one site-wide search and replace finds them all.
  • When you move a page, add its old path to aliases so outside links keep working, and point your own links at the new route instead of leaning on the alias.
  • When you are not sure a target exists, use ref and let the build check it.

The theme passes links to Goldmark unchanged; it has no link render hook. External links therefore open in the same tab. For new tabs, write the link as HTML or add your own layouts/_markup/render-link.html.

Where images go

Put a page’s own screenshots in its page bundle, images several pages share in assets/images/, and large files that need no processing in static/. All three use the same ![alt text](source) syntax, and an attribute line below the image adds a caption, a size, zoom or a figure number; see Images.

Drafts and publishing

Mark an unfinished page draft: true and no build publishes it:

front matter
---
title: Migration guide, not yet final
draft: true
---

hugo server -D (--buildDrafts) previews drafts. A page whose date lies in the future is left out the same way until you build after that date, and -F (--buildFuture) previews it. Production builds use neither flag, so plain hugo publishes only finished pages.

What appears at the end of a page

Do not write a feedback prompt, a last-updated line, previous/next links or a comment box into the body. The theme adds them after the last paragraph, always in this order:

Block Default Off for one page Configure
Share bar Off until params.ui.share lists networks share: false Blog posts
Feedback: the two “Was this page helpful?” buttons Off feedback: false Repository links and page info
Last modified: the time and the latest commit subject, linked to GitHub On when Git information is available annotation: false Repository links and page info
Pager: previous and next, in sidebar order On for docs, book and blog pager: false Navigation and menus
Comments: Giscus On when configured and enabled comments: false Comments

The action menu beside the title (copy as Markdown, edit this page, view history, open an issue, print) is generated too, and is configured in Repository links and page info. Why the blocks come in this order is explained in What the page end is made of.

Verify

Build once after writing a page:

hugo --printPathWarnings

The build should end with Total in … and no ERROR. A mistyped attribute or component parameter produces a warning with its source position and renders a safe fallback, as described in Configuration principles; a ref to a missing page fails the build. --printPathWarnings reports two pages that publish to the same path, which happens most often in multilingual sites or after a change to permalinks.

Then check in the browser:

  1. The page sits in the sidebar where its weight puts it.
  2. The right-hand outline lists your ## headings, and clicking one puts an English anchor in the URL.
  3. A heading has the same anchor on the English page and on its translation.

2 - Organizing content

Arrange folders and _index.md files into the sidebar you want, then control order, section indexes, icons, folding, hidden pages and where documentation lives.

The folders under content/ are your navigation. Each folder becomes a group in the sidebar, each Markdown file a page, and weight sets the order, so you shape the sidebar by arranging files instead of maintaining a separate menu. The same tree drives the breadcrumbs, the previous/next pager and the child list on every section page, which keeps all of them in agreement.

Directories are the sidebar

Hugo calls a folder a section; the Markdown files in it are its pages, and nested folders are subsections. The sidebar renders that tree level by level, labels each entry with linkTitle (or title when there is none), and orders siblings by weight. A product’s documentation might look like this:

content/docs/

  • content/
    • docs/
      • _index.mdthe Docs root: type: docs + cascade
      • install/weight: 10
        • _index.md
        • requirements.mdweight: 10
        • linux.mdweight: 20
        • kubernetes.mdweight: 30
      • operate/weight: 20
        • _index.md
        • backup.mdweight: 10
        • upgrade/weight: 20, a page bundle
          • index.md
          • upgrade-dialog.webp
      • reference/weight: 90
        • _index.md
        • configuration.md

upgrade/ is a page bundle: a folder holding index.md and the files that page uses. It appears in the sidebar and gets its URL exactly like a single file would; see Creating a page.

Every directory needs an _index.md

A section’s own page is the _index.md in its folder (_index.zh.md for Chinese). Without it, Hugo still creates the section, but with no title, description, icon or weight: the sidebar shows the bare folder name and you cannot control its position.

content/docs/deploy/_index.md
---
title: Deploy
linkTitle: Deploy
description: Publish the site to GitHub Pages, Cloudflare Pages or your own Nginx.
weight: 50
icon: fa-solid fa-cloud-arrow-up
---

A section’s _index.md can also carry cascade, which applies front matter to every page below it, so a setting shared by a whole subtree is written once:

content/docs/reference/_index.md
---
title: Reference
weight: 90
cascade:
  pager: false        # no previous / next on any page in this subtree
  search_boost: 0.8   # reference pages rank slightly lower in search
---

Ordering: use multiples of 10 for weight

Siblings sort by ascending weight; only pages with equal weights fall back to date and then linkTitle. Number in steps of 10 (10, 20, 30) so you can later insert a page between two others without renumbering them. A section’s own weight, set in its _index.md, places it among its siblings.

A page without weight counts as 0, and Hugo puts such pages after every page that has one, ordered among themselves by date and title. That order shifts as content changes, so give every page a weight.

List or cards on a section index

Below the body of an _index.md, the theme lists the section’s children, so a section page needs no hand-written table of contents. The site chooses the style:

hugo.yml: the site-wide default
params:
  ui:
    section_index: cards # list | cards

list, the theme default, shows one line per child with its title and description. cards lays out a grid of link cards built from each child’s icon, linkTitle and description; this section’s own index page is an example. In the card style, description is the card’s text, so keep it to one sentence that fits on a line. A section that needs the other style overrides it in its front matter:

content/docs/reference/_index.md
section_index: list
cascade:
  section_index: list   # and its descendant sections too

Two page switches work with either style: simple_list: true renders a compact bulleted list of titles, and no_list: true leaves the list out for a page whose body already provides its own navigation. Site-wide settings such as the number of card columns are in Section index style.

Hiding from the sidebar

Front matter Effect
toc_hide: true The page is absent from the sidebar tree and from the previous/next sequence. It is still published, and links to it still work
hide_summary: true The page is absent from its section’s child list
sidebar_divider: true The entry stops being a link and becomes a group heading in the sidebar
manual_link: https://… The sidebar row points elsewhere. Pair it with manual_link_title and manual_link_target: _blank

toc_hide and hide_summary control two different places, so set both only when the page should appear in neither.

Sidebar icons

Give a page or a section an icon with one Font Awesome class pair in its front matter:

content/docs/deploy/_index.md
icon: fa-solid fa-cloud-arrow-up

An icon on every leaf page makes a long sidebar hard to scan, so a site-wide policy decides which entries show theirs:

hugo.yml
params:
  ui:
    sidebar_icon_policy: groups # all | groups | none
Value Effect
all Every entry that declares an icon shows it. This is the default when the key is unset
groups Only the root and entries with children show icons; ordinary leaf pages do not
none No entry icons in the sidebar

For a new site, set groups explicitly: sections keep the icons that identify them, and leaf pages stay plain. This site uses groups, which is why only its sections carry icons in the sidebar.

Expanding and folding

A section with children has a fold arrow in the sidebar. By default the branch that holds the current page is open and the others are closed, except blog sections, which start open. sidebar_expanded in a section’s _index.md overrides that default in either direction:

content/docs/reference/_index.md
sidebar_expanded: true   # this section is always expanded by default

The browser remembers the reader’s choices for the sidebar as a whole: whether it is collapsed, its width and its scroll position. It does not remember individual branches; a site that wants that can add it with the sidebar API. Site-level folding, compact mode, how many levels start open, width and truncation are set in Layouts and page types, and every key is defined in Configuration.

Groups without a landing page

When a folder exists only to group its children, make its _index.md a divider and do not publish it:

---
title: Reference
sidebar_divider: true
build:
  render: never
---

The title becomes a plain group label in the sidebar. When folding is on, its button opens and closes the children, and without JavaScript the group stays open. The children remain in the pager, search, the navigation JSON and the print view. Omit build to keep publishing the section page while the sidebar still shows a non-link label. A divider without children renders as a plain separator heading.

Three other switches look similar but do something else, so none of them replaces a group: toc_hide hides the section’s whole subtree, no_list only drops the child list from the section’s own page, and hide_summary only removes the entry from its parent’s list. build.render: link keeps a permalink without publishing a page; for a group that should never be a destination, use never, so no other navigation can offer a link to it.

The shell follows type, not the path

The documentation shell (sidebar, table of contents, breadcrumbs, pager) does not depend on the folder name. It comes with the page’s type: the five built-in types below have it, and they are the default of params.ui.shell_types (see Layouts and page types before changing that list).

hugo.yml: the theme default
params:
  ui:
    shell_types: [docs, book, blog, swagger, expo]

Documentation can therefore live at any path, with a cascade assigning type: docs. To put a handbook at content/handbook/, its section root reads:

content/handbook/_index.md
---
title: Operations handbook
type: docs
sidebar_root_for: self      # the sidebar tree roots here rather than falling back to /docs
cascade:
  type: docs                # the whole subtree uses the documentation shell
---
Important

When the documentation directory is not called docs, sidebar_root_for: self is needed alongside type: docs. Otherwise the sidebar looks for its root at params.ui.docs_section (default docs), and a reader under /handbook/ sees the /docs/ tree.

Multiple sidebar roots

The sidebar shows one tree at a time, and a row above it names that tree’s root: by default, the top-level section the reader is in. A large subtree, such as a versioned API reference or a self-contained handbook, can become a root of its own:

content/docs/api/v2/_index.md
---
title: API reference v2
sidebar_root_for: self   # self | children
---
Value Meaning
self The section’s index page and all its descendants take it as their sidebar root
children The index page stays in the parent tree; only its descendants use this root

The switcher above the tree is the same on every page. It lists each top-level section and each section that declares sidebar_root_for: self, as a plain link when there is one entry and as a dropdown when there are more. To keep a top-level section or a nested root out of that list, set sidebar_root_menu: false in its _index.md; while a reader is inside that section, the switcher still shows it as the current location.

Below the switcher, the root’s index page is the first link in the tree: the switcher picks a tree, and the root link opens a page. Set sidebar_root_link_self: false to make that row point to the parent section instead.

Verify

hugo --printPathWarnings

The build should end with Total in … and no ERROR. After moving folders around, --printPathWarnings reports any two pages that now publish to the same path.

Then check in the browser:

  1. The sidebar order matches the weight values you wrote, and a new section appears where you expect it.
  2. Each section index lists all of its children; a missing one has hide_summary set or lacks an _index.md.
  3. Breadcrumbs and the pager follow the sidebar’s order, because they read the same tree.
  4. The tree has the same shape in every language, which needs a translated _index.md (such as _index.zh.md) beside each original.

If a section has more entries than params.ui.sidebar_menu_truncate allows, the build warns and names the value to raise it to. Act on that warning: the entries past the limit are missing from the sidebar.

Controlling a branch from site code

window.OinkSidebar lets site code open and close sidebar branches, for example to restore a reader’s saved choices. Load the script after the theme’s own scripts, for instance from layouts/_partials/hooks/body-end.html, and wait for ready before reading or changing state. This example expands the first group in the sidebar:

const sidebar = window.OinkSidebar;
if (sidebar) {
  sidebar.ready.then(() => {
    const button = document.querySelector(
      '#td-shell-sidebar [data-td-shell-tree-toggle]'
    );
    if (!button) return;
    const id = button.getAttribute('aria-controls');
    sidebar.setExpanded(id, true);
  });
}

A branch’s ID is the aria-controls value of its toggle button. getState(id) returns {id, expanded}, or null for an unknown ID. Each change dispatches one oink:sidebar-disclosure event on document, with the detail {id, expanded, source}, after the button, the branch and their accessibility state agree; setting the value a branch already has sends no event. A branch that contains the current page stays open when you restore state through the API, though the reader can still fold it.

If you persist branch choices, scope the storage key by language and by navigation version, cope with storage being unavailable, and ignore saved IDs that the current page does not have. The sidebar contract defines the full lifecycle.

3 - Page parameters

Look up every front matter key OINK reads, with its type, default and effect, to change one page or a whole section.

Front matter lets one page, or a whole section through cascade, depart from the site-wide settings in hugo.yml: a wide layout for one reference table, no pager on a landing page, comments on blog posts but not on the docs. The keys below are every page key OINK reads, grouped by what they change. Hugo’s own fields (slug, url, build, sitemap, expiryDate and the rest) work as usual and are documented by Hugo. Site parameters are in Configuration.

How page keys work

A page key is the site key without params. and ui., written at the top level of the front matter. The site’s params.ui.section_index becomes section_index on a page, and params.page_width becomes page_width. Do not nest page keys under a ui: block: the theme does not read one and does not warn about it either, so the setting silently has no effect. When a key seems to do nothing, check its name and placement against these tables first.

content/docs/wide-reference.md
---
title: Compatibility matrix
weight: 40
page_width: wide
footer_style: slim
image_zoom: true
section_index: list
---

A section’s cascade uses the same names one level deeper and applies them to every page beneath it:

content/docs/reference/_index.md
cascade:
  pager: false
  section_index: list

When several places set the same key, the most specific wins:

  1. the page’s own front matter;
  2. the nearest cascade above it;
  3. the site parameter in hugo.yml.

A Default of “site value” means the key falls back to the site parameter of the same name. An invalid value warns and the page uses the default shown here, as described in Configuration; the tables mention a fallback only where it differs. Keys that OINK has renamed or retired are not listed: the build warns when it meets one, and Upgrade has the replacements.

Basics

Every page uses a few of these, and title is the one it cannot do without.

title , string , default—
Page heading, browser title and search result title. Required on every page
linkTitle , string , defaulttitle
Short name in the sidebar, breadcrumbs, pager and cards
description , string , default—
One-sentence summary for section cards, search snippets and meta description. Blog pages also show it as an introduction above the body
weight , integer , default0
Order among siblings; use multiples of 10. 0 (unset) sorts after every page with a weight. See Organizing content
draft , boolean , defaultfalse
A draft never reaches the build output; preview it with hugo server -D. See Writing pages
date , date , default—
Blog date and release-page sort key. A future date keeps the page out of the build by default
lastmod , date , defaultGit commit time
The page-end “last modified” time. With enableGitInfo on, Git supplies it and you need not write it
aliases , string array , default—
Old paths that redirect to this page, for when a page moves
type , string , defaulttop-level directory name
Picks the template and the shell: docs, book, blog, swagger, expo. See Organizing content
layout , string , default—
Picks a layout for one page: landing or releases
cascade , map , default—
Applies the keys below to the whole subtree

Sidebar and navigation

Reach for these when a page belongs somewhere else in the sidebar, or nowhere, or when a section index should list its children differently. Organizing content shows how they combine.

icon , Font Awesome class pair , default—
Icon in the sidebar, section cards and search results, such as fa-solid fa-rocket
toc_hide , boolean , defaultfalse
Removes this page and its subtree from the sidebar and the pager sequence, in content-derived and explicit trees alike
hide_summary , boolean , defaultfalse
Leaves the page out of its section index
sidebar_divider , boolean , defaultfalse
Turns the entry into a group heading without a link, which the pager skips; a section marked this way still lists its children. For a group with no page of its own, use build.render: never instead (group without a page)
sidebar_expanded , boolean , defaulttrue for blog sections, false otherwise
Opens this section in the sidebar by default
sidebar_root_for , self / children , default—
Makes this section the root of the sidebar tree. self includes the section index; children covers only its descendants. Any other value warns and is ignored
sidebar_root_link_self , boolean , defaulttrue
The root row links to the section itself; false links it to the parent section instead
sidebar_root_menu , boolean , defaulttrue
Offers a top-level section or nested self-root in the sidebar’s root switcher. An excluded root still shows as the current location while you are inside it
toc_root , boolean , defaultfalse
When the sidebar root is the site home, removes this whole top-level section from the tree and the pager sequence
manual_link , URL , default—
Points this row in the sidebar and section index somewhere else
manual_link_relref , content reference , default—
The same link, resolved with relref. A missing target fails the build
manual_link_title , string , defaulttitle
Hover title for the manual link
manual_link_target , string , default—
Link target such as _blank; the theme adds noopener
no_list , boolean , defaultfalse
The section index lists no children
simple_list , boolean , defaultfalse
The section index lists children as a compact bulleted list
section_index , list / cards , defaultsite value (list)
Style of the section index
section_index_columns , integer , default2
Column count of the card style
notoc , boolean , defaultfalse
Hides the outline in the right rail
pager , boolean , defaultdecided by params.ui.pager_types
false removes previous / next from this page. A non-boolean warns and the page keeps its type’s setting
navbar_enabled , boolean , defaultsite value (true)
Whether this page renders the navbar
navbar_autohide , boolean , defaultsite value (false)
On desktop screens with a mouse, hides the navbar until the pointer nears the top edge or keyboard focus enters it. The home page ignores the site value and follows only its own front matter
breadcrumb , boolean , defaultshell default
Whether this page renders breadcrumbs. Docs and Book pages default on, Blog pages off
theme_color , string , defaultsite value
#rgb or #rrggbb accent for this page. In a section root’s cascade, it gives the whole section its own color. See Brand and appearance
theme_color_dark , string , defaultderived
The dark-mode accent. A page that overrides only theme_color under a cascade that sets this key inherits the cascade’s dark value, so override both. theme_color: false opts the page out of an inherited section color
page_context_menu , boolean , defaultsite value (true)
The page action menu on the title row: copy Markdown, edit this page, print and so on
page_context_menu.assistant_links , boolean , defaultsite value (false)
The ChatGPT and Claude items, written page_context_menu: { assistant_links: false }. A page can only turn them off; it cannot turn them on when the site has not

Page shell

Change these when one page needs a different frame around its content: a wider column, no sidebar, a slimmer footer. Site defaults and their effects are in Layouts and page types.

page_width , normal / wide / full , defaultnormal
Width of the content column
reading_width , slim / normal / wide , defaultnormal
Line length on Book pages. Applies only to type: book
footer_style , fat / slim / none , defaultsite value (fat)
Footer shape
body_class , string , default—
A class added to <body> for the site’s own CSS
reading_time , boolean , defaultsite value
Whether this page shows a reading time
sidebar_enabled , boolean , defaulttrue
false hides the left sidebar on this page
scroll_spy , boolean , defaultsite value
Accepted and ignored: the outline always highlights the heading you are reading
keyboard_nav , boolean , defaultsite value (true)
Single-key keyboard navigation. See Keyboard navigation
lastmod_commit , subject / hash / none , defaultsubject
What follows “last modified”: the commit subject, its hash, or nothing
sidebar_expand_levels, sidebar_menu_compact, sidebar_menu_foldable, sidebar_item_overflow , as the site parameter , defaultsite value
Per-page sidebar behavior; the values are in Configuration
sidebar_width_min, sidebar_width_max , positive integer , defaultsite value (220 / 480)
Limits for resizing the desktop sidebar on this page. A minimum above its maximum warns and restores the site pair
code_copy , boolean , defaultsite value (true)
Default copy button on this page’s code blocks. A fence’s own copy= wins
rich_copy , boolean , defaultsite value (true)
Typeset HTML copy for prose selections pasted into rich-text editors
toc_style , fixed / flow , defaultsite value (fixed)
A fixed right-rail panel, or a wider rail that starts in the content flow
toc_taxonomies , boolean , defaultsite value (true)
Whether taxonomy clouds join the outline in the right rail
taxonomy_icons , map , defaultsite value
Per-taxonomy icon overrides for this page, or for a section through cascade

Use these to make the right page rank first for a query, or to keep a page out of search entirely. The guide is Search.

search_keywords , string or string array , default—
Extra search terms: synonyms, abbreviations, other languages
search_boost , positive number , default1.0
Ranking multiplier: the final score is the text match score times this value. A non-numeric, infinite, zero or negative value falls back to 1.0
search_exclude , boolean , defaultfalse
Keeps the page out of the local index

Output formats

Set these when a page should not get a Markdown copy or should stay out of the printed chapter. The guides are AI-agent support (.md and llms.txt) and Print.

outputs , string array , defaultsite outputs
The output formats this page generates. [HTML] drops its .md version
no_print , boolean , defaultfalse
Leaves the page out of the whole-chapter and whole-book print view

Page end: comments, feedback and provenance

These decide what follows the article. The order is fixed: share bar, then feedback, then provenance, then the pager, then comments. See Writing pages.

comments , boolean , defaultsite params.comments.enable (false)
Whether this page shows the giscus comment section. See Comments
feedback , boolean or map , defaultsite params.ui.feedback (off)
The “was this page helpful?” widget. The map form takes enable and reasons
annotation , boolean , defaultsite params.ui.annotation (on)
The “last modified” and provenance block at the page end
backlinks , boolean , defaultsite params.ui.backlinks (off)
Lists the pages that link here in a “Backlinks” group beside the outline. A section can cascade it. See Navigation and menus
translation_notice , language code or false , defaultsite params.ui.translation_notice (off)
The language of the authoritative version, so a translation can say so and link back. Write false on a page written natively in this language

Upstream attribution

Declare a source when a page is adapted from someone else’s material. The provenance line at the page end then names the work, the copyright holder and the license, and links to the full notice. Values resolve from the site parameters, then the data/upstreams entry named by upstream_source, then the page’s front matter; the most specific declaration wins.

upstream_link itself is read only from front matter (a cascade counts, a site parameter does not), because a site-wide value would make every page claim the same source.

upstream_link , URL , default—
Address of the material this page is derived from. An empty string opts out of a value inherited through cascade
upstream_name , string , default—
Name of the upstream work, as the credit shows it. Required once upstream_link is set
upstream_copyright , string , default—
Copyright notice, kept exactly as upstream wrote it. Required
upstream_license , SPDX identifier , default—
Must appear in data/licenses. Required
upstream_notice , site path or URL , default—
Page carrying the full notice: license text, warranty disclaimer, upstream NOTICE, snapshot pin. Required
upstream_ref , string , default—
Tag or commit of the snapshot, shown in parentheses after the work
upstream_source , string , defaultsite parameter
Entry in data/upstreams that holds upstream facts shared by many pages
upstream_modified , boolean , defaultfalse
Changes the credit to say the work was adapted. When the site has repository information, the same sentence also links to the page’s history. A non-boolean is treated as false

The attribution is all or nothing, because a partial credit misleads readers more than an obvious gap. A companion key without upstream_link, a missing required key, a license not found in data/licenses or an unknown upstream_source entry each warns and omits the whole attribution. The theme ships an SPDX table at data/licenses.yaml; a site adds or overrides entries with a file of the same name.

Image zoom

Turn this on for pages of screenshots or diagrams that readers need to see at full size.

image_zoom , boolean , defaultsite value (false)
Whether images on this page open full size when clicked. See Images

Blog posts

Posts use these for bylines, series and featured images, and blog sections use them to choose the post index. The guide is Blog posts; List layouts compares the four index layouts.

author , string , default—
Post byline; inline Markdown is allowed. Ignored on a page that has authors
authors , string array , default—
Terms of the authors taxonomy, in byline order. Needs author: authors under taxonomies:. See Authors and bylines
series , string array , default—
Terms of the series taxonomy; the strip above the body uses the first one. See Series
series_weight , integer , default—
Place in the series. Weighted members come first in ascending order, the rest follow by ascending date
tags , string array , default—
Tags. See Taxonomies
categories , string array , default—
Categories, likewise
images , string array , default—
The first entry is the post’s featured image and share card. In a section’s cascade, it sets a default for the section. images: [] opts a page out of an inherited value, but does not hide an image the page bundle supplies as featured, cover or thumbnail
byline , string , default—
Credit shown with the featured image wherever that image is rendered
featured_image , none / banner / wash / hero , defaultsite value (none)
How the post shows its featured image on the article itself; hero makes a full-width image header
blog_index , list / cards / table / gallery , defaultsite value (list)
Layout of the blog section’s post index. table always lists the whole section without pagination
blog_index_columns , positive integer , defaultsite value (3)
Card columns at wide breakpoints; medium and narrow screens keep their own limits
blog_index_size , positive integer , defaultsite value (12)
Posts per page for list, cards and gallery, and for all four views when switching is on. A standalone table ignores it
blog_index_toggle , boolean , defaultsite value (false)
Publishes all four layouts with a switch that remembers the reader’s choice. When false, only the configured layout is published and saved choices are ignored
blog_gallery , map , defaultsite block
Replaces the site’s whole gallery block; omitted fields use the built-in defaults. A reader’s saved mode and size win
blog_gallery.mode , wall / cards / seamless , defaultwall within a page block
Justified rows with 6px gaps, masonry with visible captions, or rows without gaps. Independent of blog_index
blog_gallery.size , integer 160–360 , default240 within a page block
Target tile size in CSS pixels; independent of posts per page
share , string array or false , defaultsite params.ui.share (empty)
Share targets at the page end. Replaces any inherited list; false opts the page out; an unknown target warns and is dropped. See Share
summary , string , default—
Excerpt for gallery entries and for post rows on tag and category pages when description is absent

Book

A book sets type: book on its section through cascade; these keys then number chapters and mark drafts. The guide is Books.

book_number , string , default—
Chapter number, shown before the page title and the sidebar entry
book_status , draft , default—
Marks an unfinished chapter: flagged in the sidebar and contents; book-toc with drafts=false leaves it out
sidebar_headings , false / true / integer 2–4 , defaultsite value (false)
Lists the current page’s headings under its sidebar entry, down to the given level; true means h2
book_draft_banner , boolean , defaultsite value (false)
Adds a banner at the top of a draft chapter

Expo albums

An album page (type: expo) reads its images and opening arrangement from this block. The guide is Expo albums.

expo , map , defaultsite params.ui.expo
Replaces the site block; absent fields use the defaults below
expo.images , string , defaultimages/*
Pattern matching the image resources in the page bundle
expo.mode , wall / cards / seamless , defaultwall
Arrangement shown until the reader picks one
expo.size , integer , default240
Target tile size from 160 to 360 CSS pixels; a size the reader saved wins

Titles, captions, credits, weights, explicit IDs and separate originals for individual images use Hugo’s native resources metadata; see Image metadata.

Landing

A page with layout: landing builds its sections from a data file or from its own front matter. The guide is Home and landing pages.

landing , string , default—
Reads the sections from data/landing/<key>/<language>.yaml
sections , array , default—
Section definitions written in the front matter, taking precedence over landing. A value that is not an array warns and renders no sections

Release pages

A release note names its GitHub release with one key, and a section with layout: releases lists those pages newest first by date and then SemVer, ignoring weight. The guide is Releases and downloads.

release_url , string , default—
One GitHub release URL, https://github.com/<owner>/<repo>/releases/tag/<tag>. The theme derives the owner, project, tag and source archive links from it and takes the date from the page’s date; download assets come from a checksums block in the body. Any other value warns and the release block is skipped

4 - Blog posts

Write blog posts with dates, bylines, series and featured images, then choose how the blog index, RSS feed and share bar present them.

A blog section gives dated writing the shell readers expect from a blog: a newest-first index with a thumbnail on every row, an RSS feed, bylines, tags and share links. The body of a post is ordinary Markdown, written exactly like a documentation page; what changes is the front matter and the section around it.

Write a post

Create one Markdown file per post anywhere in the blog section. The file path becomes the URL, and the date, not the folder, decides where the post appears:

content/blog/release/2.4.0.md
---
title: Release 2.4 — parallel restore and faster vacuum
linkTitle: v2.4.0             # short name in the sidebar and pager
date: 2026-08-14              # publication date; decides list order
lastmod: 2026-08-14
description: >-
  Version 2.4 restores large clusters in parallel, halves vacuum time on
  append-only tables, and adds a dry-run mode to every upgrade command.
author: The maintainers
categories: [Release]
tags: [Release, Backup]
---

Four keys matter more on a post than on a documentation page:

  • date is required, because it sets the post’s place in the index and its RSS timestamp. A post dated in the future stays out of the build until that day; preview it with hugo server -F.

  • description appears above the body as the post’s introduction and in search results, so write it as a sentence for the reader rather than a keyword list.

  • author accepts inline Markdown, so [Alice Chen](https://example.com/alice) works. For several authors, portraits or profile pages, use authors instead; a post that has authors ignores author.

  • The date is shown in the format of params.time_format_blog, ISO 2006-01-02 by default. Set it per language for a localized form:

    hugo.yml
    languages:
      en:
        params:
          time_format_blog: January 2, 2006
      zh:
        params:
          time_format_blog: 2006年1月2日

The body takes every component a documentation page does, and headings take explicit English {#id} anchors here too. tags and categories appear as chips under the title, a cloud in the right rail and a filter menu in the navbar; Taxonomies covers enabling them and translating their labels. The page end (feedback, last modified, pager, comments) works as described in Writing pages; a blog usually turns feedback off and keeps comments.

A bilingual post is a pair of files, 2.4.0.md and 2.4.0.zh.md, with the same date, author, weight and aliases. Translate the title, description and tags, but not commit IDs, version numbers, commands or URLs.

The featured image is the thumbnail on the post’s index row and the picture on its social share card. OINK uses the first of these it finds:

  1. the first entry of images in the post’s front matter;
  2. an image in the post’s page bundle whose filename contains featured or feature, then cover or thumbnail; it is cropped to fit, and the resource’s own byline becomes its caption;
  3. images inherited from an ancestor section’s cascade, nearest first.

The third source gives a whole section a default image, so posts without art of their own still get a thumbnail:

content/blog/release/_index.md
cascade:
  images: [/images/release.webp]

To drop an inherited image from one post, write images: [] in its front matter; to drop it from a whole subsection, put that in the subsection’s cascade. Neither hides an image the page bundle supplies. The site-level params.images is used for share cards only, never as an index thumbnail.

On the article itself

By default the featured image appears only on index rows and share cards. Set params.ui.featured_image to show it on the article as well:

Mode What the article shows
none No image on the article. The default
banner The image above the title in a fixed 16:9 frame, so a run of posts reads with the same rhythm
wash A faint copy of the image behind the article header, fading out before the body
hero A full-width image header
hugo.yml
params:
  ui:
    featured_image: banner

The page key is featured_image, so a subsection’s cascade can switch it on for that tree alone and a single post can opt out. A post without an image shows none in any mode, which makes it safe to enable for a section where only some posts have art. The modes load no script. A bundled or asset raster image is re-encoded as WebP and requested ahead of the page’s other images; an animated image keeps its frames.

content/blog/release/_index.md
cascade:
  featured_image: wash

Authors and bylines

Use the authors taxonomy when a blog has more than one writer, or when readers should be able to see everything one person wrote. Declaring the taxonomy is the only switch; the theme adds no parameter for it:

hugo.yml
taxonomies:
  category: categories
  tag: tags
  author: authors

A post then names its authors in byline order:

authors: [alice-chen, raj-patel]

The article header shows their portraits and linked names in that order, index rows show the names, and the blog feed lists each author alongside the site-level managingEditor.

An author’s profile is the taxonomy term page, so no data/authors file is involved:

content/authors/alice-chen/_index.md
---
title: Alice Chen
linkTitle: Alice
description: Maintains the backup and restore tooling.
images: [portrait.webp]
---

The long introduction, rendered on the profile page under the name.

Bylines use the term page’s linkTitle, or title when there is none, so a profile can carry a full name while bylines show a short one. description is the one-line introduction and the body the long one. The portrait is chosen by the same rules as a post’s featured image, so images: and a bundled portrait.webp both work. A Chinese profile is an _index.zh.md beside it. An author named in a post but without a profile page still gets a byline: the name, an initial in place of a portrait, and a link to their post archive.

Series

A series is a reading path through posts that each stand on their own, such as a five-part deep dive into backup internals. It is lighter than a book, which adds chapter numbers, cross-references and a combined print view. Declaring the taxonomy enables it:

hugo.yml
taxonomies:
  series: series

A post names its series and may give itself a position:

series: [backup-internals]
series_weight: 20

The post then shows a strip above its body with the series name, the post’s position, a link to the next part, and the full list inside a <details>, with no JavaScript. The term page content/series/<name>/_index.md is the series introduction; an _index.zh.md beside it makes it bilingual.

Members with a series_weight come first in ascending order; the others follow from oldest to newest, and the content path breaks ties. The strip and the term page use the same order. A post in several series shows one strip, for the first series it names, and a series with only one post shows none.

Neither authors nor series appears in the taxonomy chip row on a post, since each has its own place on the page. To show one there as well, name it in params.taxonomy.page_header.

Release notes

A version announcement is an ordinary post, conventionally under blog/release/, with the version in linkTitle (v2.4.0). To add a card linking the GitHub release and source archives, an asset table with checksums, or a chronological release index, see Releases and downloads.

Set up the blog section

The Starter already has a blog. To create one, make a section under content/ and give it type: blog. Split it into subsections by audience or purpose if you like, but not by year: the index orders posts by date on its own.

content/blog/

  • content/
    • blog/
      • _index.mdtype: blog + cascade
      • _index.zh.md
      • engineering/design notes and benchmarks
        • _index.mdcascade: images: [/images/engineering.webp]
        • parallel-restore.md
        • parallel-restore.zh.md
      • release/one post per version
        • _index.mdcascade: images: [/images/release.webp]
        • 2.4.0.md
        • 2.4.0.zh.md

The section root sets the type for the whole subtree, along with anything every post should share:

content/blog/_index.md
---
title: Blog
description: Engineering notes and release announcements
type: blog
icon: fa-solid fa-blog
sidebar_root_for: self      # the blog has its own sidebar tree
cascade:
  type: blog
  feedback: false           # posts do not ask "was this page helpful?"
  comments: true            # but they do take comments
---

params.ui.blog_section (default blog) tells the theme where the blog root is. If you name the directory something else, change that parameter or keep sidebar_root_for: self as above.

In the sidebar, blog sections start expanded and list posts newest first. A post with a weight is pinned above the dated ones there; the post index ignores weight and stays in date order.

List layouts and pagination

Below the section’s own _index.md text, OINK appends the post index: every post in the section and its subsections, newest first, without year groups. blog_index chooses how it looks:

Value Layout What the reader sees
list Horizontal rows (default) Thumbnail, title, date, subsection, tags and summary
cards Card grid A cropped 16:9 cover above the title, metadata and summary
table Compact table Date, title and tags, one row per post
gallery Image gallery Covers at their own proportions with titles and descriptions; click to open the post

Set the site default with params.ui.blog_index in hugo.yml, or set blog_index in a blog section’s _index.md to override it there; a section’s cascade passes it to the sections below. These settings shape blog section indexes only. Tag and category pages keep their own layout, and a custom home page needs its own template to show posts.

list, cards and gallery show 12 posts per page. Change that with blog_index_size, in hugo.yml for the site or in a section’s front matter for one blog:

hugo.yml
params:
  ui:
    blog_index_size: 20

Hugo’s pagination.pagerSize has no effect on these lists, because the theme passes blog_index_size to the paginator itself.

The card form

cards turns the rows into a grid of content cards, each with a 16:9 crop of the featured image above the title, a date and subsection line, and a three-line summary:

hugo.yml
params:
  ui:
    blog_index: cards
    blog_index_columns: 3

blog_index_columns applies above the xl breakpoint; between md and xl the grid has two columns, and below md one. When the image can be processed, Hugo crops it with .Fill, so readers download a small preview instead of the original.

Table and layout switching

table is an archive view: it always lists every post in the section on one page, without pagination. Set blog_index_toggle: true to let readers choose for themselves. A switch appears beside the title (and on L when keyboard navigation is on), cycling list → cards → table → gallery → list:

content/blog/_index.md
blog_index: cards
blog_index_toggle: true

The switch remembers the reader’s choice. With it on, list, cards and gallery share the same blog_index_size pages and pager, while table still shows every post at once. Every layout keeps date order and manual_link destinations. Hidden layouts load their images lazily, but their markup and thumbnails still add build time. With blog_index_toggle: false, only the configured layout is published and any saved reader choice is ignored.

gallery suits a blog whose posts are mostly visual. Each post becomes a linked cover, taken from its featured image; the default wall joins covers into rows while keeping their proportions. Titles and descriptions appear on hover or keyboard focus, and below the image on touch screens. A post without a cover keeps a title tile.

content/blog/_index.md
blog_index: gallery
blog_index_toggle: true
blog_gallery:
  mode: wall
  size: 240

The gallery toolbar offers three arrangements:

blog_gallery.mode Arrangement Captions
wall (default) Justified rows with 6px gaps On hover or keyboard focus; below images on touch screens
seamless The same rows without gaps On hover or keyboard focus; below images on touch screens
cards Masonry columns Always visible below images

blog_index: cards is the regular card grid; masonry inside the gallery is blog_index: gallery with blog_gallery.mode: cards. blog_gallery.size is the target tile size, from 160 to 360 CSS pixels with a default of 240, and has nothing to do with blog_index_size, the number of posts per page.

Readers can change the arrangement and size, and their choice is remembered separately from Expo albums. With keyboard navigation on and the gallery in view, ; cycles wall → cards → seamless, and , / < or . / > shrinks or enlarges tiles by 20 px.

The site default is a blog_gallery block under params.ui. A block in a page or cascade replaces it whole, and any field it omits falls back to wall and 240. The reference tables are in site parameters and page parameters.

RSS

Which pages publish a feed is decided by outputs. Adding RSS to section gives every section its own feed:

hugo.yml
outputs:
  home: [HTML, markdown, LLMS]
  page: [HTML, markdown]
  section: [HTML, RSS, print, markdown]

Writing outputs replaces all of Hugo’s defaults, so list RSS explicitly. A page kind without it has no feed, and the build does not warn you.

With the tree above, /blog/index.xml carries every post, subsections included, and /blog/release/index.xml only the release posts. Individual posts have no feed of their own. Each language has its own feed at that language’s path plus index.xml, and Hugo’s services.rss.limit caps the number of items. On the blog root and its first-level subsections, the first button on the title row is the RSS link, so readers never have to guess the address.

To publish no feeds at all, turn the kind off. That is more thorough than removing RSS from each page kind:

hugo.yml
disableKinds: [RSS]

In a feed, components take their static form: disclosures are expanded and interactive controls removed.

Share

params.ui.share adds a row of share links at the top of the page end. It is empty by default, so nothing appears until you list the targets you want, in the order you want them:

hugo.yml
params:
  ui:
    share: [x, bluesky, mastodon, reddit, hackernews, email, copy]

Sixteen targets are available: x, bluesky, mastodon, facebook, linkedin, reddit, hackernews, telegram, whatsapp, line, pinterest, weibo, chatgpt, claude, email and copy. An unknown name warns and is dropped. There is no discord, because Discord offers no public share link to build one from; copy covers it.

The page key is also share, so a cascade limits the bar to one tree, a page’s own list replaces the inherited one, and share: false removes it from a single page:

content/blog/_index.md
cascade:
  share: [x, bluesky, email, copy]

Only regular pages show the bar; lists, term pages and the home page have no single item to share, and print, Markdown and RSS output leave it out. Each target is a plain link carrying the page’s permalink and title, plus a local copy button. The bar loads no third-party scripts or stylesheets, and a service hears about the page only when a reader clicks its link.

chatgpt and claude hand that same permalink to an assistant with a prompt asking it to read the page. They are separate from the “Open in ChatGPT” and “Open in Claude” items of the page action menu, which send the live browser URL when clicked and therefore stay behind page_context_menu.assistant_links.

The copy button is the built-in copy_link action, which the Command Palette offers on every page whether or not a share bar is configured.

Verify

hugo --printPathWarnings

The build should end with Total in … and no ERROR. Then check that:

  1. the post appears at /blog/ in the right date order, with the date in the format you expect;
  2. public/blog/index.xml exists, contains the post, and uses complete absolute links;
  3. the post has a thumbnail in the index (if not, none of the three featured-image sources matched);
  4. each tag chip leads to its tag page.

5 - Books

Turn a directory tree into a book with type: book: chapter numbering, numbered figures and tables, cross-references, generated indexes and whole-book print.

Documentation is consulted: readers arrive from search, read one page and leave. A book is read in order, and its readers expect what print taught them: numbered chapters, figures and tables they can cite as “Figure 2-1”, cross-references that keep working when chapters move, and the whole text as one document they can print or export. Set type: book on a content tree and OINK provides all of that while every chapter stays an ordinary Markdown page.

A book needs two site settings. Goldmark block attributes and passthrough must be on, as listed in the three Goldmark prerequisites, and params.ui.shell_types must contain book, which the default list already does. If the manuscript already exists in another Hugo site, read Migrating an existing manuscript first.

A minimal book

The book root is an ordinary Hugo section, its subdirectories are chapters, and the pages inside them are sections. That tree is the only chapter list: the sidebar, the pager, the generated contents and the printed book all read it, so moving a file moves the chapter everywhere at once.

content/handbook/, one book

  • content/handbook/
    • _index.mdbook home: type: book + cascade, holding book-toc and the indexes
    • ch01/
      • _index.mdchapter 1 front page: book_number: 1
      • install.mdsection 1.x
      • bootstrap.md
    • ch02/
      • _index.mdchapter 2: numbered with book_number, optionally marked draft
      • replication.md
      • failover.md
    • appendix.mdan unnumbered appendix, still in the sidebar and the reading order

The root page declares the type, cascades it to every page below, and asks for the print output that produces the whole-book document. Print is opt-in because aggregating every chapter makes the build noticeably slower:

content/handbook/_index.md
---
title: The PostgreSQL operations handbook
type: book
book_number: B
cascade:
  type: book
outputs: [HTML, print, markdown]
---

Front matter outputs replaces the site’s list for that page, so name every format the root should keep. To set it in hugo.yml instead, add print to outputs.section, or to outputs.home when the book is the site root; that turns print on for every page of that kind.

A chapter’s _index.md needs only a title, its number and its position:

content/handbook/ch02/_index.md
---
title: Replication and failover
book_number: 2
book_status: draft
weight: 20
---

Chapter numbers, drafts and headings

book_number is shown exactly as written before the chapter title, in the sidebar entry and in the generated contents. The theme never derives a number from directory order, so 2, B and A are all valid, and rearranging the tree never changes a number a reader has already cited. Figure, table, equation and example numbers follow the same rule: each num is a string you write, such as 2-1, 5.3 or A-2, not a counter.

book_status: draft labels an unfinished chapter in the sidebar and in book-toc. It is an editorial label, not Hugo’s draft: the chapter still builds and publishes. To also put a localized notice above the body of every draft chapter, turn on the banner, which is off by default:

hugo.yml
params:
  ui:
    book_draft_banner: true
    sidebar_headings: 3

The banner appears only on type: book pages with book_status: draft, and its text is the book_draft_notice localization string.

sidebar_headings lists the current page’s headings under its sidebar entry, which helps in long chapters. It is false by default; true lists h2 headings, and 2, 3 or 4 sets the deepest level listed. A page or a section cascade can override the site value, and the table of contents on the right is unaffected either way.

Give every heading you plan to link to an explicit ID, such as ## Synchronous replication {#sync-replication}. A generated ID changes when the heading text does, which is fine for navigation but breaks references that must last. The complete key definitions are in Configuration and Page parameters.

Numbering: the native form

Figures, tables, equations and examples each get a number from an attribute line placed directly under the Markdown block, with no blank line between them: num= sets the number, #id the anchor, and caption= a plain-text caption. This is the form to reach for first, because the source stays readable in any Markdown viewer and footnotes inside the block keep working.

Figures

Without an #id, a figure’s anchor is fig-<num>.

Source
![The OINK release notes page](/images/releasenote.webp)
{#book-release-note num="2-1" caption="The release notes page is also the single source of release facts." width=600 height=300}
The OINK release notes page
Figure 2-1 The release notes page is also the single source of release facts.

Native figures need markup.goldmark.parser.wrapStandAloneImageWithinParagraph: false; otherwise Hugo wraps the image in a paragraph, the attribute line attaches to the paragraph, and the figure gets no number. The alternative text comes from the image’s own ![…], never from the caption. To make the figure a link, add link= to the same attribute line; you do not need the fig shortcode for that.

Tables

An attribute line under a pipe table numbers it, with tbl-<num> as the default anchor.

Source
| Isolation level | Dirty read | Non-repeatable read | Phantom read |
| --- | --- | --- | --- |
| Read Committed | Not possible | Possible | Possible |
| Repeatable Read | Not possible | Not possible | Possible |
| Serializable | Not possible | Not possible | Not possible |
{#tbl-2-1 num="2-1" caption="Anomalies permitted at each PostgreSQL isolation level."}
Isolation level Dirty read Non-repeatable read Phantom read
Read Committed Not possible Possible Possible
Repeatable Read Not possible Not possible Possible
Serializable Not possible Not possible Not possible
Table 2-1 Anomalies permitted at each PostgreSQL isolation level.

Equations

An attribute line under a $$ block numbers the formula, with eq-<num> as the default anchor. On wide screens the number and caption sit to the right of the formula; on narrow screens they wrap below it, and a formula wider than the screen scrolls sideways. Short captions keep equations easy to scan.

Source
$$
A = \frac{\mathrm{MTBF}}{\mathrm{MTBF} + \mathrm{MTTR}}
$$
{#eq-2-1 num="2-1" caption="Availability from MTBF and MTTR."}
A=MTBFMTBF+MTTR A = \frac{\mathrm{MTBF}}{\mathrm{MTBF} + \mathrm{MTTR}}
Equation 2-1 Availability from MTBF and MTTR.

This form needs Goldmark passthrough. A site without it uses the eq shortcode below, which renders the formula with KaTeX during the build.

Examples

A code fence with num= and caption= becomes a numbered example, with eg-<num> as the default anchor. An #id on the fence names the surrounding <figure>, which is what references point to. An example needs both attributes: a caption without a number is ignored, and a number without a caption is dropped with a warning. The caption heads a single frame around the code.

Source
```sql {num="2-1" caption="Daily write volume on the primary." #eg-2-1}
SELECT date_trunc('day', ts) AS day, count(*)
FROM pg_stat_statements_history
GROUP BY 1 ORDER BY 1 DESC LIMIT 7;
```
Example 2-1 Daily write volume on the primary.
SELECT date_trunc('day', ts) AS day, count(*)
FROM pg_stat_statements_history
GROUP BY 1 ORDER BY 1 DESC LIMIT 7;

Numbering: the shortcode form

The shortcodes fig, tbl, eq and eg render the same <figure> as the native form, register in the same target table, and sort by their position in the source. Use them when a single Markdown block cannot hold the content: a figure made of several images or other Markdown, several tables under one number, an equation on a site without passthrough, or an example with several fences and prose between them.

fig takes its image from src= or from its inner Markdown, never both. It also accepts link, alt, width, height and class, and title as an alias of caption for migrated content:

Source
{{< fig num="2-2" src="/images/docsy.webp" alt="The default Docsy shell"
    caption="OINK's upstream: the Docsy content model is still underneath." width="600" height="300" />}}
The default Docsy shell
Figure 2-2 OINK's upstream: the Docsy content model is still underneath.

tbl wraps the label, the table, the caption and the anchor in one figure:

Source
{{< tbl num="2-2" caption="How a numbered component appears in each of the four outputs." >}}
| Output | Label | Anchor |
| --- | --- | --- |
| HTML | Visible | Stable |
| Print | Visible | Stable |
{{< /tbl >}}
Output Label Anchor
HTML Visible Stable
Print Visible Stable
Table 2-2 How a numbered component appears in each of the four outputs.

eq renders its content with KaTeX during the build, so it works without passthrough:

Source
{{< eq num="2-2" caption="Connection pool saturation." >}}U = \frac{\lambda}{\mu \cdot c}{{< /eq >}}
U=λμ⋅cU = \frac{\lambda}{\mu \cdot c}
Equation 2-2 Connection pool saturation.

Written without parameters, {{< eq >}} is plain display math: it has no number and no anchor, xref cannot point at it, and it is not listed among the equations.

eg wraps any Markdown, usually one or more fences:

Source
{{< eg num="2-2" caption="Bringing up a new replica with pg_basebackup." >}}
```bash
pg_basebackup -h primary -U replicator -D /pg/data -Fp -Xs -P -R
```
{{< /eg >}}
Example 2-2 Bringing up a new replica with pg_basebackup.
pg_basebackup -h primary -U replicator -D /pg/data -Fp -Xs -P -R

In both forms, an ID must be unique within its page, and within one kind a number maps to a single ID. A duplicate keeps the first registration and logs a warning that gives the line of the first one.

No footnotes inside a shortcode body

Hugo renders each shortcode body as a separate document, but footnotes belong to the page. A [^label] inside the body of tbl, eg, fig, card, tab, field or include therefore either prints literally, when the definition is on the page, or starts a second footnote list whose fn:N IDs collide with the page’s own, when the definition is inside the body. The build warns with the file, line and label.

Use the native form for a table or code block that needs footnotes. A table, image or fence with {num=… caption=…} stays in the page document, so its footnotes number and link normally, and the rendered figure is the same. Footnote-like text in code, such as a [^0-9] character class, is not affected.

Cross-references

On the same page an ordinary link works: Table 2-1 points at the isolation-level table above. You type the label and number yourself, though, and must find every such link when a number changes. xref builds the label, number and link from the kind and number, and works across pages and languages:

Source
See {{< xref fig="2-2" />}} and {{< xref eg="2-1" />}};
with an explicit anchor: {{< xref fig="2-1" anchor="book-release-note" />}}.

See Figure 2-2 and Example 2-1; with an explicit anchor: Figure 2-1.

  • Give at most one kind key: fig, tbl, eq or eg. It supplies the localized label (Figure, Table, Equation, Example) and the default anchor <kind>-<num>.
  • anchor= replaces that anchor when the target declared its own #id.
  • page= points at another page, looked up in the current language, so the source never hard-codes a /zh/ prefix.
  • Without a kind, give both anchor= and the link text: {{< xref page="../ch01/install" anchor="sync-replication" >}}synchronous replication{{< /xref >}}.
  • A reference may come before its target, on the same page or in a later chapter.

In the whole-book print, an xref becomes a jump within the document, while a plain Markdown link to another page still points at the website. Write any reference that should also work in print as an xref.

Indexes: contents and lists of figures

Five shortcodes generate what a printed book carries up front: a table of contents and lists of figures, tables, equations and examples. Each walks the book tree, renders the pages below the current navigation root and collects what they registered, so they usually sit on the book root (_index.md) or a dedicated page:

content/handbook/_index.md
{{< book-toc depth=3 >}}

## List of figures {#lof}
{{< book-figures >}}

## List of tables {#lot}
{{< book-tables >}}

## List of equations {#loe}
{{< book-equations >}}

## List of examples {#lox}
{{< book-examples >}}

They appear here only as source, because on this page they would list the entire Docs tree. OINK Hands-On shows them at work; its source is content/book/_index.md.

  • book-toc lists chapters at depth=1, adds nested sections at 2 (the default), and adds each page’s headings at 3. drafts=false leaves book_status: draft chapters out of this list without unpublishing them.
  • book-figures, book-tables, book-equations and book-examples take no parameters. Each entry reads like “Figure 2-1 — caption” and links to the target’s anchor.
  • In the whole-book print, every one of these links becomes a jump within the document.

Reading order

Readers move through a book with the pager at the end of each page. It follows the sidebar tree in pre-order, a section’s index page first and then its children by weight, and it is on for docs, book and blog by default. Set params.ui.pager_types to change those types, or pager: false to remove it from one page:

hugo.yml
params:
  ui:
    pager_types: [docs, book]

Entries hidden with toc_hide, link-only manual_link entries and sidebar_divider rows are never pager destinations.

Printing the whole book

Once the root has the print output, /_print/handbook/ holds the whole book as one HTML document: a cover, a table of contents, the root page’s body, and every chapter in reading order. Pages with no_print: true, link-only entries, divider rows and hidden placeholders are left out. Per-chapter print and the print switches are covered in Print.

Numbered figures, tables, equations and examples keep their IDs exactly, so xref links resolve inside the document. Heading and footnote IDs get a prefix naming their source page, because several chapters may each have a summary heading or a first footnote fn:1; the links the theme generates are rewritten to match. A single page printed on its own keeps its ordinary IDs.

For EPUB or PDF, also list BookManifest in the root’s outputs. The build then writes book.json beside the root page, recording the reading order, headings, numbered targets and references. Two scripts in the theme repository turn the manifest and the print HTML into files: bin/book-epub.py needs Pandoc 3 and a Pandoc metadata file with the book’s title and author, and bin/book-pdf.py needs Chrome or Chromium and produces A4 pages. Run them after the build; Hugo itself produces neither file. Here and below, /path/to/oink is a checkout of the theme repository at the release your site pins:

Terminal
python3 /path/to/oink/bin/book-epub.py --manifest public/handbook/book.json \
  --public public --metadata epub.yaml --output handbook.epub
python3 /path/to/oink/bin/book-pdf.py --manifest public/handbook/book.json \
  --public public --output handbook.pdf

Migrating an existing manuscript

A manuscript written for another Hugo theme usually numbers figures with a site-specific figure shortcode, bold pseudo-captions and bare links to #fig_* anchors. bin/migrations/book_figures.py rewrites those forms into fig, tbl and xref and keeps the anchors already published, so inbound links keep working. Pin the site to the current OINK release first, then migrate the content on a dedicated branch, starting with a dry run:

Dry run: diff and report only, no files changed
python3 /path/to/oink/bin/migrations/book_figures.py \
  --profile tpme \
  --root /path/to/your-book \
  --report /tmp/book-migrate.json > /tmp/book-migrate.diff

Each profile recognizes the conventions of one real manuscript, and only the forms actually found in it. DDIA has one profile for each of its two editions:

tpme
A pseudo-h6 caption beside an image, a caption beside a table, and bare /en/...#fragment links
ddia-v2
The site’s own figure shortcode, classified by number into figure / table / code example
ddia-v1
A bare image with an adjacent bold numbered caption, with the ID derived from the image filename
pg-internal
A bold or italic “Figure N” caption in Chinese or English next to an image, and a numbered table caption next to a table

A manuscript whose conventions match none of them is rewritten by hand into the native form.

--profile
Required; one of the four values above
--root
Required; the consuming repository’s root
--path
Restricts to a file or directory under --root; repeatable. The default scans the whole content tree
--write
Applies the rewrite. The default is a dry run that writes nothing
--no-diff
Suppresses the diff while keeping the summary and the report
--report
Writes the machine-readable JSON report

The diff goes to standard output and the summary to standard error. The report carries files_scanned, files_changed, counts, skipped and idempotent. The script rewrites only targets it can identify uniquely; where the number is unclear, the caption is not unique or the marker form is unknown, it leaves the text alone and records the item in skipped for you to handle. Bold text, inline code and formulas inside a legacy caption become plain text, because a Book caption is plain text.

After reviewing the diff, apply it, then run the script again to confirm there is nothing left to change:

Apply, then verify idempotency
python3 /path/to/oink/bin/migrations/book_figures.py \
  --profile tpme --root /path/to/your-book --write \
  --report /tmp/book-migrate-written.json

python3 /path/to/oink/bin/migrations/book_figures.py \
  --profile tpme --root /path/to/your-book --no-diff \
  --report /tmp/book-migrate-second.json

The second report should show files_changed: 0, empty counts and idempotent: true, and the script exits with code 0.

Verify

  1. Build with hugo --printPathWarnings and read every warning: a malformed number, a duplicate ID and an example without a caption each produce one.
  2. On a page, check for localized labels such as “Figure 2-1” and for xref links that land on their targets.
  3. Compare the chapter order in the sidebar, the pager, book-toc and the whole-book print.
  4. Check the Markdown output with curl -s http://localhost:1313/handbook/ch02/index.md. A shortcode figure becomes **Figure 2-2.** caption followed by its body; a native figure keeps its source block and attribute line.
  5. Run the theme’s anchor check against the build output. It confirms that every reference’s target exists, that kind and number agree, that IDs are unique within each page, and that numbered images have alternative text; it expects at least one numbered target and one xref.
Terminal
python3 /path/to/oink/bin/check-book.py --site-public public

Book shortcode parameters

num , string , default—
Required (except for the bare eq form). Matches [0-9A-Za-z.-]+ and must be quoted
id , string , defaultfig-<num> / tbl-<num> / eq-<num> / eg-<num>
Matches [A-Za-z][A-Za-z0-9_.:-]* and is preserved byte for byte
caption , plain text , defaultempty
Required for eg. Optional for fig, tbl, and eq. Not Markdown
class , class token , default—
Appended to the <figure>. Requires num
src , image path , default—
fig only. Mutually exclusive with inner content, and follows the shared image resolution order
link alt width height , — , default—
fig only. Width and height are positive integers
title , plain text , default—
fig only. A migration alias for caption, mutually exclusive with it

xref:

fig tbl eq eg , number string , default—
At most one. Supplies the localized label and derives the anchor
anchor , ID , defaultderived from kind and number
Required when no kind is given, together with inner link text
page , page reference , defaultcurrent page
Resolved through page lookup in the current language. A missing page warns and renders text without a link

book-toc:

depth , integer 1–3 , default2
1 chapters / 2 with nested sections / 3 with the heading tree
drafts , boolean , defaulttrue
false filters draft chapters out of the generated list

book-figures, book-tables, book-equations and book-examples take no parameters.

Limits

  • An attribute line must touch its block. A formatter such as Prettier that separates or moves it turns a numbered figure back into a plain image without any warning.
  • book_kind and book_part are accepted as metadata but change nothing on the page; only book_number and book_status have a visible effect.
  • The index shortcodes render every page below the root, which lengthens the build of a very large book. Whole-book print is opt-in for the same reason.
  • EPUB and PDF come from the two scripts, never from Hugo alone. Typeset pagination, font embedding and back-of-book index compilation are not provided.
  • Organizing content — how the tree becomes the sidebar and the reading order
  • Images — captions, sizing, zoom and image processing
  • Tables — table attribute lines and full-width tables
  • Math — KaTeX and passthrough configuration
  • Print — per-chapter and whole-book print

6 - Image albums with Expo

Create an image album, add optional metadata, select a layout, and use the image viewer.

Expo turns folders of images into a collection readers browse rather than read: albums grouped in the sidebar, a grid of the selected album’s images, and a viewer for zooming and stepping through them. Use it when the images are the content, such as a photo archive, a screenshot library or a set of posters and diagrams. For a few images inside an article, the Gallery component fits better. The example albums show every control described here.

Create an album

An album is a folder holding an index.md that describes it and an images/ subfolder with the pictures. Filenames supply the default image titles, so an album needs no file per image; you add metadata only where you want more.

content/photos/
├── _index.md
├── nature/
│   ├── _index.md
│   └── field-notes/
│       ├── index.md
│       └── images/
│           ├── 01-fern.jpg
│           └── 02-river.gif
└── buildings/
    ├── index.md
    └── images/
        └── arch.jpg
  1. Create the section entry, which makes everything below it an Expo page:

    content/photos/_index.md
    ---
    title: Photo albums
    type: expo
    cascade:
      type: expo
    ---
  2. Create a topic entry for each group of albums:

    content/photos/nature/_index.md
    ---
    title: Nature
    weight: 10
    ---
  3. Create the album page:

    content/photos/nature/field-notes/index.md
    ---
    title: Field notes
    description: Plants and water from a field visit.
    weight: 10
    ---
    
    Photographs from the north trail.
  4. Put the images in the album’s images/ folder.

A section page lists its child topics and albums, and the sidebar follows the same tree; on narrow screens it opens as a navigation drawer. The album’s body text is optional and appears above the images.

Expo does not paginate, so split a large collection into several albums. On a section page, each album card uses the album’s first image in sort order as its cover, and a topic without images of its own borrows the first one from its albums. Covers fill a 4:3 frame, so they may be cropped.

Image metadata

To give an image a title, description, credit or fixed position, add a resources entry to the album’s front matter. The src path is relative to the album folder.

Album front matter
resources:
  - src: images/01-fern.jpg
    title: Fern
    params:
      id: fern
      alt: A green fern frond seen from above
      caption: Branching leaves beside the north trail.
      byline: Alex Chen
      weight: 10
Field Use
title Image title. If omitted, Expo derives a title from the filename
params.alt Text that describes the image. If omitted or empty, it uses the title
params.caption Plain-text description
params.byline Plain-text credit
params.weight Numeric image order. Lower values come first. The default is 0
params.id Stable image ID within the album
params.original Optional path to another image in the same album bundle

Images with equal weights keep the order of their resource names. Because the default weight is 0, images without a weight come before any image with a positive weight; to fix the complete order, weight every image.

An id gives the image a permanent link, here /photos/nature/field-notes/#img-fern, which survives renaming the file as long as the album URL stays the same. Without one, Expo derives the ID from a hash of the filename, so renaming the file breaks links to the image. An ID starts with an ASCII letter or digit, may continue with _ and -, and must be unique within its album.

To link a larger original from a lighter preview, put the original in originals/ and set params.original: originals/fern.jpg. Keep both at the same aspect ratio, and keep originals/ outside the expo.images pattern, or every original also appears in the album as an image of its own. Expo reads only images in the album bundle; it never fetches remote files.

Defaults

Choose the site-wide layout and tile size in hugo.yml:

hugo.yml
params:
  ui:
    expo:
      images: images/*
      mode: wall
      size: 240
Key Allowed value Built-in default
images A pattern for image resources in the album bundle images/*
mode wall, cards, or seamless wall
size An integer from 160 to 360, in CSS pixels 240

An album, or a section through cascade, can set its own top-level expo block:

Album front matter
expo:
  images: images/*
  mode: cards
  size: 280

A page block replaces the site block as a whole: a field it omits takes the built-in default, not the site’s value. size is the tile size the layout aims for, not a fixed width and height for every image.

A reader’s own choice wins over both. The layout and size a reader picks are saved in the browser for the whole site and persist through reloads, album changes and appearance changes. When browser storage is unavailable, each page starts from your defaults.

Layouts

Mode Display
wall Rows of image tiles with 6 CSS pixels between them
cards Columns of cards with visible titles, descriptions, and credits
seamless Rows of image tiles with no gaps between them

Readers switch layouts with the three icons in the album toolbar, which also holds a play/pause button and an image-size slider. On devices with a mouse, wall and seamless show captions on hover or keyboard focus. Album tiles always show the whole image, so an image with extreme proportions leaves empty space inside its tile.

GIFs play by default, and Pause switches them to still previews. When the system asks for reduced motion, Expo starts with still previews and Play starts them. The button is disabled in an album without GIFs. Images load as they approach the visible area, but a large GIF still costs its full file size once it loads.

The image viewer

Selecting an image opens the viewer. A small image starts at its original size; a large one shrinks until it fits the image area in both directions.

Control Action
Reset Restore the initial size and center the image
Expand to fit Enlarge or shrink the image until its limiting edge fits the image area
Zoom out / Zoom in Divide or multiply the current scale by 1.25
Open original Open the original image file in a new tab
Locate in album Close the viewer and move to this image in the album
Previous / Next Show the adjacent image in the same album
Close Close the viewer and restore focus to an image link

Expand to fit keeps the whole image visible; it does not put the browser into fullscreen. Zooming in can make the image larger than the viewing area: drag it with the left mouse button, and it stops at the image’s edges. On a touch screen, an enlarged image scrolls natively, a fitted image changes with a one-finger horizontal swipe, and pinching keeps the browser’s own behavior. Double-click alternates between the initial fit and a closer view: a reduced image opens at 100% under the pointer, and an image already at its original size expands to fit.

Changing images resets the scale and position, and Previous and Next stop at the ends of the album. Percentages are in CSS pixels: at 100%, one source pixel occupies one CSS pixel.

Keyboard shortcuts

On an album page (not a section page listing albums), with keyboard_nav enabled, ; cycles through wall, cards and seamless, , / < shrinks the tiles by one step (−20 px), and . / > enlarges them by one step (+20 px).

The viewer has its own keys. They work whenever the viewer is open, whatever keyboard_nav says, and take precedence over the page’s single-key navigation. They stay out of the way of text input, input-method composition and any Ctrl, Command or Alt combination.

Key Action
W / A / S / D Move the enlarged image up / left / down / right
Q or H Previous image
E or L Next image
J or − Zoom out
K, + or = Zoom in
R or 0 Reset the size and position
F Expand to fit
Escape Close the viewer

W, A, S and D move the image 80 CSS pixels per press, and only along an axis where it overflows. The Left and Right arrow keys change images while the image fits horizontally; once it is wider than the viewing area, they scroll it instead. In right-to-left languages the arrows follow the reading direction.

Appearance and page width

Expo has no appearance settings of its own. Albums use the site’s visual preset (Paper, Slate, GitHub, Ink, News or Terminal) and its light or dark mode, readers switch them from the shared navigation as on any other page, and the grid re-lays itself out after a preset change. To offer every preset, set params.ui.preset_menu: [paper, slate, github, ink, news, terminal]; see Visual presets. The top navbar follows the site’s navbar settings, and the album page shows its image toolbar instead of the article action menu.

An album uses the full available page width and has no outline on the right. Set page_width in its front matter for a narrower body. If your site sets params.ui.shell_types, keep expo in the list, or albums lose their sidebar.

Translations and other outputs

For a Chinese album, add index.zh.md beside index.md, and _index.zh.md to each translated section. Both languages share the image files; translate the title, description and resource metadata in each page, and keep the same image id for the same image so links match across languages.

Albums work without JavaScript: image links open the original files and captions stay visible. Where you enable them, Print shows still previews, Markdown and LLMSFULL list image links with their metadata, and RSS carries static image descriptions. See Print and Agent outputs to turn those outputs on.

Check an album

  1. Run hugo --printPathWarnings and read the warnings.
  2. Open each album and confirm the image order, titles and descriptions.
  3. Open a small image, a wide image, a tall image and, if the album has one, a GIF.
  4. Try Reset, Expand to fit, zoom, dragging, the keyboard shortcuts and Locate in album.
  5. Check both languages, a narrow screen, each preset you offer, and light and dark mode.

An empty album usually means a wrong type, a folder that is not a page bundle (no index.md), or an expo.images pattern that matches nothing. A default that seems to have no effect is usually overridden by a choice saved in your browser, or by a page expo block that replaced the whole site block.

7 - Releases and downloads

Publish a release page with a GitHub release card, a checksummed asset table and install instructions, all built from facts kept in your repository.

A release page tells readers what shipped and lets them download it safely: a card linking the GitHub release and its source archives, a table of files with their checksums, and install instructions for each way of getting the software. OINK builds all of it from facts kept in your repository (one release_url in the page’s front matter, the sha256sum output you paste into the body, and a data/download/<key>.yaml record), so the build never contacts GitHub.

The examples on this page are rendered for real

This page’s own front matter sets release_url to OINK v0.4.0, so the card, asset tables and download block below are live output. The checksums and asset filenames are made up, and the download links they produce point at files that do not exist. Do not verify anything against these hashes.

What a release page is made of

What you want What renders it Where the facts come from
A summary card with tag, date, source archives and repository release-card The page’s release_url
A table of assets with checksums The checksums fence, or release-assets sha*sum lines in the page body
Install instructions for several channels download data/download/<key>.yaml
A chronological index of releases layout: releases Each page’s release_url, or its title

Link the release

A release page names its GitHub release with one front matter key, the release URL for an exact tag:

content/blog/release/0.4.0.md
release_url: https://github.com/pgsty/oink/releases/tag/v0.4.0

The owner, project and tag come from the URL, and the date from the page’s own date. A value that is not an exact-tag GitHub release URL warns and the release block is skipped. Pages written for OINK 0.5 (the release map, release_products, release_group_by_product) get a warning naming the replacement; see the 0.6.0 release notes.

Put the card where you want the summary. The shortcode takes no parameters, because every fact comes from the front matter:

Source
{{< release-card >}}

The card carries four links derived from the URL: the release itself, the .tar.gz and .zip source archives, and the repository. It does not list checksum files, which belong in the asset table below, or compare the release with the previous one, which GitHub already does on the release page.

Checksums and assets

Paste the output of sha256sum (or any sha*sum command) into a checksums fence, and the page gets a download table with each file linked and its hash ready to copy:

Source
```checksums
1e2f4c8a9d05b7361f8ac25d0e7b4913a6c8df215047eb9c3a1d6b8250f9e7c4  oink-0.4.0-linux-amd64.tar.gz
7b3d9e0c145a8f26d0b7e93c48156aa2f0d9c7b31e846a5029df1b6c7a3e8250 *oink-0.4.0-darwin-arm64.tar.gz
```
Download asset
FileChecksum
oink-0.4.0-linux-amd64.tar.gz Linuxamd64SHA-256 1e2f4c8a9d05b7361f8ac25d0e7b4913a6c8df215047eb9c3a1d6b8250f9e7c4
oink-0.4.0-darwin-arm64.tar.gz macOSarm64SHA-256 7b3d9e0c145a8f26d0b7e93c48156aa2f0d9c7b31e846a5029df1b6c7a3e8250

Each line must be either <hex><two spaces><filename> or <hex><space>*<filename>, exactly as the tools print it; blank lines and lines starting with # are ignored. The hash length identifies the algorithm (MD5, SHA-1, SHA-256 or SHA-512), and one block holds one algorithm. A filename must be a single path segment, and package type, operating system and architecture badges are added when the filename makes them recognizable. A malformed line, or one whose algorithm differs from the rest of the block, warns with its line number and is skipped, so a single typo costs one row rather than the table.

On a page with release_url, asset links point at https://github.com/<owner>/<repo>/releases/download/<tag>/. On a page without one, set base= to wherever the files are hosted. Setting both, or neither, warns and skips the block, because a guessed base would publish links to the wrong files:

a page with no release_url
```checksums {base="https://repo.pigsty.io/oink/v0.4.0/" algo="sha256"}
1e2f4c8a9d05b7361f8ac25d0e7b4913a6c8df215047eb9c3a1d6b8250f9e7c4  oink-0.4.0-linux-amd64.tar.gz
```

algo= pins the algorithm instead of inferring it, and group="auto" groups rows by platform and architecture.

release-assets is the shortcode form of the same table. It adds one parameter the fence lacks, src=, which reads the checksum file itself from a page resource or global asset instead of inline lines; use either src or inline lines, not both.

Source
{{< release-assets group="auto" >}}
5a0c7d1e93b4826f0ad35c9e17b6402d8f1c95ae63d70b28c4e19a5f38207db6  oink-0.4.0-1.el9.x86_64.rpm
c93f16a8d052b7e41ac68d3907b25fe0a41d8c7362b95e0187ac4d63f9520ea8  oink-0.4.0-1.el9.aarch64.rpm
{{< /release-assets >}}

.rpm

Download asset
FileChecksum
oink-0.4.0-1.el9.x86_64.rpm Linuxamd64SHA-256 5a0c7d1e93b4826f0ad35c9e17b6402d8f1c95ae63d70b28c4e19a5f38207db6
oink-0.4.0-1.el9.aarch64.rpm Linuxarm64SHA-256 c93f16a8d052b7e41ac68d3907b25fe0a41d8c7362b95e0187ac4d63f9520ea8

The HTML table shortens each hash for display, while screen readers and the copy button get the full value; the copy button’s script loads only on pages that have a table. Without JavaScript the table is still complete and linked. Print and RSS show the full hashes without controls, and the page’s Markdown output is a pipe table of full hashes.

Download block

Install instructions belong to the product rather than to one release: the install script, the source archive and the package repository stay the same from version to version. Keep them in one data record and render it with download, whose only parameter is the record’s key, the file name under data/download/ without .yaml:

Source
{{< download "prd5" >}}

Install script

The rolling channel deliberately contains no version interpolation.

Install
curl -fsSL https://repo.example.org/oink/install | bash

Source archive

Source archive
Clone the tag
git clone --branch v0.4.0 https://github.com/pgsty/oink.git

Release assets

Download asset
FileChecksum
oink-0.4.0.tar.gz SHA-256 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

The block opens with a row of links to each channel, followed by one section per channel. Code steps use the enhanced code block and its copy button, and a channel with checksums renders the same asset table as above. Print shows the same content expanded, the Markdown output keeps the titles, code fences and full hashes, and RSS leaves the block out. A landing page’s download section reads the same record, so the home page and the docs never disagree about the current version; see Home and landing pages.

Release workflow

A release note and the download data do different jobs. The release note, written as a blog post, tells readers what changed, how to upgrade and what breaks; it carries release_url and can open with a release-card. The download data tells them which channel to use, which command to run and which hash to check, and it changes in one place when the version does.

Publish a new version in this order, so that no page ever links to a file that is not there yet:

  1. In data/download/<key>.yaml, set version to the new version and published: false. Rolling channels keep working, while pinned channels show a “pending release” state with their commands omitted and their asset links and copy buttons disabled.
  2. Write the release note, for example content/blog/release/0.4.0.md, with its release_url.
  3. Create the tag and upload the assets, then set published: true. Do not write a guessed download link into the prose in the meantime.

The release index page

A section of release notes can list them as a strict chronology instead of a blog index:

content/blog/release/_index.md
---
title: Releases
layout: releases
---

Every regular page in the section is listed newest first by date; when two pages share a date, the version in their tags breaks the tie, by SemVer precedence with a deterministic fallback for tags that are not SemVer. An entry whose release_url parses reads project tag, such as oink v0.4.0, above the page description. A page without one keeps its own title, so an ordinary note between releases is a normal entry rather than an error.

When you would rather keep the blog shell, blog_index: table gives a compact date-ordered archive instead; this site’s release notes use it.

Download data format

This site’s real record is data/download/prd5.yaml, the one rendered above:

data/download/prd5.yaml
version: 0.4.0
repo: pgsty/oink
published: true
channels:
  - id: script
    kind: rolling
    title: Install script
    title_zh: 安装脚本
    icon: fa-solid fa-bolt
    note: The rolling channel deliberately contains no version interpolation.
    note_zh: 滚动渠道刻意不插入版本号。
    steps:
      - title: Install
        title_zh: 安装
        code: curl -fsSL https://repo.example.org/oink/install | bash
        lang: bash
  - id: source
    kind: pinned
    title: Source archive
    title_zh: 源码归档
    icon: fa-solid fa-code-branch
    url: https://github.com/pgsty/oink/archive/refs/tags/${tag}.tar.gz
    steps:
      - title: Clone the tag
        title_zh: 克隆标签
        code: git clone --branch ${tag} https://github.com/pgsty/oink.git
        lang: bash
  - id: assets
    kind: pinned
    title: Release assets
    title_zh: 发布资产
    icon: fa-solid fa-box-open
    checksums: |
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa  oink-0.4.0.tar.gz

A record takes the five top-level fields below; any other key warns and the whole block is skipped.

version , string , defaultsite params.version
The current version. Missing from both the record and the site, it warns and the block is skipped
repo , owner/name , default—
GitHub repository; required once a pinned channel has a link or assets
tag , string , defaultv{version}
Release tag. URL-safe characters only
published , boolean , defaulttrue
false while the tagged release and its assets do not exist yet
channels , array , default—
The channels, in display order. Must not be empty

Each channel:

id , ^[a-z][a-z0-9-]*$ , default—
Unique within the record; also the channel’s anchor
kind , rolling | pinned , default—
Whether the channel follows the latest release or one exact version, which decides whether version facts may be interpolated
title , localized string , default—
Channel name. Must resolve to a non-empty value
note , localized string , default—
One line of explanation under the channel name
icon , Font Awesome class pair , default—
For example fa-solid fa-bolt
url , http(s) URL or site path , default—
Download link. Interpolated on pinned channels only
steps[] , title / code / lang , defaultlang: text
Code steps, rendered by OINK’s enhanced code block
checksums , sha*sum text , default—
Assets for this channel. pinned only; use this or checksums_src, not both
checksums_src , asset path , default—
Reads the checksum file as a Hugo asset

Two rules govern the text fields:

  • Localized fields resolve by suffix, from <field>_<exact language> to <field>_<base language> to <field>. A zh-cn page tries title_zh_cn, then title_zh, then title. camelCase variants are not accepted.
  • Only a pinned channel’s url and steps[].code interpolate ${version} and ${tag}. A rolling channel refuses interpolation, so a command meant to install the latest release is never silently tied to one version. Titles and notes never interpolate.

Verify

  1. Build with diagnostics visible: hugo --printPathWarnings. A malformed hash line, mixed algorithms, a missing base and a misspelled channel field each produce a warning; read them, because each one means a row, a table or a channel is missing from the page.

  2. On the page, check that the card’s tag and date match the repository and that every asset row opens a real download.

  3. Check each hash against the real artifact yourself. The table only displays the hashes you paste; it verifies nothing.

  4. Confirm the Markdown output carries the full hashes:

    curl -s http://localhost:1313/docs/write/releases/index.md | grep -c '^| '
  5. Try the page with published: false first, and switch to true only once the tag and assets exist. Check every language, and a subpath deployment if you use one.

8 - API reference pages

Render an OpenAPI specification as a browsable API reference with the bundled Swagger UI or Redoc, without a CDN.

Publish an API reference straight from the OpenAPI file your service already has: save the file under static/ and add one shortcode to a page. Choose Swagger UI when readers should try requests from the page, or Redoc when they mainly read endpoint descriptions and schemas. Both runtimes ship with the theme and load only on pages that use them, so the site needs no CDN, and Swagger UI’s online validator is turned off. Remote specifications, and the requests readers send to your API, still reach their own hosts.

Where the specification file goes

Put the specification under static/. Hugo publishes that folder unchanged at the site root, so both shortcodes get a URL the browser can fetch:

where the specification lives

  • static/
    • openapi/
      • docs-demo.yamlpublished as /openapi/docs-demo.yaml
  • content/
    • docs/
      • write/
        • openapi.mdthis page

Do not keep the file beside the page. Neither shortcode resolves page resources: a .yaml file in a page bundle is published only when a template asks for it, and naming it in a shortcode does not, so the browser gets a 404.

Both shortcodes also accept a remote https://… specification. Every page view then depends on that host and reveals the reader’s address and browser details to it, so intranet sites and sites with a Content Security Policy should serve a same-origin copy. Only http and https are accepted: any other scheme, a protocol-relative //host or an empty value warns, and the shortcode renders nothing.

To try the examples on your own site, save docs-demo.yaml as static/openapi/docs-demo.yaml. It describes a demonstration cluster-management API with no server behind it.

Swagger UI

swagger takes one named parameter, src: the specification’s URL from the site root. The theme resolves it like any other site URL, so it stays correct when the site is deployed under a subpath:

Source
{{< swagger src="/openapi/docs-demo.yaml" >}}

The page lists every operation as an expandable row with its request parameters and response schemas. “Try it out” sends a real request to the address in the specification’s servers list; the demonstration file’s address does not answer.

Redoc

redoc takes exactly one positional parameter, the specification path. A second parameter warns, and the shortcode renders nothing.

Source
{{< redoc "openapi/docs-demo.yaml" >}}

OpenAPI specification — https://oink.pgsty.com/openapi/docs-demo.yaml

A path is relative to static/, with or without a leading slash, and the shortcode turns it into an absolute URL based on baseURL: with baseURL: https://example.com/preview/, both openapi/docs-demo.yaml and /openapi/docs-demo.yaml become https://example.com/preview/openapi/docs-demo.yaml. An http or https URL is used as given.

Each redoc shortcode runs ReDoc 3.2.0 from the theme’s local files in a frame of its own. The frame keeps its navigation in its own URL fragment, so it never disturbs the article’s anchors or another reader on the same page. It uses ReDoc’s light palette, scrolls independently, and has a plain link to the specification below it. Telemetry is off and ReDoc’s two brand images are inlined, so the reader requests nothing from a CDN; a remote specification, and images the specification itself references, are still fetched from their hosts. Opened directly, the frame accepts only same-origin specifications. If your Content Security Policy restricts frames, allow the reader with frame-src 'self'.

ReDoc reads OpenAPI, AsyncAPI and GraphQL descriptions. Put code samples in the x-codeSamples extension; rename any x-code-samples left in an older specification. A site that customized the Redoc shortcode or its styles before OINK 1.6.0 should read Upgrade to 1.6.0.

The dedicated page shell

API references tend to be wide and long, so give them the swagger page type and a wide page:

content/api/_index.md
---
title: Cluster management API
type: swagger
page_width: wide
cascade:
  type: swagger
---

The swagger shell is the docs shell with one addition, a td-swagger class on <body> that lets site CSS target API pages. The sidebar, table of contents, breadcrumbs, pager and page end all behave as usual. swagger is in the default params.ui.shell_types; keep it there if your site overrides the list. Shells and page width are covered in Layouts and page types.

Output

Only the HTML page loads the interactive widgets. Print, Markdown and RSS replace each shortcode with a plain link to the specification; in Markdown it reads [OpenAPI specification](/openapi/example.yaml), not an endpoint list. A printed page or an agent reading the Markdown therefore sees no endpoints. If those readers need the important ones, describe them in prose on the same page, because text outside the shortcode appears in every output.

Limits

  • Both widgets have upstream accessibility limitations: Swagger UI renders unnamed server controls and scrollable regions without keyboard access, and Redoc’s operation descriptions fall below AA contrast ratios. If your site must meet strict accessibility requirements, document the key endpoints in Markdown prose as well.
  • Swagger UI and Redoc can share a page, but the page gets long and loads both runtimes. Choose one for a production site.
  • Several shortcodes on one page never collide: each container ID derives from the page address and the shortcode’s position.
  • There is no mock server. “Try it out” sends a real request to the address in servers.

Verify

  1. Build with hugo --printPathWarnings and read the warnings.
  2. Confirm the specification was published: ls public/openapi/docs-demo.yaml, or open http://localhost:1313/openapi/docs-demo.yaml.
  3. Expand a few endpoints on the page and check that their schemas appear and that the browser console shows no 404 or cross-origin error.
  4. Cut the machine off from the outside network while keeping the local preview server reachable, then reload. With local runtimes and a same-origin specification, the reference still appears.