Skip to content

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

Return to the regular view of this page

OINK Documentation

Build a technical content site. Use shared navigation, multilingual support, and search for documentation, blogs, books, and API references.

OINK is a Hugo theme for technical documentation: product manuals, project sites, books and API references, in one language or many. You write plain Markdown, run hugo, and get a static site with a navigation tree, local full-text search, light and dark modes, and a print view. The theme ships every script, font and stylesheet it uses, so the build needs no Node.js, npm or CDN.

New to OINK? Get started has this site running locally in two minutes and shows how to build your own with an AI agent. Already running OINK? Read the 1.8.0 release notes, then follow the upgrade guide.

Where to start

  • Get started — Clone the docs locally, try the AI agent prompt, or add OINK to a project.
  • Components — Callouts, tabs, diagrams, cards and more, each with its source beside the result.
  • OINK Hands-On — Build a site from one prompt, then learn every layer of it in ten hands-on chapters.
  • Case studies — How production sites solved navigation, migration and landing-page design.

Find it by task

I want to… Read
Decide whether OINK fits my project What is OINK
Write a documentation page Writing pages
Turn a folder tree into the sidebar Organizing content
Look up a component’s syntax Components
Publish a blog, a book or an image album Blog posts · Books · Expo albums
Change the name, logo, colors and fonts Brand and appearance
Look up a configuration key and its default Configuration
Publish in two or more languages Languages
Deploy to GitHub Pages, Cloudflare or my own server Deploy
Upgrade OINK or migrate from Docsy Upgrade
Fix a build error or a missing feature Troubleshooting

Design and CLI, at the bottom of the sidebar, document how OINK itself is built and maintained. You do not need them to build a site.

1 - What is OINK

Decide whether OINK fits your project, what you get with it, how it differs from Docsy and MDX-based tools, and where it falls short.

OINK is a Hugo theme for technical documentation that has outgrown a README: product manuals, API references, books, release pages and blogs, often in several languages, maintained by engineers rather than a front-end team. You write Markdown, run hugo, and publish a static site with a sidebar built from your folders, local full-text search, a print view and a Markdown copy of every page for AI agents. Every script, font and stylesheet ships inside the theme, so the build needs no Node.js, npm, Sass or CDN, and unless you add an integration such as analytics or comments, the theme makes your readers’ browsers request nothing from third parties.

OINK began as a fork of Docsy. It keeps Docsy’s content model and multilingual behavior and replaces the shell, navigation, search and components. Seventy-nine production sites run on it: 48 independent projects, among them Apache HugeGraph’s bilingual documentation, a nine-language team portal at Red Hat AI Services, and Cortrix’s AI agent memory docs, plus 31 sites from the PGSTY and Vonng ecosystem, the largest of which spans nearly 5,000 Markdown files in eight languages, Arabic included.

OINK turns Markdown content, configuration and local assets into one static documentation site
One Hugo build produces a static site ready to host

What you get

  • A build that needs only Hugo. Any edition of Hugo builds the site, and Go is needed only to download the theme as a Hugo Module. The stylesheet is plain CSS, so your repository has no Sass compiler, PostCSS step or package.json. Get started lists the versions.
  • Components that stay Markdown. > [!NOTE] is a callout, a table followed by {.fields} is a parameter list, and an image followed by {caption="…"} is a captioned figure. On GitHub or in any editor the same source still reads as a quote, a table and an image.
  • A complete reading shell. Sidebar tree, table of contents, breadcrumbs, pager, a Cmd/Ctrl + K command palette, keyboard navigation, light and dark modes and six visual presets.
  • Search without a service. A BM25 engine in the browser queries an index Hugo builds for each language, and it finds Chinese, Japanese and Korean text typed without spaces.
  • Real multilingual sites. Hugo’s own translation model, an interface translated into 32 locales, right-to-left scripts, and an optional view that puts a page beside its translation.
  • More than documentation. Books with numbered figures and cross-references, release and download pages generated from YAML, landing pages assembled from 22 section types, and OpenAPI references rendered by bundled Swagger UI and Redoc.
  • Output for people and machines. Print a whole section at once, read any page as plain Markdown, or point an AI agent at llms.txt.

Highlights describes each capability and links to its guide.

The theme stops at the static site. Your source can live on GitHub, GitLab or a private Git server, and Hugo’s output deploys to any static host. Content, brand and components specific to your product stay in your site; the theme supplies the shell and the reusable parts.

Is OINK for me

OINK fits when
  • The site has many pages and mixes documentation, a blog, a book, release pages and an API reference
  • You publish full translations, not an English site with a translate link
  • Builds must be reproducible, and the build machine may have no network access
  • Several sites should share one shell without copying layouts and shortcodes
  • Nobody on the team is a front-end engineer or wants to maintain a Node toolchain
Look elsewhere when
  • The site has one or two pages and needs no navigation; a README or a lighter Hugo theme is simpler
  • The site is mostly application UI; OINK can carry its documentation, but product components stay in your site
  • You want interactive React components inside your prose (MDX)
  • You want a completely different look from one switch; beyond the six presets, appearance changes go through CSS tokens and partial overrides
  • You need a CMS or a WYSIWYG editor

Weigh two more things. Most features are off until you configure them, including search, dark mode, image zoom, comments, feedback and the Markdown and agent outputs; the Starter turns the common ones on for you. And OINK is young and moves quickly: 1.0.0 shipped in August 2026 and 1.8.0 three months later. Each site pins an exact release, so nothing changes until you raise the pin, and the upgrade guide has a section for every release that asks you to change something.

How it differs from other documentation systems

The usual alternatives are Docsy, which OINK forked, and Node-based systems built on MDX, such as Docusaurus. These are the differences that tend to decide the choice:

OINK Docsy Docusaurus and other MDX systems
Build tools Hugo in any edition, plus Go to fetch the theme module Hugo Extended to compile Sass, plus npm for PostCSS and Autoprefixer Node.js and npm
Callouts and tabs Markdown that GitHub also renders: > [!NOTE], fences with {tab="…"} Shortcodes such as alert and tabpane MDX, with React components inside the prose
Search Bundled BM25 engine, one index per language, unspaced CJK included Lunr offline search, or a hosted service Algolia DocSearch, or a community plugin for local search
Fonts and scripts Bundled and served from your own domain; no jQuery Google Fonts unless switched off; jQuery on every page Scripts bundled by the Node build
Home page Sections listed in data/home/<lang>.yaml blocks/* shortcodes in a Markdown page A React page

If you already run Docsy, your content and most front matter carry over; Migrating from Docsy lists what to delete and convert. If you are comparing Hugo themes such as Docsy and Hextra, build a copy of your own content tree with each before you decide, because overrides and language needs show differences no feature list does.

OINK is a hard fork rather than a skin over Docsy, and it keeps Docsy’s source history, Apache-2.0 obligations and attribution; see License and acknowledgements.

Start here

  • Get started — Clone the Starter, preview it, make it yours one piece at a time, and deploy it.
  • Components — Every component on its own page, source first, then the result.
  • Showcase — 79 production sites and the OINK features each one uses.

Found a problem or want to send a fix? The contribution guide says where it goes. The 1.8.0 release notes describe the current release.

1.1 - Highlights

Look up what OINK adds to an ordinary Hugo theme, one capability at a time, with the setting that turns it on and a link to its guide.

Everything here ships in the theme. Some of it works as soon as a page uses it; the rest waits for one configuration key, named in its section next to the guide that explains it. If you are still deciding whether OINK suits your project, read What is OINK first.

Components are written in Markdown

Most components are ordinary Markdown plus an attribute line, so the source stays readable on GitHub and in any editor. A callout is a > [!NOTE] blockquote, with ten semantic types and one neutral disclosure. A parameter list is a table followed by {.fields}, steps and cards are lists followed by {.steps} or {.cards}, timelines and changelog updates are definition lists with {.timeline} and headings with {.update}, and images, videos and audio share Markdown image syntax with {caption="…"}. Tabs are adjacent code fences, each with a {tab="…"} attribute, and file trees, galleries, maps, Mermaid and ECharts are fences named after their data language. Outside OINK, all of these fall back to blockquotes, tables, lists, headings and code blocks with nothing lost.

For what plain Markdown cannot express, such as cards with icons and images, or a field entry several paragraphs long, there are 29 shortcodes. Offline quoted social posts are > [!SOCIAL] callouts, so they stay blockquotes in plain Markdown. Typeset copy (params.ui.rich_copy, on by default) also keeps pasted selections clean in rich-text editors such as Notion, Feishu and Word.

→ Components

Build with Hugo

Hugo builds the site in any edition, and nothing else runs during the build. The theme’s stylesheet is plain CSS that Hugo concatenates, so there is no Sass, PostCSS, npm or webpack step. Go is needed only to fetch the theme as a Hugo Module, over the network or from a local module cache; with an offline archive or a Git submodule in place, Hugo alone builds the site.

In the browser, search, the command palette, diagrams and tabs run as JavaScript. Those scripts ship with the theme, and each page loads only the ones its content uses.

→ Get started

Local-first

Everything the browser needs is committed to the theme repository: Bootstrap styles, Font Awesome, four font families, Mermaid, KaTeX, Markmap, Swagger UI, Redoc, Asciinema, ECharts, Infographic, Leaflet and a local PlantUML engine, among others. VENDOR.json records the version, source, license file and SHA-256 checksum of each one, so you can audit exactly what your site serves.

A feature that could contact another server stays off until you configure it completely. PlantUML renders in the browser unless you set params.plantuml.svg_image_url. Diagrams.net needs params.drawio.drawio_server, and Algolia needs appId, apiKey and indexName; with a value missing, each warns at build time and stays off rather than falling back to a public service. Interactive maps likewise wait for a tile service you name in params.map, and a video card contacts no platform unless the site lists it in params.video_embeds and the reader clicks.

Local-first covers the theme, not what authors add. External links, remote images and video, iframes and remote API specifications; hosted search such as Algolia or Google Programmable Search; analytics, comments and other SaaS integrations; and a remote PlantUML or Diagrams.net renderer are all network choices you make, and pages that use them need network access when they are read.

→ License and acknowledgements · Configuration

One source, four outputs

Every component has a defined form in each of four outputs, so a page reads correctly wherever it ends up: interactive HTML; a print view with the zoom and copy controls removed and every disclosure expanded; plain Markdown; and RSS. The print view covers a whole section at once (this section’s is /_print/docs/about/), and a page’s Markdown version is its address plus index.md.

The site lists the outputs it publishes under outputs; the theme adds none on its own.

→ Print · AI-agent support

Multilingual sites and 32 interface locales

OINK uses Hugo’s own multilingual model: translation routing, a language picker ordered by weight, fallback for untranslated pages, right-to-left scripts, and canonical and alternate links for search engines. The interface comes in 32 language packs with identical keys, covering all 31 locale file names Docsy supports plus a generic zh. Each pack is written natively, with no English placeholders; zh and zh-cn are Simplified Chinese and zh-tw is Traditional Chinese. With params.ui.compare: true, readers can open an existing translation beside the current page and scroll both together.

→ Languages · Duo view

Turn on params.offline_search and Hugo writes one search index per language. A scanning BM25 engine in the browser queries it, with no Lunr and no outside service. It matches English words with Porter stemming and a spelling fallback, code identifiers and symbol runs, and Chinese, Japanese or Korean queries typed without spaces, which it matches as overlapping character pairs. An index larger than 2 MiB moves page text into a separate file that loads in stages, and searching for a parameter’s name opens its field-list entry directly. A page can raise its ranking with search_boost and add synonyms with search_keywords.

→ Search

Command palette

Cmd/Ctrl + K opens one box for pages, commands and page actions such as switching language or theme and copying the page as Markdown, so finding something and doing something share an entry point. A bare / opens it ready to search, and a query that starts with > lists only commands.

→ Command palette

Keyboard navigation

Twenty-nine single-key shortcuts are on by default (ten for navigation, nine for actions and ten for the view), and can be turned off for a site, a section or a single page. w and s move through the sidebar tree and a and d collapse and expand it, q and e go to the previous and next page, k and j jump to the previous and next heading, h lists the pages you read recently and g goes home. Other keys search, edit or print the page, hand it to ChatGPT or Claude, fold or unfold everything at once, switch the preset, color mode and language, open the duo view, toggle Zen Mode, and widen or narrow the reading column. Every shortcut stands aside while you type in a text field or compose with an input method. Press ', or click the question-mark button in the footer, to see all twenty-nine in three columns; keys a page cannot use are dimmed.

→ Keyboard navigation

Turn on params.ui.backlinks and each page lists the pages that link to it. Hugo derives the list at build time from your ordinary links, so there is no new syntax and no JavaScript. The list sits in the right rail under “Backlinks” and folds after eight entries; this site has it on, so you can see it beside this page.

→ Backlinks

Four content types beyond documentation

Four kinds of page need more structure than a documentation page, and the theme provides it:

  • Books number their chapters. {#id num=} numbers figures, tables, equations and examples, xref cross-references them, book-toc, book-figures and related shortcodes generate indexes, and a whole book prints as one document.
  • Release and download pages are generated from data/download/*.yaml: release cards, asset tables and checksums, with the data deciding what is published.
  • Landing pages assemble home-page sections from data/home/<lang>.yaml, and any page with layout: landing can use data under data/landing/.
  • API references render with the bundled Swagger UI and Redoc, and the specification can live on the site itself.

→ Books · Releases and downloads · Home and landing pages · API reference pages

Output for AI assistants

Add markdown to outputs and every page also publishes a .md version, announced in its HTML <head> with rel="alternate" and offered in the page actions for copying or viewing. The LLMS output format writes an llms.txt inventory at the site root (this site’s is https://oink.pgsty.com/llms.txt).

Two more outputs serve agents that want everything at once. A section that enables LLMSFULL publishes its whole text as one llms-full.txt, which an agent fetches in a single request, and a site that enables NAVJSON publishes its sidebar tree as data in one navigation.json per language. This site publishes both: https://oink.pgsty.com/docs/llms-full.txt and https://oink.pgsty.com/navigation.json.

“Open in ChatGPT / Claude” links are off by default, because a click sends the page’s URL to a third party. A site turns them on with params.ui.page_context_menu.assistant_links.

→ AI-agent support

Versions

Configure params.versions to add a version menu to the navbar. An archived version shows a banner that links to the current one, and the site decides whether the menu jumps to the matching page or to each version’s home. Each version is a separately built and deployed static site, so no runtime service is involved.

→ Versions

See for yourself

This site has most of these features on. Four quick checks:

  1. Press Cmd/Ctrl + K on any page and type postgres to see local search results, then start the query with > to see only commands.
  2. Append index.md to this page’s address to get its Markdown version.
  3. Open https://oink.pgsty.com/llms.txt, the site inventory for AI assistants. It links to the docs section’s llms-full.txt and to navigation.json.
  4. Look at the “Backlinks” group in this page’s right rail; it lists the pages that link here.

1.2 - Case Guide

Find the OINK production case closest to your documentation, book, blog, catalog, or community site.

The quickest way to design an OINK site is to find a live one shaped like yours and see how it was built. The case library documents 79 of them: 48 independent community sites and 31 from the PGSTY and Vonng ecosystem, this documentation site included. Each case links to the live site (and to its source repository where that is public), explains the design and its trade-offs, and separates the code the site wrote itself from what the theme provides. Read the case for the architecture, then follow its links to the guides for exact configuration. Page counts and similar figures come from the snapshot taken when the case was written.

Choosing a starting point

Start the site itself from the Starter, not from the theme repository’s tests/site/: that folder is a test fixture whose pages exist to exercise rendering edge cases, not a design to copy.

Third-party and community sites

Apache HugeGraph

This Apache Software Foundation full-stack graph database platform applies a custom brand hero on OINK Slate across nearly 300 bilingual English and Chinese documentation pages.

Red Hat AI Services (CAI)

This Red Hat AI Services Business Unit team portal configures nine languages on OINK Paper and pairs with companion OpenShift AI field manuals.

Cortrix

Open-source semantic storage and memory docs for AI agents on OINK Slate, combining {.wide .expand} reference tables, Mermaid diagrams, and OpenAPI specs under /docs/.

Stashix

This self-hosted comic and manga library website uses OINK’s high-contrast Ink preset with a custom violet accent, announcement bar, and dark product preview.

GPUWorks

Bilingual GPU compute management documentation built with OINK and hosted as versioned release manuals on Read the Docs.

SSG Book

Static Site Generators in the Age of AI uses OINK’s dark-mode Book shell, lecture slides, learning paths, and playground under a clean subpath deployment.

CASSA

This Australian university student association site uses OINK’s centered landing hero for membership onboarding, timelines, club news, and merchandise.

AGW

This self-hosted AI Agent Workspace and Gateway keeps its centered product site and 88 bilingual documentation pages inside the site/ directory of its main application repository.

Zhang Muchuan

Personal essay and translation blog layering a custom Paper, Ink, and Vermilion editorial design and seal mark over OINK while keeping all four visual presets.

Nekonull’s Garden

This bilingual personal engineering blog and digital garden organizes 144 long-form essays, short shares, and TIL notes behind a typography-led landing page.

Sanbei’s Blog

This popular Go engineering and AI coding blog pairs dated essays with a structured AI playbook section on OINK Paper.

Homelab IaC

This Proxmox cluster Terraform and Ansible operations manual co-locates docs with infrastructure code and publishes HTML, Markdown, and llms.txt together.

System Design Notes

This 28-chapter Chinese study guide mounts numbered chapters directly into OINK’s Book reading shell with local Chinese search.

hongyu

This bilingual personal writing hub combines essays, a data systems knowledge base, and book and film reviews inside one OINK shell.

blog.xjkj.org

This Chinese Oracle database and homelab blog skips a marketing hero and uses OINK’s three-column card-grid blog shell directly as its entry experience.

Vianlex’s Wiki

This 150-page personal software engineering knowledge base uses landing cards to route readers straight into deep backend documentation trees.

Le Shi Handbook

This living personal systems manual records verified Linux Mint and Windows 11 configurations and recovery steps in a focused Chinese docs tree.

CAI Field Manual Library

Red Hat AI Services aggregated bookshelf site that mounts multiple OpenShift AI manual repositories over a shared Hugo Module layered on OINK.

OPIC

Bilingual Open Intelligent Computing platform site that migrated from Docusaurus 3 to single-binary Hugo + OINK with local BM25 Chinese search.

Tasklane

TypeScript background-task runtime website and 49-page Diátaxis documentation hub on OINK Slate with an asymmetric architecture hero.

pgcli

218-page bilingual PostgreSQL instance manager and Patroni operations manual on OINK Paper deployed to Cloudflare Pages.

ansible-vms

Bilingual KVM and libvirt virtual machine automation manual on OINK Paper sharing a sibling family design with pgcli.pages.dev.

YourBuddy

Desktop macOS AI workbench product site combining a centered landing hero, plugin documentation, and release downloads.

CC4PM Docs

89-lesson Chinese AI coding course documentation site built on OINK, including a dedicated curriculum module teaching OINK site building.

CheeseSec Docs

96-page bilingual security product manual covering CheeseWAF and plugins directly inside OINK’s three-column reading shell.

kbdiag

62-page bilingual KingbaseES command-line diagnostics manual bootstrapped directly from OINK Starter.

grelease

Compact Chinese documentation site for a Spring Cloud Gateway and etcd canary-release framework with dual user and maintainer entry points.

Claude API Proxy

Focused 15-page Chinese engineering manual written directly in OINK’s three-column docs shell for engineers and handoff AI agents.

Modern Front-End Engineering

63-page open-source front-end engineering textbook on OINK Book pairing chapters, lecture slides, learning paths, and a playground.

OOD & Agile Book

65-page postgraduate software engineering textbook combining manuscript chapters, companion code, syllabus, and slides on OINK Book.

PMPP 5th Ed

27-chapter Chinese-English parallel reading edition of Programming Massively Parallel Processors using OINK Duo View across 230 aligned anchors.

Turing Award Lectures

Chinese archive of 42 ACM Turing Award lectures (1966–2024) and 100+ Turing papers rendered with OINK’s build-time KaTeX math and hypothes.is.

Designing Virtual Worlds

285-page Chinese edition of Richard Bartle’s Designing Virtual Worlds mounted at /dvw/ with cover artwork and whole-book print.

Selected Works Reader

229-article five-volume classical reading edition showcasing archival Paper typography, book-style dotted TOCs, clickable endnotes, and locally subsetted CJK fonts.

Growth Hacker Notes

Searchable written edition of a 41-episode video course transcribed with FunASR and structured into seven chapters on OINK.

Elias Zhao

Bilingual personal engineering and quant blog migrated from Blowfish to OINK v1.6.0 Paper with a custom photographic hero and Duo View.

karmine’s notes

English security operations and detection engineering blog migrated from Blowfish to OINK Slate with every existing URL preserved.

YHY Study Website

86-page bilingual robotics and AI study hub with a bespoke dark pixel-terminal hero, shared Giscus comments across hosts, and Obsidian-to-OINK notes.

Yongjie Xue

335-page bilingual distributed systems, database, and AI engineering blog on OINK Slate with multi-column navigation and custom hero artwork.

KK’s Blog

217-post Chinese engineering blog migrated from Jekyll to OINK Paper using a clean chronological list-first homepage.

Zhuifeng Notes

60-page banking architecture and payment clearing personal hub on OINK Paper with custom SVG hero art and browser-local PlantUML.

Donny’s Blog

Self-hosting and open-source engineering blog pairing OINK’s Paper preset with a custom illustrated portrait hero.

Kina’s Blog

Minimalist bilingual personal blog on OINK Paper deployed to Cloudflare Pages with Giscus comments and an editorial still-life hero.

Leafz

Minimalist Chinese engineering blog on OINK Paper created by the maintainer of a community OINK Agent Skill.

Fang Sun

Bilingual academic index portal using OINK landing cards to link separate textbook companion sites and frontier paper notes.

WHLLE_YI

Creative bilingual CS portfolio combining vendored OINK with a pixel-art hero and an interactive browser terminal widget.

Nicole’s Notes

Personal homepage and learning journal organizing coursework, projects, bookmarks, skills, and growth logs across six OINK sections.

Zhangyi’s Notes

Bilingual personal engineering log on Cloudflare Pages demonstrating pinned Hugo builds and dual human/agent Markdown publishing.

Distribution documentation

pigsty.io

This very large English site combines a distribution manual, editorial blog, extension catalog, taxonomies, version navigation, and pricing landing pages.

pigsty.cc

This Chinese peer is deployed as an independent single-language site. This approach is useful when each language corpus has become a separate product.

pgsty.pro

This bilingual version archive renders many release pages from reusable, structured release data.

PG.CENTER

This eight-language PostgreSQL kernel and component documentation hub spans nearly 5,000 Markdown files, exercising split BM25 search indexes and Arabic RTL layout in one repository.

Product documentation

PIG

This compact bilingual CLI manual has a data-driven home page and a much larger companion blog.

SOW

This bilingual operations manual has a dedicated download content type that uses release metadata.

SILO

This large upstream migration uses a checked manifest to generate bilingual documentation navigation.

PG Exporter

This metrics manual combines generated navigation, a structured catalog, and system fonts.

Piglet

This agentic Postgres runtime product site pairs an asymmetric dark terminal hero with concise bilingual setup documentation.

Barn

This bilingual manual for local Linux labs and native macOS VMs combines warm editorial hero artwork with terminal quick-start previews, docs, and a blog.

Vchord

This 366-page bilingual manual for PostgreSQL vector and BM25 search extensions pairs technical architecture diagrams with benchmark comparisons and downloads.

Mooncake

This bilingual manual for PostgreSQL columnstore and Apache Iceberg lakehouse tables shares a diagram-led product identity with sibling PGSTY extension sites.

Crib

This focused Chinese product site for a native macOS offline PostgreSQL docs app pairs a centered Paper hero with a full-width dark app showcase.

Capslock App

This bilingual native macOS utility site expands on the two-page configurator with a centered hero, visual keymap diagram, docs, blog, and downloads.

Books and training

Designing Data-Intensive Applications

This multilingual, multi-edition book is the strongest example of numbered figures, cross-references, chapter navigation, and indexes.

The Product-Minded Engineer

This focused bilingual publication needs only OINK’s Book shell.

PG Internal

This finished Chinese translation is deliberately published as a single-language Book. It has no documentation tree or other language to select.

PG 36 Stratagems

This 36-chapter bilingual PostgreSQL and Pigsty production engineering book pairs custom 3D cover art with reproducible labs and multi-axis indexes.

Empire of AI

This focused bilingual non-fiction book uses OINK’s Paper preset, cover hero, contributor cards, and whole-book print output.

PG 18 Internals

This trilingual Chinese, English, and Russian technical book demonstrates Book navigation and Duo View comparison across three scripts.

Dalibo Training

This trilingual Chinese, French, and English training portal gathers twelve open-licensed PostgreSQL course manuals under one shared shell.

PGPRO Training

This 441-page trilingual Chinese, English, and Russian course library embeds a visual curriculum learning-path roadmap directly in the landing hero.

Postgres by Example

This 57-lesson bilingual tutorial book pairs syntax-highlighted SQL examples with downloadable runnable script bundles.

Blogs, standards, catalogs, and custom sites

VONNG

This 1,344-page bilingual personal technical blog organizes six long-running editorial columns with per-column RSS feeds alongside books and project pages.

Cloud Exit

This 690-page bilingual open standard, public cost ledger, and playbook uses a centered editorial Paper hero to anchor six structured content sections.

Feng Zhenbiao Archive

This 601-page personal biography, memoir, poetry collection, and Expo photography archive shows OINK serving humanities and long-term archival publishing.

PostgreSQL ecosystem library

This aggregate operations library combines several upstream manuals and partially translated language trees. They share one search and visual system.

pgsty.com

This small bilingual corporate site shows how OINK can primarily serve as a data-driven landing-page system.

Capslock

This project has two pages per language. Its custom shell hosts an interactive, data-driven configuration generator.

oink.pgsty.com

This full reference site contains public documentation, live component examples, design contracts, multiple content shells, and regression coverage in one repository.

pgext.cloud

This PostgreSQL extension catalog uses a queryable dataset as its primary object. It indexes 2,241 extensions and 576 packaged builds across 16 platforms.

→ Browse all cases · Get started · From scratch

1.3 - License and acknowledgements

Find which license covers the theme, this documentation and each bundled third-party runtime, and what you must keep when you reuse them.

OINK consists of three kinds of material, each under its own license: the theme source, this site’s documentation, and the third-party assets the theme ships. They are not relicensed as one combined work. Every table here links to the authoritative file in the repository, and where a summary disagrees with the license text, the file is authoritative.

Which licence covers what

Scope Licence Authoritative file
OINK theme source (layouts, partials, shortcodes, CSS, JS, i18n) Apache License 2.0 Theme LICENSE, NOTICE
This site’s own code, build scripts and material derived from Docsy Apache License 2.0 Site LICENSE, NOTICE
This site’s original documentation content, except where stated otherwise Creative Commons Attribution 4.0 International Site LICENSE-CC-BY-4.0
Browser libraries, fonts and icons shipped with the theme Each component’s own licence Theme VENDOR.json and the licence files beside each asset

CC BY 4.0 covers only the original documentation content, not theme code, trademarks, screenshots or third-party assets. Likewise, the theme’s Apache-2.0 license leaves each bundled dependency under its own license.

Community contributors

OINK is maintained by PGSTY. Thank you to @imbajin, who reported and contributed the reading repairs below together with their fixtures, regression tests and bilingual docs. They first shipped in 1.3.1 and remain in 1.8.0.

Contribution Pull request
Markmap node text across light/dark modes and visual presets Theme #48
Fixed TOC clearance above the footer Theme #50
Complete FileTree comments, integrated behind wrap=true Theme #52
Readable technical tables with an opt-in layout Theme #54
Bilingual contracts, release documentation, and companion regression coverage Documentation #11

The 1.3.1 release notes record how they were integrated. To contribute a correction, translation or fix, see the contribution guide.

Upstream: Docsy

The theme’s NOTICE records:

  • OINK is derived from Docsy, Copyright 2018 Google LLC and Docsy contributors.
  • OINK’s own theme work is Copyright 2026 PGSTY contributors.
  • The project and its upstream both use Apache License 2.0. VENDOR.json records each third-party browser dependency’s license, source, version, and checksum. Each required NOTICE file accompanies its asset.
  • The Docsy name and Google’s trademarks belong to their respective holders. These names identify the upstream project and imply no endorsement.

This site also derives from the Docsy project website, as the site’s own NOTICE records. Docsy is OINK’s only code upstream: OINK keeps Docsy’s source history, Apache-2.0 obligations and copyright notices, and modified files carry a modification notice as Apache-2.0 requires.

Third-party runtimes shipped with the theme

Everything the browser needs is committed to the theme repository, under assets/third_party/ and static/webfonts/, so these assets need no npm step and no download at build time; resolving the theme as a Hugo Module still needs Go and an available module source. VENDOR.json is their machine-readable manifest. Each entry records the name, pinned version, source URL, license file path and the SHA-256 of every selected artifact, and the manifest adds an aggregate checksum for each of the two asset trees.

The table matches the OINK v1.8.0 manifest (VENDOR.json generated 2026-11-28, schema 1, 26 entries). Versions change with each theme release, so use the manifest from your pinned theme version. Every source is the npm registry (https://registry.npmjs.org/…).

Package Version Licence What it does in the theme
bootstrap 5.3.8 MIT Grid, component styles, and RTL bundle
@fortawesome/fontawesome-free 7.3.1 CC-BY-4.0 AND OFL-1.1 AND MIT Icons throughout the site
@fontsource-variable/inter 5.3.0 OFL-1.1 Interface and body font
@fontsource-variable/ibm-plex-sans 5.3.0 OFL-1.1 Body font for Paper; print font for Terminal
@fontsource/chakra-petch 5.3.0 OFL-1.1 Brand display font
@fontsource/ibm-plex-mono 5.3.0 OFL-1.1 Code font (and screen text for Terminal)
@docsearch/js 5.2.0 MIT The optional Algolia DocSearch front end
@docsearch/css 5.2.0 MIT Its stylesheet
mermaid 12.4.0 MIT Mermaid diagrams
katex 0.19.1 MIT Mathematics styles and fonts
swagger-ui-dist 5.36.0 Apache-2.0 OpenAPI reference pages
redoc 3.2.0 MIT OpenAPI reference pages
asciinema-player 3.19.0 Apache-2.0 Terminal recording playback
echarts 6.1.0 Apache-2.0 Charts
@antv/infographic 0.2.20 MIT Infographics
leaflet 1.9.4 BSD-2-Clause Interactive maps (opt-in via params.map)
pako 3.0.3 MIT AND Zlib Decompression (diagram data)
external-svg-loader 1.7.1 MIT Inlining external SVG
idb-keyval 6.3.0 Apache-2.0 Browser-side caching
@plantuml/core 1.2026.10 MIT Local PlantUML diagram engine
@viz-js/viz 3.31.0 MIT AND EPL-2.0 Graphviz layout for local PlantUML
@markmap/core 1.1.1 MIT Mind maps (core model)
@markmap/parse 1.1.1 MIT Mind maps (Markdown parser)
@markmap/render 1.1.1 MIT Mind maps (SVG renderer)
@markmap/view 1.1.1 MIT Mind maps (interactive view)
@markmap/plugin-math 1.1.1 MIT Mind map formula rendering (MathJax)

Each license text sits beside its asset under assets/third_party/, for example assets/third_party/bootstrap/LICENSE and assets/third_party/katex/LICENSE, and Mermaid ships its upstream THIRD_PARTY_NOTICES. Swagger UI, ReDoc and ECharts keep their own NOTICE or bundled-declaration files. @viz-js/viz 3.31.0 embeds Graphviz 16.1.0 (EPL-2.0, replacing EPL-1.0) and Expat 2.8.5 (MIT); their notices and upstream source links sit beside the scripts in assets/third_party/plantuml/. The scoped Markmap 1.1.1 packages list every sub-package they bundle, MathJax and D3 primitives included, in assets/third_party/markmap/PACKAGES.json and LICENSES.txt. Packages that 1.5.1 and earlier shipped are no longer distributed: Bootstrap’s JavaScript bundle, @popperjs/core, lunr (with assets/js/third_party/), and the legacy Markmap 0.18, D3, highlight.js and WebFontLoader packages; the 1.6.0 release notes describe their removal.

If you redistribute the theme, include all of this license and notice material. If you update a runtime, update its artifact, license file, source and checksum in the same change.

Fonts and icons

Inter, IBM Plex Sans, Chakra Petch and IBM Plex Mono use the SIL Open Font License 1.1. OINK 1.8.0 ships 33 files under static/webfonts/: fourteen Inter subsets, twelve IBM Plex Sans subsets, four brand-font files and three Font Awesome files. Font Awesome Free 7.3.1 has a composite license: CC BY 4.0 for the icon artwork, SIL OFL 1.1 for the font files and MIT for the code, with the text in assets/third_party/Font-Awesome/LICENSE.txt.

The theme makes no request to a remote font service: the repository contains no Google Fonts link, and the site serves fonts only from its own baseURL. To change fonts or switch to the platform’s system fonts, see Brand and appearance.

Design references

Docsy is the only code upstream. The projects below influenced the design language only: OINK has ported no code from them and depends on none of them at runtime.

  • Fumadocs — Content-first presentation, information hierarchy, and writing components such as file trees and field lists (the theme’s NOTICE records this acknowledgement).
  • Nextra — A simple documentation shell, filename labels and copy controls on code blocks, and per-page layout switches.
  • Hextra — A Hugo-native approach to implementation, file trees, badges, and tabs.
  • Mintlify — Layered navigation structure, synchronized code groups, and the reading experience of an API reference.

Hugo is the build platform, and Go resolves modules when the theme is installed as a Hugo Module. Both are prerequisites; the theme redistributes neither binary.

These names describe origin, dependency or design influence and imply no endorsement by these projects. Project and product names belong to their respective holders.

Reusing this documentation

CC BY 4.0 lets you share and adapt this documentation for any purpose, provided you give attribution, link to the license, state whether you made changes, and do not imply endorsement by OINK, PGSTY or any upstream project. This attribution is sufficient:

Adapted from the OINK documentation by PGSTY contributors, licensed under CC BY 4.0, with modifications.

Images and quotations credited separately keep their own credit and license. Removing the page footer does not remove the attribution obligation.

Reusing the theme

Apache-2.0 lets you use, modify and distribute the theme source and build output on its terms: keep the license, copyright and attribution notices and the contents of NOTICE, and state which files you changed when you distribute modified source. A theme distribution should include LICENSE, NOTICE, VENDOR.json and every third-party licence file the manifest references.

Apache-2.0 grants no trademark rights, and it does not turn third-party assets into Apache-licensed works.

1.4 - Contributing to OINK

Report a problem or send a fix to the repository that owns it, with the checks a theme or documentation change needs before review.

Bug reports, corrections, translations and focused pull requests are all welcome. Three repositories share the work, so start by finding the one that owns the behavior you want to change.

Where to contribute

  • pgsty/oink — Templates, styles, browser runtimes, defaults, and focused theme checkers.
  • pgsty/oink.pgsty.com — Documentation, translations, examples, integration tests, and browser regression coverage.
  • pgsty/oink-cli — Optional CLI commands and native site checks.

Report a problem in the repository that owns the affected behavior. The CLI has its own version and release cycle, and ordinary Hugo sites do not need it.

Report a reproducible problem

A report that someone else can reproduce gets fixed fastest, so first check that the problem still occurs on the latest release. Then include the OINK version, the output of hugo version, the relevant configuration and a minimal content example. For a display problem, add the page, the viewport width, the browser, the visual preset and whether light or dark mode was on, and say what you expected and what happened instead. Remove credentials and private content from the report and any reproduction.

Build and check

Theme work needs the theme and this site cloned side by side, because the site’s checks build against the sibling theme checkout:

~/src/
├── oink/
└── oink.pgsty.com/

Use Hugo (tested on 0.170+) and Go for Hugo Modules; the theme declares no minimum Hugo release, and its CI tests against latest without maintaining older-Hugo compatibility jobs. The site’s regression tests also need Node.js 26.13.0 and npm 12.2.2 or newer, although no theme or site build uses them. Before you start, read each repository’s AGENTS.md, this site’s WRITING.md and TRANSLATION.md, and the Design contract for the area you are changing.

The theme’s stylesheet is plain CSS: edit the layer files under assets/css/td/, which Hugo concatenates. Editing a layer is the whole change, with no build step and no generated file to commit, and python3 bin/check-stylesheets.py checks the layers and how they are assembled.

Run the theme checker that covers your change first; the theme’s AGENTS.md lists them. Then run the site suites from this repository:

npm ci
make check
make browser

make check runs the non-browser suite against the sibling theme, and make browser runs the browser suite, which you need whenever rendering or interaction changed. Finally, look at the affected English and Chinese pages at desktop and mobile widths, in light and dark mode. The repository README explains how to build against the published theme release instead of your sibling checkout.

Do not add --panicOnWarning or HUGO_PANICONWARNING to a build or CI job. OINK reports invalid input as a warning and keeps building with a safe fallback, and its tests trigger those warnings on purpose, so the flag would fail the build.

Prepare a pull request

Keep a pull request to one change, and describe the problem, the resulting behavior and how you validated it. Update English and Chinese pages together and keep their heading IDs, because other pages and the theme’s warnings link to them. A change to public theme behavior ships with its implementation, the checker that covers it, and both language versions of the affected Design contract; new design proposals go in the bilingual Design proposals section.

Commit only source and reviewed test expectations. Generated output, caches, binaries and filesystem module replacements stay out of Git, and in a shared worktree, other people’s unrelated changes stay as they are. Leave historical release notes and dated research as written, because they record the evidence of their time.

Credit and licences

The acknowledgements credit each community fix to its author and pull request. Theme code and site tooling are licensed under Apache-2.0 and original documentation under CC BY 4.0; keep third-party license and notice files intact. See License and acknowledgements for the full scope.

2 - Get started

Clone the OINK docs site to run a full site locally in two minutes, then build your own personal or project site with an AI agent, from scratch, or inside a project’s docs/ folder.

The fastest way to understand OINK is to clone this documentation site and run it on your machine. In two minutes you have a complete live site to click through—with real Markdown source right beside it—and from there you can hand one prompt to an AI coding agent to build your own site.

Prerequisites

You need Git, Go, and Hugo (tested on 0.170+). Go is required because Hugo fetches the theme as a Go module; building an OINK site never needs Node.js, npm or a Sass compiler.

$ hugo version
hugo v0.170.1+withdeploy darwin/arm64

On macOS, brew install git go hugo installs all three. On Linux and Windows, follow the Hugo installation guide and the Go downloads page.

Step 1: Clone the docs site and run it locally

Instead of staring at an empty skeleton, clone oink.pgsty.com itself and start Hugo’s local server:

Terminal
git clone https://github.com/pgsty/oink.pgsty.com.git
cd oink.pgsty.com
hugo serve

The first run takes a moment while Hugo downloads the pinned OINK theme into your local Go module cache; every subsequent start takes a second. Open http://localhost:1313/ to explore the live site:

  • Click through Docs, Book, Case and Blog, and open the Appearance menu to switch between Paper, Slate, GitHub, Ink, News and Terminal in both light and dark mode.
  • Press / to try local full-text search, and switch between English and Chinese from the top bar.
  • Open any page under content/docs/components/ in your editor, change a sentence, and save: the browser reloads automatically so you can see how Markdown maps to rendered components.

Because this repository doubles as OINK’s integration test suite, treat it as a live reference rather than a template to deploy. Once you know what you want, create your own site in a fresh directory below.

Step 2: Build your own site with an AI agent

Once Git, Go and Hugo work on your machine, the fastest way to build your own site is to open a coding agent such as Claude Code or Codex in an empty folder and give it a concrete prompt backed by the OINK site-building skill (oink-site):

Terminal
mkdir my-site && cd my-site
claude   # or codex, or any coding agent that runs shell commands

Paste this prompt after replacing the <angle brackets> with your own details:

Prompt: build a personal site with Hugo and OINK
Read https://oink.pgsty.com/skill.md and follow it to build my personal site
with Hugo and the OINK theme in this empty directory.

About me: <Your Name>, <one-line bio, e.g. backend engineer writing about
databases and distributed systems>.
Domain: <https://you.example.com>.
Languages: <English, or English and Simplified Chinese>.

Site structure:
- Home page assembled from OINK landing data: a concise hero introducing me,
  cards linking to my main sections, and links to GitHub / X.
- A Blog section with card-grid indexes, tags, RSS feed, and three realistic
  starter posts in my voice.
- A Notes section using the Docs shell for evergreen technical notes.
- An About page with my bio, current projects, and contact links.

Appearance and hygiene:
- Default to the Paper preset, enable dark mode, and offer Paper, Slate,
  GitHub, Ink, News and Terminal in the Appearance menu.
- Enable local search, Markdown outputs, and llms.txt; include a .gitignore
  that excludes public/, resources/, .hugo_build.lock and .hugo_cache/.
- Pin the latest published OINK release in go.mod rather than tracking main.

When the production build passes with zero unexpected warnings, run hugo serve,
check the site in a browser on desktop and mobile widths, and tell me what
placeholders I should replace next.

The skill file (https://oink.pgsty.com/skill.md, or https://oink.pgsty.com/skill.zh.md for Simplified Chinese) sends the agent to these docs for current OINK syntax, warns it away from retired Docsy or older OINK keys, and maps each kind of site to real examples in the case library.

To keep the skill installed across sessions instead of referencing its URL each time, download it once and start a new agent session:

Claude Code
mkdir -p ~/.claude/skills/oink-site
curl -fsSL https://oink.pgsty.com/skill.md -o ~/.claude/skills/oink-site/SKILL.md
Codex
mkdir -p ~/.codex/skills/oink-site
curl -fsSL https://oink.pgsty.com/skill.md -o ~/.codex/skills/oink-site/SKILL.md

Download the file again whenever you want to refresh it; the header notes the OINK release it targets. For more prompt patterns—open-source project sites, CLI manuals and books—read Build a site from one prompt.

Choose your next guide

From here, follow the guide that matches where your site lives today:

  • Browse locally — Already have an OINK repository? Run hugo serve, read live docs in the browser, edit with auto-reload, and monitor reports written by coding agents.
  • From scratch — Assemble a minimal standalone site file by file, or switch an existing Hugo site to OINK: project layout, hugo.yml prerequisites, first page, and offline or submodule installs.
  • Add docs to a project — Already have an open-source codebase? Add an isolated docs/ Hugo sub-project with .gitignore hygiene and GitHub Pages or Cloudflare Pages auto-builds.
  • Upgrade — Upgrading an older OINK site or migrating from Docsy: version upgrades, syntax migration, and override review.

2.1 - Browse locally

Clone an existing OINK repository and run hugo serve to read docs in your browser, preview edits as you type, and watch AI agents’ latest reports render live.

You do not need to deploy a site—or even build one yourself—to get value from OINK. Whenever you have an OINK repository on disk (this docs site, a teammate’s handbook, an online book, or a workspace where an AI agent writes notes), running hugo serve turns that folder into a fast, searchable local website in your browser.

Clone and start the server

Install Git, Go and Hugo per Prerequisites, then clone the repository and run hugo serve (Hugo’s short alias for hugo server) in the folder that holds hugo.yml or hugo.yaml:

Terminal
git clone https://github.com/OWNER/OINK-SITE.git
cd OINK-SITE
hugo serve

The first start downloads the pinned OINK theme into your local Go module cache. Once the terminal prints Web Server is available at http://localhost:1313/, open http://localhost:1313/ in any browser. Press Ctrl with C in the terminal whenever you want to stop the server.

Read in the browser, not raw Markdown

Reading a documentation tree through hugo serve gives you the full reading experience that plain Markdown viewers cannot render:

  • Structured navigation: the collapsible sidebar, page outline (TOC), breadcrumbs, and previous/next links stay in sync with the folder tree.
  • Instant search and shortcuts: press / or Ctrl with K to search the whole repository locally, and press ' or click the footer ? button to view keyboard shortcuts.
  • Rendered components: callouts, tabs, field tables, KaTeX math, Mermaid and ECharts diagrams, and galleries render natively with no network dependencies. Maps render their place list offline too; map tiles load only when the site has configured a tile service.
  • Reader comfort: switch between Paper, Slate, GitHub, Ink, News and Terminal, toggle light and dark mode, open Duo View on bilingual sites, or print clean PDFs.

If the repository includes unpublished drafts (draft: true in front matter), start the server with hugo serve -D so those pages appear in the sidebar too.

Edit and watch changes reload live

Leave hugo serve running in one terminal while you edit Markdown files under content/ or home-page YAML under data/. Every time you save a file—or switch Git branches—Hugo rebuilds the affected pages in milliseconds and refreshes your browser tab automatically.

Useful daily preview commands
hugo serve -D                     # include draft pages while writing
hugo serve -D --navigateToChanged # jump the browser straight to the file you just saved
hugo serve -D --renderToMemory    # serve from memory without writing anything to public/

Passing --renderToMemory (-M) is especially clean when you are reviewing a repository in Git, because the preview never touches public/ on disk.

Follow AI agent reports in real time

When a coding agent such as Claude Code or Codex is working on a large task—for example, auditing a codebase, writing design proposals, drafting documentation, or logging experiment results—reading long Markdown tables and diagrams inside a scrolling terminal quickly becomes tiring.

Point the agent to write its reports as ordinary Markdown pages inside an OINK site’s content/ directory, and keep hugo serve -D --renderToMemory running in a side terminal with http://localhost:1313/ open in your browser:

  1. The agent writes or updates a report (such as content/docs/reports/audit.md) with headings, {.fields} tables, callouts, or Mermaid / ECharts diagrams.
  2. Hugo detects the file write immediately, rebuilds in memory, and reloads the browser tab while keeping your reading position.
  3. You read formatted sections, interactive diagrams, and cross-linked pages in real time—and because --renderToMemory writes no build output to disk, the agent’s Git working tree stays clean.

This turns any OINK repository into a zero-setup local reading room for both human notes and agent-generated reports.

Common snags

Symptom Fix
Port 1313 is already in use by another preview Run hugo serve -p 1314 to pick another port
A change to hugo.yml, data/, or a layout did not appear Restart with hugo serve --disableFastRender, then hard-reload the browser
A page with draft: true is missing from the sidebar Add -D (hugo serve -D)
The site lives inside a docs/ subfolder of a larger repo Run hugo serve -s docs from the repository root, or cd docs && hugo serve

For advanced server switches, phone/LAN preview, Docker containers, cache clearing, and production builds, see Local preview.

2.2 - From scratch

See what a minimal standalone OINK project looks like, build one from an empty directory, add OINK to an existing Hugo site, or install it without Go modules.

When you want a clean standalone OINK site and want to understand every file in it—rather than letting an agent scaffold it or cloning a large template—a working project takes only a handful of files. This guide walks from an empty folder to a live site, shows how to switch an existing Hugo site to OINK, and covers offline and non-Go install methods.

If you want to add documentation inside an existing code repository’s docs/ directory instead of creating a separate repository, read Add docs to a project. If you prefer a pre-built three-language Docs, Blog and Book template with GitHub Pages and Cloudflare Pages workflows ready to edit, you can also start from the OINK Starter. For Docsy sites, follow Migrating from Docsy.

What a minimal OINK project looks like

An OINK site is an ordinary Hugo repository. The theme itself does not live in your Git tree: go.mod pins the exact OINK tag, and Hugo downloads it into the module cache on the first build.

my-docs/

  • my-docs/
    • hugo.ymlsingle site config: title, baseURL, languages, Goldmark, params, theme import
    • go.modpins github.com/pgsty/oink@vX.Y.Z
    • go.sumchecksums that verify the pinned release
    • .gitignorekeeps public/, resources/ and Hugo caches out of Git
    • content/
      • _index.mdhome page entry (optional when data/home/ drives the home page)
      • docs/
        • _index.mdDocs section root: title, weight, sidebar root
        • install.mdyour first documentation page
    • data/
      • home/
        • en.yamloptional data-driven landing page (one file per language)
    • assets/
      • icons/logo.svgoptional navbar logo, processed by Hugo
      • css/project.cssoptional plain-CSS overrides (no Sass needed)
    • static/
      • favicon.svgoptional browser icon, copied unchanged

Everything else—stylesheets, scripts, fonts, Font Awesome icons, search, diagrams, and layouts—comes from the theme module. Commit source files plus go.mod and go.sum; keep public/, resources/, .hugo_build.lock and .hugo_cache/ ignored.

From an empty directory to the first page

Make sure Git, Go and Hugo are installed per Prerequisites, then run these four steps.

  1. Create the skeleton and fetch the theme

    Terminal
    hugo new site --format yaml my-docs
    cd my-docs
    git init
    hugo mod init github.com/example/my-docs
    hugo mod get github.com/pgsty/oink@v1.8.0

    Replace github.com/example/my-docs with your repository’s module path. hugo mod get creates go.mod and go.sum; commit both so every machine and CI run builds against the exact same verified theme release. Pin a tag rather than main so the site changes only when you deliberately upgrade; GitHub Releases lists every tag.

    Create .gitignore before your first build so generated artifacts never enter Git:

    .gitignore
    /public/
    /resources/
    /.hugo_build.lock
    /.hugo_cache/
    go.work
    go.work.sum
  2. Write hugo.yml

    Rename the generated hugo.yaml to hugo.yml (Hugo accepts either name; keep only one configuration file at the root) and replace its contents with the baseline below:

    hugo.yml
    title: Product Docs
    baseURL: https://docs.example.com/
    defaultContentLanguage: en
    # enableGitInfo: true # enable after your first Git commit so pages show last-modified dates
    
    languages:
      en:
        label: English
        locale: en-US
        weight: 1
        title: Product Docs
        params:
          description: Everything about running Product in production
        menus:
          main:
            - { name: Docs, pageRef: /docs, weight: 20 }
            - { name: Blog, pageRef: /blog, weight: 50 }
    
    # The three Goldmark prerequisites: OINK's Markdown components depend on them
    markup:
      goldmark:
        renderer:
          unsafe: true # allow inline HTML in content
        parser:
          attribute:
            block: true # attribute lines such as {.steps} {.cards} {caption=}
          wrapStandAloneImageWithinParagraph: false # block images carry attribute lines
      highlight:
        noClasses: false # code colors follow light and dark mode
    
    params:
      offline_search: true
      github_repo: https://github.com/example/my-docs
      copyright:
        authors: '[Example Inc.](https://example.com/)'
        from_year: 2026
      ui:
        preset: paper
        preset_menu: [paper, slate, github, ink, news, terminal]
        dark_mode: true
        sidebar_menu_foldable: true
        section_index: cards
    
    outputs:
      home: [HTML, markdown, LLMS]
      page: [HTML, markdown]
      section: [HTML, RSS, print, markdown]
    
    module:
      imports:
        - path: github.com/pgsty/oink

    Each block has one job:

    Block Controls Without it
    Top level + languages Site name, canonical baseURL, languages and navbar A wrong baseURL breaks absolute links and search in production
    markup.goldmark The three parser settings OINK components need Attribute lines render as literal {.steps} text
    params Local search, repository links, presets and shell switches Optional features stay off by design
    outputs Per-page .md copies, llms.txt and print views No “Copy as Markdown” or print view
    module Theme import Hugo cannot locate OINK

    For math equations, also add Goldmark’s passthrough extension from Math. Every site parameter and its default lives in Configuration.

  3. Write the first section and page

    Each top-level directory under content/ becomes a section, and nested folders build the sidebar ordered by weight. Give the section an _index.md and add your first page:

    content/docs/_index.md
    ---
    title: Docs
    linkTitle: Docs
    description: Everything about running Product in production.
    weight: 20
    ---
    
    Start with [Install](/docs/install/).
    content/docs/install.md
    ---
    title: Install
    description: Install Product on a fresh machine.
    weight: 10
    ---
    
    ## Prerequisites {#prerequisites}
    
    > [!IMPORTANT]
    > Product requires PostgreSQL 18 or newer.
    
    ## Install {#install}
    
    ```bash
    curl -fsSL https://get.example.com | bash
    ```

    Add explicit {#id} anchors to headings from day one: if you add a second language later, both languages share identical section links. See Writing pages and Organizing content for the full authoring model.

  4. Preview locally

    Terminal
    hugo serve

    Open http://localhost:1313/docs/. You should see the Docs sidebar listing Install, working search, and the appearance switcher. The site root stays minimal until you add a landing page in data/home/; see Home and landing pages.

Add OINK to an existing Hugo site

If you already have a Hugo site with content, work on a Git branch and keep your existing content/ tree intact; you do not need hugo new site:

  1. If the site lacks go.mod, run hugo mod init with your repository’s module path; if it already has one, keep it.
  2. Run hugo mod get github.com/pgsty/oink@v1.8.0.
  3. Replace the old theme selection in your configuration with module.imports pointing to github.com/pgsty/oink (keeping unrelated module imports), and merge the three markup.goldmark settings plus markup.highlight.noClasses: false from Write hugo.yml.
  4. Review custom templates under layouts/, stylesheets under assets/, old-theme shortcodes, and front-matter type or layout values that depended on the previous theme.
  5. Run hugo serve, check representative pages across light and dark modes, then turn on optional OINK features one by one and finish with Verify.

Other install methods

A Hugo Module is the default because Hugo resolves the version and verifies its checksum in go.sum. The other three methods serve specific constraints: an isolated network without Go proxy access, a host without Go installed, or an organization that audits a vendored copy inside its repository. Apart from hugo mod vendor, they replace module.imports with theme: oink, making version tracking and integrity checks your responsibility.

The four methods compared

Method Needs Go Version auditable Theme source in your repo Use when
Hugo Module Yes go.sum verifies automatically No The default
Git submodule No Repository records the commit By reference Theme must be referenced inside Git without Go
Offline archive No Checksums verified by hand Yes Air-gapped or offline build environments
Pinned source copy No Record the tag and checksum Yes Host requires a complete committed tree

Hugo Module (recommended)

Terminal
hugo mod init github.com/example/product-docs
hugo mod get github.com/pgsty/oink@v1.8.0
hugo.yml
module:
  imports:
    - path: github.com/pgsty/oink

Run hugo mod graph to verify the resolved version and hugo mod get -u to upgrade. Every machine that builds the site needs Go.

Git submodule

The site repository pins an exact theme commit:

Terminal
git submodule add https://github.com/pgsty/oink.git themes/oink
git -C themes/oink fetch --tags
git -C themes/oink checkout v1.8.0
git add .gitmodules themes/oink
hugo.yml
theme: oink

CI must initialize submodules before running Hugo, otherwise themes/oink is empty:

CI checkout step
git submodule update --init --recursive

Offline archive

For an isolated network without internet access, prepare the theme on a connected machine and move the complete package across. There are two routes.

hugo mod vendor freezes the resolved module into _vendor/, so later builds need neither network access nor Go:

Terminal
hugo mod vendor          # writes _vendor/ with the theme's mounted tree
tar czf ../my-docs.tgz . # place the archive outside the directory being packed

Whenever _vendor/ exists, Hugo reads it automatically (hugo mod graph shows +vendor) and module.imports stays unchanged. Only the vendoring step needs Go; to upgrade, re-run hugo mod get and hugo mod vendor on a connected machine. Because _vendor/ omits LICENSE, NOTICE and VENDOR.json, copy those three files from the theme repository if you redistribute the archive.

A release tag archive avoids Go modules completely. Download a tagged archive and unpack it into themes/oink/:

Terminal
curl -L -o oink.tar.gz \
  https://github.com/pgsty/oink/archive/refs/tags/v1.8.0.tar.gz
mkdir -p themes/oink
tar xzf oink.tar.gz -C themes/oink --strip-components=1
hugo.yml
theme: oink

Because the repository root is the theme root, layouts/, assets/, i18n/ and static/ unpack straight under themes/oink/. To transfer the archive with a checksum, create both on the connected machine:

Connected machine
git clone --branch v1.8.0 --depth 1 \
  https://github.com/pgsty/oink.git oink
git -C oink archive --format=tar.gz --prefix=oink/ \
  --output=../oink-v1.8.0.tar.gz v1.8.0
shasum -a 256 oink-v1.8.0.tar.gz \
  > oink-v1.8.0.tar.gz.sha256

Verify and unpack on the isolated machine:

Isolated machine
shasum -a 256 -c oink-v1.8.0.tar.gz.sha256
mkdir -p themes
tar -xzf oink-v1.8.0.tar.gz -C themes

Confirm these eleven top-level entries exist before your first offline build, and keep LICENSE, NOTICE and VENDOR.json when redistributing:

themes/oink/

  • oink/
    • go.modmodule path declaration
    • hugo.yamltheme default parameters and mounts
    • theme.tomltheme metadata required by theme: oink
    • LICENSEApache-2.0
    • NOTICEupstream attribution
    • VENDOR.jsonthird-party runtime manifest: version, source, license, SHA-256
    • assets/stylesheets, JS and bundled third-party runtimes
    • layouts/templates, partials, shortcodes, render hooks
    • static/bundled font files
    • i18n/32 interface language catalogs
    • data/SPDX license table for page-end attribution

Bootstrap, Font Awesome, fonts, search, and diagram runtimes all ship inside the theme, so an offline deployment needs no node_modules, PostCSS or CDN.

Pinned source copy

If your host requires theme source files inside the site repository, unpack a verified tag archive into themes/oink/ as above, set theme: oink, and commit the files alongside a note of the tag and SHA-256 checksum.

Do not run git clone into themes/oink and commit that folder: the nested .git directory makes Git record an uninitialized gitlink instead of the files. To track by reference, use a Git submodule.

Developing against a local theme checkout

Only needed when editing the OINK theme and a site together. Place both checkouts side by side:

Sibling directory layout
~/pgsty/
├── oink/            # the theme
└── product-docs/    # your site

Point Hugo at the sibling checkout for a single command without touching go.mod:

Terminal
cd ~/pgsty/product-docs
HUGO_MODULE_REPLACEMENTS='github.com/pgsty/oink -> ../oink' hugo serve

A Go workspace (go work init with HUGO_MODULE_WORKSPACE=go.work) works the same way. Neither should ever enter Git; CI must build the release pinned in go.mod. See Previewing against a theme checkout for verifying which theme release actually resolved.

Verify

Terminal
hugo mod graph                                                  # confirm the resolved OINK tag
hugo --cleanDestinationDir --gc --minify --printPathWarnings

The build succeeds when it finishes with Total in … and prints no unexpected warnings. Check that /docs/ opens with your sidebar, search finds a heading from your page, dark mode changes code-block colors (noClasses: false), and git status --short lists only source files (hugo.yml, go.mod, go.sum, content/).

  • Get started — run the docs site locally and try the AI agent prompt
  • Browse locally — daily reading, live editing, and watching AI agent reports
  • Add docs to a project — embed an OINK site inside a repo’s docs/ directory
  • Configuration — every hugo.yml key and default
  • Deploy — publishing public/ to GitHub Pages, Cloudflare Pages, or your own host
  • Upgrade — upgrading OINK releases and migrating from Docsy

2.3 - Add docs to a project

Add a self-contained OINK documentation site inside an existing open-source repository’s docs/ directory, keep build outputs out of Git, and wire GitHub Pages and Cloudflare Pages auto-builds.

You already have an open-source repository with application code—a Go service, a Rust CLI, a Python package, or a database extension—and you want real documentation to live right beside the code so pull requests update code and docs together. Putting a self-contained OINK site inside docs/ keeps Hugo isolated from your main build while publishing cleanly on every push.

For a real production example of this layout, see AGW, which hosts its bilingual documentation and landing page inside a subfolder of its application repository.

Repository layout

Keep the Hugo configuration, module pin, and content completely inside docs/:

my-project/

  • my-project/
    • cmd/your project's own source code
    • internal/
    • go.modyour project's own Go module (if it is a Go project)
    • README.md
    • .gitignoreexcludes docs/ build outputs without hiding app files
    • .github/
      • workflows/
        • ci.yamlexisting application tests
        • docs.yamlbuilds and deploys docs/ only when docs/ changes
    • docs/self-contained OINK sub-project
      • hugo.ymlsite config with github_subdir: docs
      • go.modpins github.com/pgsty/oink@vX.Y.Z
      • go.sumverifies the pinned OINK release
      • content/
        • _index.md
        • docs/
          • _index.md
          • install.md
      • data/
        • home/
          • en.yaml
      • assets/
        • icons/logo.svg
      • static/
        • favicon.svg

Giving docs/ its own go.mod is deliberate: even if your project itself is written in Go and already has a go.mod at the repository root, the two module graphs stay completely separate so the documentation theme never enters your application’s dependency tree.

Initialize the docs/ sub-project

Install Git, Go and Hugo per Prerequisites, then run these steps from your project’s repository root:

  1. Create docs/ and pin OINK

    Terminal
    mkdir -p docs/content/docs
    cd docs
    hugo mod init github.com/OWNER/PROJECT/docs
    hugo mod get github.com/pgsty/oink@v1.8.0

    Ending the module path in /docs keeps it distinct from the root module. Commit both docs/go.mod and docs/go.sum so CI resolves the exact same theme tag you tested locally.

  2. Write docs/hugo.yml with github_subdir

    Create docs/hugo.yml. Compared to a standalone site, the crucial extra setting is params.github_subdir: docs: without it, every Edit this page and history link points to /content/... at the repository root and returns 404 on GitHub.

    docs/hugo.yml
    title: My Project
    baseURL: https://OWNER.github.io/PROJECT/
    defaultContentLanguage: en
    enableGitInfo: true
    
    languages:
      en:
        label: English
        locale: en-US
        weight: 1
        title: My Project
        params:
          description: Documentation for My Project
        menus:
          main:
            - { name: Docs, pageRef: /docs, weight: 20 }
    
    markup:
      goldmark:
        renderer:
          unsafe: true
        parser:
          attribute:
            block: true
          wrapStandAloneImageWithinParagraph: false
      highlight:
        noClasses: false
    
    params:
      offline_search: true
      github_repo: https://github.com/OWNER/PROJECT
      github_branch: main
      github_subdir: docs # required when the Hugo site lives in docs/
      ui:
        preset: paper
        preset_menu: [paper, slate, github, ink, news, terminal]
        dark_mode: true
        sidebar_menu_foldable: true
        section_index: cards
    
    outputs:
      home: [HTML, markdown, LLMS]
      page: [HTML, markdown]
      section: [HTML, RSS, print, markdown]
    
    module:
      imports:
        - path: github.com/pgsty/oink
  3. Add your first page and preview

    Write docs/content/docs/_index.md and docs/content/docs/install.md (see From scratch for minimal examples), then preview from the repository root with -s docs (or cd docs && hugo serve):

    Terminal (from repository root)
    hugo serve -s docs

    Open http://localhost:1313/docs/ and verify that the Edit this page entry in the page-actions menu beside the title opens docs/content/docs/... in your repository.

Manage .gitignore cleanly

Hugo writes generated HTML, processed images, lock files and module caches into the site directory. Add explicit docs/-prefixed ignore rules to your repository’s .gitignore before running your first build, so generated output never bloats Git history or creates merge conflicts—and so you never accidentally ignore a public/ or resources/ directory used by your main application:

.gitignore (repository root)
# OINK / Hugo documentation build outputs and local caches
docs/public/
docs/resources/
docs/.hugo_build.lock
docs/.hugo_cache/
go.work
go.work.sum

Know which files stay out of Git and which ones CI requires:

Path Track in Git? Why
docs/public/ Ignore Built HTML/CSS/JS output; regenerated cleanly by CI on every deploy
docs/resources/ Ignore Cached processed images (_gen/); stale copies bloat diffs
docs/.hugo_build.lock Ignore Ephemeral Hugo build lock file
docs/.hugo_cache/ Ignore Local or CI Hugo cache directory
go.work, go.work.sum Ignore Machine-local Go workspace paths break other contributors and CI
docs/hugo.yml, docs/go.mod, docs/go.sum Commit Site configuration and exact checksum-verified OINK release
docs/content/, docs/data/, docs/assets/, docs/static/ Commit Authored Markdown, landing data, logos, CSS and static files

Run a production build once and check git status --short to verify that zero generated files show up as untracked:

Terminal
hugo -s docs --cleanDestinationDir --gc --minify --environment production --printPathWarnings
git status --short

Auto-build on GitHub Pages

Add one GitHub Actions workflow at .github/workflows/docs.yaml. Two details differ from a standalone docs repository: every build step runs inside working-directory: docs (with cache-dependency-path: docs/go.sum and artifact path docs/public), and the paths: filter ensures code-only commits do not waste runner minutes rebuilding unchanged docs.

.github/workflows/docs.yaml
 1name: Deploy Docs to GitHub Pages
 2
 3on:
 4  push:
 5    branches: [main]
 6    paths:
 7      - 'docs/**'
 8      - '.github/workflows/docs.yaml'
 9  workflow_dispatch:
10
11permissions:
12  contents: read
13  pages: write
14  id-token: write
15
16concurrency:
17  group: github-pages
18  cancel-in-progress: false
19
20env:
21  # Never let a workspace override the release pinned in docs/go.mod.
22  GOWORK: off
23  HUGO_MODULE_WORKSPACE: off
24  HUGO_CACHEDIR: ${{ github.workspace }}/docs/.hugo_cache
25
26jobs:
27  build:
28    name: Build docs
29    runs-on: ubuntu-latest
30    defaults:
31      run:
32        working-directory: docs
33    steps:
34      - name: Check out repository
35        uses: actions/checkout@v7
36        with:
37          fetch-depth: 0 # required for enableGitInfo last-modified dates
38
39      - name: Set up Go
40        uses: actions/setup-go@v7
41        with:
42          go-version: stable
43          cache-dependency-path: docs/go.sum
44
45      - name: Configure GitHub Pages
46        id: pages
47        uses: actions/configure-pages@v6
48
49      - name: Install Hugo
50        uses: peaceiris/actions-hugo@v3
51        with:
52          hugo-version: latest
53
54      - name: Download OINK module
55        run: go mod download github.com/pgsty/oink
56
57      - name: Build production site
58        run: |
59          hugo --cleanDestinationDir --gc --minify --environment production \
60            --printPathWarnings \
61            --baseURL "${{ steps.pages.outputs.base_url }}/"
62
63      - name: Upload Pages artifact
64        uses: actions/upload-pages-artifact@v5
65        with:
66          path: docs/public
67
68  deploy:
69    name: Deploy
70    environment:
71      name: github-pages
72      url: ${{ steps.deployment.outputs.page_url }}
73    runs-on: ubuntu-latest
74    needs: build
75    steps:
76      - name: Publish
77        id: deployment
78        uses: actions/deploy-pages@v5

How the build logic hangs together:

  • paths: ['docs/**', '.github/workflows/docs.yaml'] triggers automatic deploys only when documentation or the workflow itself changes; workflow_dispatch still lets you trigger a deploy manually at any time.
  • defaults.run.working-directory: docs makes go mod download and hugo operate strictly on docs/go.mod and docs/hugo.yml without touching a root-level go.mod.
  • --baseURL "${{ steps.pages.outputs.base_url }}/" injects the exact URL GitHub Pages serves—including the /<PROJECT>/ subpath—so search indexes, stylesheets and canonical links never 404.
  • --printPathWarnings without --panicOnWarning keeps OINK’s warnings readable in the log without aborting on non-fatal diagnostics.

In GitHub, open Settings → Pages → Build and deployment → Source, choose GitHub Actions, and push to main.

Auto-build on Cloudflare Pages

Cloudflare Pages supports two deployment models for a docs/ sub-project. Pick one per Cloudflare Pages project—never connect both Git integration and Direct Upload to the same project:

Building in GitHub Actions and uploading docs/public via Wrangler lets you run the latest Hugo release (even when Cloudflare’s default build image ships an older Hugo), plus native paths: filtering so application-only pushes skip doc deploys.

.github/workflows/docs-cloudflare.yaml
 1name: Deploy Docs to Cloudflare Pages
 2
 3on:
 4  push:
 5    branches: [main]
 6    paths:
 7      - 'docs/**'
 8      - '.github/workflows/docs-cloudflare.yaml'
 9  workflow_dispatch:
10
11permissions:
12  contents: read
13  deployments: write
14
15concurrency:
16  group: cloudflare-docs-${{ github.ref }}
17  cancel-in-progress: true
18
19env:
20  GOWORK: off
21  HUGO_MODULE_WORKSPACE: off
22  HUGO_CACHEDIR: ${{ github.workspace }}/docs/.hugo_cache
23
24jobs:
25  deploy:
26    name: Build and upload docs
27    runs-on: ubuntu-latest
28    defaults:
29      run:
30        working-directory: docs
31    steps:
32      - name: Check out repository
33        uses: actions/checkout@v7
34        with:
35          fetch-depth: 0
36
37      - name: Set up Go
38        uses: actions/setup-go@v7
39        with:
40          go-version: stable
41          cache-dependency-path: docs/go.sum
42
43      - name: Install Hugo
44        uses: peaceiris/actions-hugo@v3
45        with:
46          hugo-version: latest
47
48      - name: Download OINK module
49        run: go mod download github.com/pgsty/oink
50
51      - name: Build production site
52        env:
53          SITE_URL: ${{ vars.CLOUDFLARE_SITE_URL || 'https://my-project.pages.dev/' }}
54        run: |
55          hugo --cleanDestinationDir --gc --minify --environment production \
56            --printPathWarnings \
57            --baseURL "${SITE_URL}"
58
59      - name: Upload to Cloudflare Pages
60        uses: cloudflare/wrangler-action@v4
61        with:
62          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
63          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
64          command: pages deploy docs/public --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME || github.event.repository.name }} --branch=${{ github.ref_name }}
65          gitHubToken: ${{ secrets.GITHUB_TOKEN }}

Set up Cloudflare once:

  1. In the Cloudflare dashboard, create a Direct Upload Pages project.
  2. Add repository secrets CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (scoped to Account → Cloudflare Pages → Edit).
  3. Set optional repository variables CLOUDFLARE_PROJECT_NAME (defaults to the repository name) and CLOUDFLARE_SITE_URL once you attach a custom domain such as https://docs.example.com/.

If you prefer Cloudflare to run Hugo directly with no GitHub Actions workflow, connect the repository in Workers & Pages → Create → Pages → Connect to Git and configure these build settings:

Setting Value Why
Root directory (path) docs Runs hugo inside docs/ so it reads docs/hugo.yml and docs/go.mod
Build command hugo --cleanDestinationDir --gc --minify --environment production --printPathWarnings Matches OINK’s production build flags
Build output directory public Relative to Root directory (docs), publishing docs/public
Include watch paths docs/* Skips doc builds on commits that only touch application source code
HUGO_VERSION 0.170.1 (or current release) Overrides Cloudflare’s older default Hugo (OINK is tested on 0.170+)
GOWORK / HUGO_MODULE_WORKSPACE off Prevents workspaces from overriding docs/go.mod

For branch preview builds, override the preview build command with --environment staging --baseURL "$CF_PAGES_URL" so Cloudflare preview URLs emit noindex and never compete with your production domain in search engines.

Verify before you merge

  1. Run hugo -s docs --cleanDestinationDir --gc --minify --environment production --printPathWarnings and confirm the log ends with Total in … and no unexpected warnings.
  2. Run git status --short: docs/public/, docs/resources/ and docs/.hugo_build.lock must not appear.
  3. Commit docs/hugo.yml, docs/go.mod, docs/go.sum, docs/content/, .gitignore and your workflow file.
  4. After the workflow turns green, open the live URL and check search, dark mode, canonical links, and Edit this page (it must open the file under docs/content/).
  • Deploy — custom domains, baseURL, CSP headers, preview indexing, and rollback
  • Browse locally — run hugo serve -s docs while writing code and docs side by side
  • From scratch — standalone OINK setup and offline / submodule install methods
  • Configuration — full hugo.yml reference, including github_subdir

3 - 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

3.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.

3.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.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

3.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.

3.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

3.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.

3.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.

3.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.

4 - Components

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

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

Cheatsheet

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

Writing & structure

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

Diagrams, charts & math

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

Media & showcase

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

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

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

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

Two forms

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

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

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

Site prerequisites

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

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

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

4.1 - Callouts

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

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

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

Shortest form

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

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

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

Ten types

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

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

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

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

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

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

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

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

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

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

hugo server -D previews drafts.

Important

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

Warning

hugo --cleanDestinationDir empties public/.

Caution

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

Success

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

Danger

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

Question

Should the site have comments? See enabling comments.

Example

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

Quote

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

Custom title

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

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

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

Body content

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

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

Collapsing

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

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

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

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

Open by default, but the reader can close it

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

The neutral disclosure, DETAILS

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

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

Custom icon

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

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

Pigsty v4 installs PostgreSQL 18 by default.

Nesting

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

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

A theme version bump can change how a page renders.

How to back up

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

Unknown types and common slips

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

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

[!NOTICE] Not a valid type

The marker stays on the page to tell you so.

Formatters such as Prettier cause the other two common slips:

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

Output

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

Parameter reference

The marker line > [!TYPE]± Title:

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

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

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

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

Limits

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

4.2 - Code Blocks

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

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

Shortest form

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

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

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

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

Filename titles

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

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

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

Line numbers, start line and highlighting

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

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

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

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

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

Wrapping long lines

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

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

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

Folding long code

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

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

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

What gets copied

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

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

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

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

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

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

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

One-line commands

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

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

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

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

Jump to line 4.

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

Numbered examples

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

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

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

See Example 4-1.

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

A set of fences as tabs

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

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

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

Common errors

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

Output

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

Parameter reference

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

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

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

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

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

Limits

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

4.3 - Tabs

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

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

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

Shortest form

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

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

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

Groups: links, sync and memory

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

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

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

Groups move together

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

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

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

Tables can be tabs too

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

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

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

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

A label and a filename together

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

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

A lone block is just a titled block

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

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

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

Tabs around running text

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

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

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

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

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

Note

baseURL has to be the repository’s Pages address.

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

hugo --gc --minify

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

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

Output

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

Parameter reference

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

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

The tabs shortcode:

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

The tab shortcode:

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

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

Limits

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

4.4 - Tables

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

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

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

Shortest form

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

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

Wide tables scroll themselves

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

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

Captions

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

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

Compatibility matrices

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

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

Using the whole canvas

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

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

Technical wide tables

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

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

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

Expand selected tables

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

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

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

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

Field lists

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

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

Numbered tables

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

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

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

See Table 9-1.

Tables as tabs

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

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

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

Output

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

Parameter reference

The attribute line on the row below the table:

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

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

Limits

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

4.5 - Fields

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

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

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

Shortest form

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

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

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

Semantic columns with meta=

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

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

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

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

Labels and container IDs

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

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

params.ui

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

Every entry is linkable

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

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

The shortcode form

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

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

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

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

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

Common pig flags

--config , path , required

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

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

--log-level , string , defaultinfo

Log level, from low to high:

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

Print what would happen and change nothing:

pig ext install pg_duckdb --dry-run

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

Which form to use

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

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

Output

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

Parameter reference

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

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

The fields shortcode:

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

The field shortcode:

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

Limits

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

4.6 - Steps

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

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

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

Shortest form

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

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

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

What goes in a step

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

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

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

1. Start the local server.

   ```bash
   hugo server
   ```

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

1. Replace three things and it is your site.

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

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

    hugo server
    Note

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

  3. Replace three things and it is your site.

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

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

Splitting one step per platform

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

Source
1. Install Hugo.

1. Install the dependencies:

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

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

  2. Install the dependencies:

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

Continuing the numbering

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

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

Steps with headings

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

Source
{{% steps %}}

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

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

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

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

### Publish {#publish}

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

{{% /steps %}}

Install the toolchain

Install Hugo and Go; Get started lists the versions.

Run the server

brew install hugo go

sudo apt install hugo golang-go

Publish

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

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

Which form to use

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

Optional presentation

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

Output

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

Parameter reference

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

Limits

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

4.7 - Badge

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

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

Shortest form

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

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

Five tones

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

Default Info Supported Experimental Deprecated

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

Inside a sentence

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

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

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

Next to a heading

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

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

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

OpenAPI pages

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

In table cells

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

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

In lists and steps

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

On cards

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

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

One hugo mod get and you are done needs Go

Offline archive

Builds on a machine with no network manual upgrades

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

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

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

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

Output

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

Parameter reference

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

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

Limits

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

4.8 - Kbd

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

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

Shortest form

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

Press Ctrl with K to open the command palette.

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

A single key

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

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

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

Chords

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

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

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

Platform differences

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

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

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

Shortcut tables

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

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

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

In steps

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

Raw <kbd> tags

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

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

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

Output

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

The instruction remains readable without CSS or JavaScript.

Parameter reference

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

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

Limits

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

4.9 - Includes

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

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

Shortest form

include has one required parameter, file:

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

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

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

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

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

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

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

Installing OINK into an existing Hugo site takes three commands:

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

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

The current release is v1.8.

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

Where the file comes from

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

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

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

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

Including code files

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

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

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

What a fragment can contain

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

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

Printing a site parameter

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

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

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

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

Parameters inside commands, tables and links

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

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

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

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

Release notes

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

Notes deleted at build time

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

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

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

Verify the dashboards on a test database before upgrading.

Since PostgreSQL 18, pg_stat_io breaks out WAL statistics.

Verify the dashboards on a test database before upgrading.

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

Output

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

Parameter reference

include (named parameters only):

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

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

param (one positional parameter):

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

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

Limits

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

4.10 - Mermaid

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

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

Shortest form

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

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

Sequence diagrams

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

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

Gantt charts

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

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

Class and ER diagrams

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

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

State diagrams

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

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

Per-diagram title and configuration

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

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

Light and dark

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

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

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

The Mermaid configuration reference lists the accepted keys and values.

Inside tabs and steps

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

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

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

Enlarging a diagram

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

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

Loading and output

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

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

Parameter reference

Site parameters (hugo.yml):

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

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

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

Limits

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

4.11 - PlantUML

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

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

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

Shortest form

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

hugo.yml
params:
  plantuml: true

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

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

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

Class diagram

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

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

Component diagram

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

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

Activity diagram

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

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

Use-case diagram

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

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

Dark mode

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

Enlarge, source and download

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

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

Optional rendering service

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

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

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

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

Loading and output

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

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

Parameter reference

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

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

Limits

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

4.12 - Draw.io

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

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

Shortest form

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

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

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

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

How the copy is detected

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

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

With a caption

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

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

As a numbered figure

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

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

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

SVG or PNG

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

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

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

What the button does

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

The editor opens over the page

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

The diagram goes straight to the editor

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

Saving downloads a new file

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

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

The editor address

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

Configuration defines both keys.

Output

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

Parameter reference

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

Site parameters (hugo.yml):

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

Limits

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

4.13 - ECharts

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

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

Shortest form

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

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

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

Multiple line series

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

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

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

Pie and doughnut charts

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

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

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

Height and full width

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

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

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

Light and dark

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

A fixed theme keeps the same colors in both modes:

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

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

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

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

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

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

Callbacks with $fn:

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

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

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

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

Where the data lives

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

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

Output

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

Parameter reference

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

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

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

Limits

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

4.14 - Infographic

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

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

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

Shortest form

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

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

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

Timelines

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

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

Funnels

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

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

Grid cards

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

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

Items with values

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

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

Hierarchy and hand-drawn style

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

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

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

Picking a template

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

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

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

Output

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

Parameter reference

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

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

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

The top-level DSL keys, defined by AntV:

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

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

Limits

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

4.15 - Markmap

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

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

Shortest form

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

hugo.yml
params:
  markmap: true

Then write the outline in a markmap fence:

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

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

Depth

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

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

Links, code and emphasis

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

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

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

Mathematics in nodes

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

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

Controlling the initial depth

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

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

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

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

Folded into a disclosure

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

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

Output

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

Parameter reference

Site parameter (hugo.yml):

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

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

Limits

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

Older option names

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

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

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

4.16 - FileTree

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

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

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

Shortest form

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

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

Adding comments

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

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

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

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

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

truncation in both columns

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

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

Wrap long comments

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

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

Complete storage comments

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

Title bars

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

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

pgBackRest repository on the backup host

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

Indentation and depth

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

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

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

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

Folding and explicit types

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

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

the content directory

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

Icons and tones

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

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

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

deployment layout: permissions and what matters

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

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

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

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

this site's component pages

One tree per platform

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

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

Output

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

Parameter reference

Fence attributes, after ```filetree:

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

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

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

The line syntax:

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

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

Limits

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

4.17 - Math

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

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

Site prerequisites

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

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

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

Shortest form

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

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

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

Display formulas

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

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

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

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

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

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

The math fence

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

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

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

Chemistry and units

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

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

The mhchem manual documents the syntax.

Numbered equations

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

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

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

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

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

Cross references

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

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

Capacity planning starts from Equation 3-1.

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

The eq shortcode

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

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

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

Output

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

Parameter reference

The four ways to write a formula:

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

The attribute line {…} under a display formula:

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

The eq shortcode:

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

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

Limits

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

4.18 - Maps

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

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

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

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

Shortest form

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

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

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

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

Site configuration

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

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

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

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

Place fields

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

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

Routes, thumbnails and captions

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

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

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

One place and zoom

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

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

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

The interactive map

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

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

Coordinates

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

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

Output

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

Parameter reference

Place fields:

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

Fence attributes:

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

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

Site parameters (hugo.yml):

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

Limits

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

4.19 - Images

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

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

Shortest form

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

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

Where images come from

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

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

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

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

Inline versus block

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

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

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

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

shell thumbnail

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

Note

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

Captions

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

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

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

Size

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

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

Processed images

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

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

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

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

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

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

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

Go to the highlights page

Release card
Click the image for the releases and downloads guide

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

Numbered figures

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

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

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

See Figure 2-1.

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

Zoom

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

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

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

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

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

Light and dark images

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

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

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

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

Output

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

Parameter reference

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

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

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

Limits

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

4.20 - Gallery

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

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

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

Shortest form

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

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

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

Descriptions

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

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

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

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

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

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

Where images come from

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

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

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

Decorative images and zoom

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

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

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

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

Classes and tabs

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

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

Output

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

Parameter reference

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

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

Fence attributes:

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

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

Limits

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

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

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

4.21 - Video

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

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

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

Shortest form

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

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

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

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

Where videos come from

Video files resolve in the same order as images:

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

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

Inline versus block

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

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

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

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

Poster, subtitles and caption

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

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

Size

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

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

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

Looping demos instead of GIFs

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

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

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

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

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

Video platforms

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

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

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

The accepted URLs:

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

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

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

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

Playing in place

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

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

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

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

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

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

Large files

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

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

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

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

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

Output

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

Parameter reference

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

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

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

The site setting:

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

Limits

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

4.22 - Audio

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

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

Shortest form

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

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

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

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

Where audio comes from

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

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

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

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

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

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

Inline versus block

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

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

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

Inline audio takes no attribute line.

Captions and sample sets

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

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

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

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

Transcripts

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

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

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

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

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

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

Voice sample 2 · Chinese
Transcript: Voice sample 2

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

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

Output

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

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

Parameter reference

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

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

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

Limits

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

4.23 - Asciinema

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

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

Shortest form

file is the only required parameter:

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

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

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

Window title and theme

title names the window and theme sets the terminal colors:

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

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

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

Speed, start point and poster

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

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

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

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

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

Chapter markers

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

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

Pigsty install in chapters — /images/install.cast

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

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

Size and fit

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

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

Only 16 rows tall — /images/install.cast

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

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

Looping and preloading

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

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

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

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

Inside steps

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

Source
1. Install the dependencies and fetch the installer:

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

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

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

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

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

    pig install — /images/install.cast

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

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

Recording a cast file

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

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

Output

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

Parameter reference

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

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

Limits

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

4.24 - Social

Quote a post from X, Bluesky, Mastodon, or another platform with a > [!SOCIAL] callout. The page supplies the quote and attribution without a platform script, and plain Markdown viewers show an ordinary blockquote.

When an article cites something posted on X, Mastodon or another network, a > [!SOCIAL] callout quotes it as a card: avatar, name, handle, platform icon, the post text and a dated link to the original. You write all of it into the page, so the quoted text stays readable after the original is edited or deleted. A local avatar and local attachments keep the card entirely on your site, and the card takes its colors from the site’s preset and color scheme.

The source is an ordinary blockquote. GitHub, an editor preview or Obsidian shows the name, the post text, its images and any quoted post without the theme. To quote a book or a paper, a plain blockquote is enough.

Shortest form

The callout title names the author. Write the handle as a code span after the name, then the post text in Markdown.

Source
> [!SOCIAL] Ron `@RonVonng`
>
> PostgreSQL is not just a relational database; it is a data-management framework capable of absorbing almost every workload. Replacing Kafka, Elasticsearch, MongoDB, and Redis with Postgres is a practical way to cut system complexity.
Ron @RonVonng

PostgreSQL is not just a relational database; it is a data-management framework capable of absorbing almost every workload. Replacing Kafka, Elasticsearch, MongoDB, and Redis with Postgres is a practical way to cut system complexity.

  • The title renders as written, inline Markdown included. Its code span is the handle: the card shows it under the name, isolated as left-to-right text. Writing the handle as code also keeps a Markdown viewer from turning @user@instance into an email link.
  • The empty > line after the title is optional for Hugo. It keeps a viewer that does not know [!SOCIAL], such as GitHub, from joining the title and the first line of the post into one paragraph.
  • Without avatar, the card draws the first character of the title’s plain text in a circle, after removing leading @, spaces, and invisible characters such as a zero-width space. Emoji and combining marks stay whole, and a person icon replaces an empty result. The card never requests a default image or a Gravatar.

A complete card

The other facts go in a block attribute line directly under the callout, with no blank line between them:

Source
> [!SOCIAL] Ron `@RonVonng`
>
> Released `pig`, the PostgreSQL extension package manager and Pigsty CLI. One command configures PG repositories on mainstream Linux distros and installs **hundreds of PostgreSQL extensions** through the native package manager.
>
> ![The pig.pgsty.com home page showing the Postgres Install Guide CLI](/case/pig/featured.webp)
{avatar="images/ron-vonng.webp" date="2024-12-23" url="https://x.com/RonVonng/status/1871040275575124082" platform="x"}
Ron @RonVonng · X

Released pig, the PostgreSQL extension package manager and Pigsty CLI. One command configures PG repositories on mainstream Linux distros and installs hundreds of PostgreSQL extensions through the native package manager.

The pig.pgsty.com home page showing the Postgres Install Guide CLI

· View original — Ron @RonVonng

  • avatar resolves like any image. A value with a URL scheme is a remote image that the reader’s browser loads directly. Any other value is looked up as a page resource (or a resource of the section’s branch bundle), then a global resource in assets/, and otherwise used as a path to the site’s static files. Prefer page or assets/ resources, which the build always finds. The name sits beside the avatar, so it is decorative (alt=""). The card shows it small and crops it to fill its frame, so use a square image.
  • date is plain text, shown as written. A year-month (2026-11), a date (2026-11-23), or a date and time with hours and minutes, optional seconds, and an optional Z or ±HH:MM offset (2026-11-23 08:30, 2026-11-23T08:30:00+08:00) on a real calendar day becomes a machine-readable <time datetime>; a space before the time is written as T in the attribute. Anything else, including fractional seconds or a +0800 offset, renders as plain text without <time>.
  • url turns the date line into a “View original” link. Give the post’s HTTP(S) address (which receives rel="external") or a site-internal path; an invalid URL warns and is dropped. It is optional, so you can still quote a post that no longer exists.
  • The attached image is an ordinary Markdown image. This page turns on image zoom, so it opens at full size.
  • Block attributes need markup.goldmark.parser.attribute.block: true, the setting OINK already requires for callout icons and native Book figures.

Platforms

platform selects the brand icon and the platform name that screen readers and RSS carry, and nothing else: every platform shares one layout, the preset owns the colors, and the card never imitates a platform’s own interface. Without platform the card shows no icon, so name the platform the post came from.

platform Icon
x fa-brands fa-x-twitter
bluesky fa-brands fa-bluesky
mastodon fa-brands fa-mastodon
threads fa-brands fa-threads
weibo fa-brands fa-weibo
zhihu fa-brands fa-zhihu
telegram fa-brands fa-telegram
linkedin fa-brands fa-linkedin
none (default) None (omits icon and platform name)
Source
> [!SOCIAL] Ron `@ron@fosstodon.example`
>
> OpenAI runs a single unsharded PostgreSQL cluster (one primary with 40+ read replicas) for its core workload. Vertical scale plus disciplined indexing still goes a very long way.
{platform="mastodon" date="2025-05-19 11:27" url="https://fosstodon.example/@ron/1002"}

> [!SOCIAL] `@pigsty.io`
>
> PostgreSQL is the Linux of databases: one kernel, hundreds of extensions, zero vendor lock-in.
{platform="bluesky"}
Ron @ron@fosstodon.example · Mastodon

OpenAI runs a single unsharded PostgreSQL cluster (one primary with 40+ read replicas) for its core workload. Vertical scale plus disciplined indexing still goes a very long way.

· View original — Ron @ron@fosstodon.example

@pigsty.io · Bluesky

PostgreSQL is the Linux of databases: one kernel, hundreds of extensions, zero vendor lock-in.

The second card is quoted by handle alone, so it has no name, date or link. Screen readers hear the platform name, which the card carries as visually hidden text beside the decorative icon. An unknown or empty platform warns and shows no icon. The handle appears exactly as written, because the theme adds no @ and knows no per-platform rules: write @name for X and @user@instance for Mastodon.

The body

The body is the callout’s own Markdown, rendered with the page, so paragraphs, links, inline code, lists and footnotes work as usual. Everything else a post can contain is written with syntax OINK already has, which is why the card has no attributes for it.

Post content Write it as
Text, links, code Ordinary Markdown
One attached image A Markdown image; image zoom applies when it is eligible
Several images A gallery fence in the body
A quoted post A nested > [!SOCIAL]; see Quoted posts
A video A video written as an image, ![name](clip.mp4)
Source
> [!SOCIAL] Ron `@RonVonng`
>
> One PostgreSQL documentation theme, two color schemes:
>
> ```gallery
> ![The OINK home page in light mode](/images/hero-light.webp)
> ![The OINK home page in dark mode](/images/hero-dark.webp)
> ```
{avatar="images/ron-vonng.webp" date="2026-11-24" platform="x"}
Ron @RonVonng · X

One PostgreSQL documentation theme, two color schemes:

Quoted posts

When the post quotes another, write the quoted post as a nested callout in the body. Its attribute line carries one >, so it belongs to the inner callout; the outer line follows without one. The inner card is compact (a smaller avatar, name and handle on one line) and keeps its own date and link. Leave platform off the inner card to keep the icon from repeating, or give it for a cross-platform quote.

Source
> [!SOCIAL] Ron `@RonVonng`
>
> PostgreSQL 17 is out — billed as the world's most advanced open-source database. Before long, "open-source" may be the redundant part.
>
> > [!SOCIAL] PostgreSQL `@PostgreSQL`
> >
> > News: PostgreSQL 17 Released!
> {date="2024-09-26" url="https://x.com/PostgreSQL/status/1839292604854223176"}
{avatar="images/ron-vonng.webp" date="2024-09-27" url="https://x.com/RonVonng/status/1839521052843442618" platform="x"}
Ron @RonVonng · X

PostgreSQL 17 is out — billed as the world’s most advanced open-source database. Before long, “open-source” may be the redundant part.

PostgreSQL @PostgreSQL

News: PostgreSQL 17 Released!

· View original — PostgreSQL @PostgreSQL

· View original — Ron @RonVonng

Missing or invalid input

Invalid input warns, and as long as there is a body, the quoted words are kept.

Input Result
No title, with body Warns; the body renders as a plain blockquote, without the card. url survives only as the quote’s cite attribute; date, platform and avatar are ignored
No title, empty body, with url Warns; renders a plain blockquote linking to url
Empty body, with url Warns; a link-only card with the author line and “View original”
Empty body, no url Warns; nothing renders
Unknown or empty platform Warns; no icon
[!SOCIAL]- or [!SOCIAL]+ Warns; the fold marker is ignored
Invalid url or avatar Warns; the attribute is dropped
Static avatar not under the project’s static/ Warns when static/ exists (ID social:avatar-static); keeps the path
Static avatar that climbs above the site root with .. Warns (ID social:avatar-static); the avatar is dropped and the card draws the initial instead
Unknown attributes Warn; ignored. class, data-* and aria-* pass to the card

Hugo’s x shortcode

Hugo ships its own x shortcode, {{</* x user="…" id="…" */>}}, and OINK leaves it alone. It asks X’s oEmbed service for the post at build time, so a clean build needs network access and the quote disappears when the post does. Use a [!SOCIAL] callout for quotes that must build offline and stay readable.

Output

The card loads no JavaScript. Print switches the card to the paper palette regardless of screen color mode and prints the original URL after “View original”. The Markdown and LLMS output keep the callout as written, with its attribute line, so an agent reads the same blockquote the author wrote. RSS carries the body (omitting <blockquote> on link-only cards) and an attribution line with absolute URLs, without the avatar.

Reference

Title , inline Markdown , default—
The identity line, required. A code span in it is the handle
avatar , image source , default—
Remote URL / page or branch-bundle resource / global resource / static path; decorative. Without it, the card draws the first character (or a user icon)
date , plain text , default—
Shown as written; a year-month, date, or date-time (HH:MM, optional seconds, optional Z or ±HH:MM) on a real day renders as <time datetime>
url , URL , default—
Original post (HTTP(S) or site-internal path); links the date line
platform , enum , defaultnone
x bluesky mastodon threads weibo zhihu telegram linkedin none; selects the icon and the announced platform name
Body , Markdown , default—
The post; may contain images, a gallery fence, a video, footnotes, or a nested [!SOCIAL]

There are no attributes for engagement counts, verification badges, image lists or quoted posts; images and quoted posts go in the body.

Limits

  • What you may quote, and which avatars and media you keep in the repository, is your decision. When the original no longer resolves, remove url; the quote itself stays.
  • There are no likes, reposts, view counts or verification badges, because such numbers are snapshots that go stale.
  • Platforms differ only by their icon; there are no platform skins or brand colors.
  • Threads, replies and polls are not modeled. Quote several posts as several cards, separated by a blank line.
  • A plain Markdown viewer shows the [!SOCIAL] marker and the attribute line as text, and no avatar, because the avatar is an attribute.
  • The static avatar check reads only the project’s own static/ directory, and only when it exists. A file that a module mount or a custom staticDir publishes also warns; list social:avatar-static under the site’s ignoreLogs to silence that warning. The build skips remote avatar checks. Prefer page-bundle or assets/ images and inspect the rendered card before publishing.
  • Callouts — the blockquote form this card shares
  • Images — attached images, sources, and the zoom switch
  • Gallery — several images in one post
  • Video — a video attached to a post
  • Cards — link cards, not quotations

4.25 - Cards

Turn a Markdown link list into a grid of navigation cards, and use the shortcode when cards need icons, badges or images.

Cards lay out a few parallel destinations so the reader can pick one at a glance: where to start, what to read next, which of three paths fits. Each card is a linked title with a sentence under it, and the grid adapts to the width of the page. A plain Markdown link list with {.cards} under it is all it takes, so the source stays an ordinary list on GitHub. Do not use cards for prose, which reads better as paragraphs, or for image collections, which belong in a gallery. A section’s own landing page usually needs no hand-written cards at all, because the theme can generate them from the child pages (automatic cards).

Shortest form

Put {.cards} on the line after a link list. Each link becomes a card title, and the text after — becomes its description:

Source
- [Get started](/docs/start/) — Start with OINK Starter, preview locally, then replace the site details with your own.
- [Authoring](/docs/write/) — How pages are organized and which front matter keys exist.
- [Customization](/docs/customize/) — Navigation, search, branding, languages.
{.cards}
  • Get started — Start with OINK Starter, preview locally, then replace the site details with your own.
  • Authoring — How pages are organized and which front matter keys exist.
  • Customization — Navigation, search, branding, languages.

The whole card is the click target, not just the title. The number of columns follows the available width, down to one on a phone, so there is no columns parameter.

Title-only cards

The description is optional: one link per item is enough.

Source
- [Callouts](/docs/components/callout/)
- [Tabs](/docs/components/tabs/)
- [Steps](/docs/components/steps/)
- [Fields](/docs/components/fields/)
{.cards}

Loose lists and longer descriptions

When a description needs more than a sentence, write a loose list: the link in one paragraph, the description in the next, and a blank line between items. The title then sits on its own line above the description. {.cards} still goes directly under the last paragraph, with no blank line in between.

Source
- [Front matter](/docs/write/frontmatter/)

  Every page parameter is defined here exactly once: type, default, accepted
  values, and the page that explains it.

- [Configuration](/docs/customize/config/)

  Site parameters grouped by feature, each row linking back to the guide that
  explains it.
{.cards}
  • Front matter

    Every page parameter is defined here exactly once: type, default, accepted values, and the page that explains it.

  • Configuration

    Site parameters grouped by feature, each row linking back to the guide that explains it.

Single-column list

For a directory of resources, where readers scan down rather than across, write {.cards .td-cards-list} instead of {.cards}. The cards become one column inside a single frame, separated by dividers, and each row grows with its description. The shortcode form takes cards variant="list" for the same result; any other variant warns and keeps the grid. Component presentation shows the grid and the list one after the other.

Icons and badges

A link list cannot carry icons, badges, images or a description with several paragraphs; the cards and card shortcodes can. icon is exactly one Font Awesome class pair, and badge is a short plain-text label beside the title.

Source
{{< cards >}}
{{< card title="Get started" link="/docs/start/" icon="fa-solid fa-rocket" badge="start here" >}}
Use OINK Starter and establish a local preview before customizing.
{{< /card >}}
{{< card title="Release and download pages" link="/docs/write/releases/" icon="fa-solid fa-box-open" badge="v0.5" >}}
A release card from `release_url` and `date`, plus a `checksums` block for download assets.
{{< /card >}}
{{< card title="Keyboard navigation" link="/docs/customize/keyboard/" icon="fa-solid fa-keyboard" >}}
Site-wide shortcuts and focus order.
{{< /card >}}
{{< /cards >}}
Get startedstart here

Use OINK Starter and establish a local preview before customizing.

An icon that is not a single class pair such as fa-solid fa-rocket warns, and the card renders without it.

Markdown bodies

The body of a card is ordinary Markdown, so it can hold inline code, emphasis, links and lists. Parameters such as title and badge are plain text.

Source
{{< cards >}}
{{< card title="Hugo Module" icon="fa-brands fa-golang" >}}
`hugo mod get github.com/pgsty/oink`. The recommended way; upgrading is one
version line.
{{< /card >}}
{{< card title="Git submodule" icon="fa-solid fa-code-branch" >}}
No Go installation needed:

- `git submodule add`
- the theme lands in `themes/oink`
{{< /card >}}
{{< /cards >}}
Hugo Module

hugo mod get github.com/pgsty/oink. The recommended way; upgrading is one version line.

Git submodule

No Go installation needed:

  • git submodule add
  • the theme lands in themes/oink

A card without link, like these two, shows its title in bold and links nowhere.

Cards with images

image puts a picture at the top of the card. It is looked up like ![alt](src): page resource, then the current section’s resources, then a global resource in assets/, then a static path such as /images/…, then a remote URL. Local images carry their width and height, so the page does not jump while they load.

Every image needs exactly one of image_alt="…", for an image that carries information, or decorative=true, for one that is only ornament. With both, the build warns and keeps the alt text; with neither, it warns and treats the image as decorative.

Source
{{< cards >}}
{{< card title="The OINK shell" link="/docs/about/features/" image="/images/oink.webp" image_alt="An OINK documentation page: sidebar, article and table of contents" >}}
Sidebar, article, table of contents — each can be turned off on its own.
{{< /card >}}
{{< card title="Release notes" link="/docs/write/releases/" image="/images/releasenote.webp" decorative=true >}}
A decorative cover: `decorative=true` emits an empty alt and screen readers skip it.
{{< /card >}}
{{< /cards >}}
An OINK documentation page: sidebar, article and table of contents

Sidebar, article, table of contents — each can be turned off on its own.

A decorative cover: decorative=true emits an empty alt and screen readers skip it.

Card images do not open in the image zoom dialog, because clicking anywhere on the card already follows its link.

Automatic cards on section pages

A section’s landing page (_index.md) can list its child pages as cards with no list in the source: the theme builds one card per child from its title, description and icon. This site turns that on for every section:

hugo.yml
params:
  ui:
    section_index: cards # list | cards

A section can choose differently in its own front matter, and cascade passes the choice down to its whole subtree:

content/docs/customize/_index.md
section_index: list

Generated and hand-written cards share the same styles; only the source of the data differs. Let the theme list a section’s child pages, because a hand-written list drifts out of step with the sidebar as pages are added or renamed. Write cards by hand for anything else, such as external links or recommendations from other sections. Configuration defines these keys.

Which form to use

What you want Which form
A grid of links with one-sentence descriptions {.cards} link list
Icons, badges, images cards / card shortcode
Lists, code or several paragraphs in the description cards / card shortcode
A card with no link cards / card shortcode
This section’s child pages nothing at all — section_index: cards

Use the link list whenever it can hold your content: it still reads as a list of links on GitHub, while shortcodes do not.

Output

Cards are pure CSS and load no script. In print, link-list cards stack in one column, shortcode cards fall back to two columns, and no card breaks across a page. In the page’s Markdown output, a link list stays as written and each shortcode card becomes a line - [Title](link) (badge) — description.

Parameter reference

The native form:

{.cards} , list attribute line , default—
On the line after an unordered list; unordered lists only. Add .td-cards-list for the single-column list
First link in an item , Markdown link , default—
The card title and the whole card’s click target
Everything else , Markdown , default—
The description: after — in a tight list, its own paragraph in a loose one

card parameters (cards itself takes only an optional variant="list"):

title , plain text , default—
Required, non-empty. The card title
link , URL , default—
Site path, relative path, http(s):, mailto:; external links get rel="noopener"
icon , Font Awesome class pair , default—
For example fa-solid fa-rocket; a malformed value warns and is dropped
badge , plain text , default—
A small label beside the title
image , image source , default—
Page resource / global resource / static path / remote URL
image_alt , plain text , default—
With image, exactly one of this and decorative
decorative , boolean , defaultfalse
true marks a decorative image and emits an empty alt
Body , Markdown , default—
The card description

There is no cols, columns, accent, desc or color parameter. Unknown parameters warn and are ignored.

Limits

  • {.cards} works on unordered lists only; on a numbered list it does nothing.
  • {.cards} must sit directly under the list. A blank line before it, or indentation that puts it inside the last item, loses the marker without a warning: the build succeeds and the list stays a list. When no grid appears, check that line first.
  • A card outside cards, alone or inside another shortcode, warns and is skipped.
  • Only automatic section cards take a column count, through params.ui.section_index_columns; hand-written grids always follow the width.
  • A description longer than two lines belongs in a paragraph or a callout.

4.26 - Timeline

Turn a Markdown definition list into a vertical timeline of dated or ordered events, for milestones, incident write-ups, product history or an agenda.

A timeline lays events along a vertical axis, each beside its marker: a date, a time, a version, “Day 2”, whatever puts the events in order. Use it for project milestones, the sequence of an incident, a product’s history or an agenda; Where a timeline fits compares it with steps, update entries and Gantt charts.

You write an ordinary Markdown definition list, one term per marker and one definition per event, and put {.timeline} on the line below it. The theme adds only CSS, so the source stays plain Markdown and the page loads no script.

Shortest form

Write each marker on its own line and its event on the next line after : , with a blank line between entries. Put {.timeline} directly under the last event.

Source
2024-03-12
: **v1.0.** First stable release: single-node installs on EL 9 and Ubuntu 24.04.

2024-11-05
: **v2.0.** Streaming replicas and automatic failover.

2025-09-30
: **v3.0.** PostgreSQL 18 becomes the default version.
{.timeline}
2024-03-12
v1.0. First stable release: single-node installs on EL 9 and Ubuntu 24.04.
2024-11-05
v2.0. Streaming replicas and automatic failover.
2025-09-30
v3.0. PostgreSQL 18 becomes the default version.

Both kinds of line break matter. {.timeline} must touch the last event: after a blank line Goldmark drops the attribute line and renders a plain definition list, while the theme logs a build warning naming the page. The blank lines between entries are required too, because without one the next marker becomes a line of the previous event’s text and its event attaches to the previous marker.

Markers

A marker is one line of free text. The theme does not parse it, so 2026-11, 09:02, v1.6.0, Day 2 and Q3 2026 – Q1 2027 all work, and events stay in the order you write them. Markers are set small and semibold with tabular figures, so times and dates line up; plain text suits them best.

Source
09:02 UTC
: **Alert.** The deploy workflow fails on the production branch.

09:14 UTC
: **Cause found.** A new page links to a heading that was renamed, and the link check stops the build.

09:40 – 10:15 UTC
: **Fix.** The link is corrected and the site rebuilds.

10:30 UTC
: **Resolved.** Production serves the new page.
{.timeline}
09:02 UTC
Alert. The deploy workflow fails on the production branch.
09:14 UTC
Cause found. A new page links to a heading that was renamed, and the link check stops the build.
09:40 – 10:15 UTC
Fix. The link is corrected and the site rebuilds.
10:30 UTC
Resolved. Production serves the new page.

On wide screens the marker column grows with the longest marker up to 10rem, and a longer marker wraps inside it. A marker cannot continue onto a second source line: every line directly above a : line is a marker of its own, so two marker lines in a row leave the first without an event (the axis still bridges across them).

Event content

An event is a definition, so it can hold continuation paragraphs, lists and fenced code, indented two spaces to the column after : . A bold phrase at the start is the usual event title; it is a writing convention, and the theme styles it as ordinary bold text.

Source
2025-09-30
: **v3.0.** PostgreSQL 18 becomes the default, and PostgreSQL 13 leaves the supported list.

  A cluster still on PostgreSQL 13 upgrades in two moves:

  - take a fresh base backup;
  - run `pg_upgrade` on the primary, then rebuild the replicas from it.

  ```bash
  pg_upgrade -b /usr/pgsql-13/bin -B /usr/pgsql-18/bin -d /var/lib/pgsql/13/data -D /var/lib/pgsql/18/data --link
  ```

Next release
: **Logical replication.** One command sets up publications and subscriptions between clusters.
{.timeline}
2025-09-30
v3.0. PostgreSQL 18 becomes the default, and PostgreSQL 13 leaves the supported list.

A cluster still on PostgreSQL 13 upgrades in two moves:

  • take a fresh base backup;
  • run pg_upgrade on the primary, then rebuild the replicas from it.
pg_upgrade -b /usr/pgsql-13/bin -B /usr/pgsql-18/bin -d /var/lib/pgsql/13/data -D /var/lib/pgsql/18/data --link
Next release
Logical replication. One command sets up publications and subscriptions between clusters.

The axis runs along the start edge of each event, so it stays unbroken however tall an event grows.

Several events under one marker

Write more than one : line under a marker for events that share it. They follow one another on the axis under a single node.

Source
2025-10-14
: **v3.0.1.** Fixes a failover timeout on clusters with more than three replicas.
: **v3.0.2.** The same day, a patch restores air-gapped installs, which 3.0.1 broke.

2025-12-02
: **v3.1.** Point-in-time recovery from the command line.
{.timeline}
2025-10-14
v3.0.1. Fixes a failover timeout on clusters with more than three replicas.
v3.0.2. The same day, a patch restores air-gapped installs, which 3.0.1 broke.
2025-12-02
v3.1. Point-in-time recovery from the command line.

Where a timeline fits

Content Use
Dated or ordered events inside prose a definition list + {.timeline}
A procedure the reader carries out Steps
Changelog entries, each with a heading in the TOC Update
A schedule with durations and dependencies a Mermaid Gantt chart

How it renders

Condition Layout
Viewport 576px and wider Two columns: markers end-aligned against the axis, events beside them; the marker column fits its content up to 10rem
Narrower viewport or inside cards One column: each marker above its event, with the axis and nodes on the start edge
Ink and Terminal presets Square nodes (0px in Ink, 2px radius in Terminal) instead of round ones
Forced colors The axis and nodes use the system text color
Right-to-left pages The axis moves to the right, and the whole layout mirrors while keeping timestamps in natural order

The styles apply only to dl.timeline inside article content, so definition lists without the marker, and any element your site already calls .timeline outside the article, are left alone.

Prerequisites

Definition lists are a Goldmark extension that Hugo enables by default. The attribute line needs Goldmark block attributes, one of the site prerequisites every component shares.

hugo.yml
markup:
  goldmark:
    extensions:
      definitionList: true # Hugo's default
    parser:
      attribute:
        block: true # enable {…} attribute lines

With definition lists turned off, each marker and its event render as one paragraph with a literal colon.

Output

Timelines load no JavaScript. Screen readers announce each marker and event as a term and its definition, in source order; the axis and nodes are decoration. Print switches the timeline to paper ink regardless of the screen color scheme, keeps each marker with its event and avoids breaking inside short events; Markdown and LLMS output keep the list and its {.timeline} line as written, and feed readers show a plain definition list.

Parameter reference

The definition-list syntax:

Marker line , Requiredyes
One line of free text; plain text recommended. Each line directly above a : line is its own marker
: event , Requiredyes
At least one per marker. Continuation blocks are indented two spaces
Further : lines , Requiredno
More events under the same marker, sharing its node
Blank line , Requiredyes
Between entries; without it the next marker joins the previous event’s text
{.timeline} , Requiredyes
The line directly below the last event, with no blank line before it

A timeline has no attributes of its own: no icon, color, badge, link or compact variant. An id or further classes on the same line, as in {#history .timeline}, pass through Goldmark onto the <dl>.

Limits

  • When placing a timeline directly inside a callout (> [!NOTE] ...), leave one blank > line after the callout header; without it Goldmark absorbs [!NOTE] into the first marker and the theme logs a build warning.
  • Events take no icon, color, badge or link parameters. Put a link or a badge in the event text instead.
  • Because Hugo has no <dl> render hook, attributes on the {.timeline} line follow Goldmark’s default filtering (which strips on* handlers but passes style), unlike render-hook components.
  • GitHub and some editors do not render definition lists, but the source still reads naturally: a marker line followed by : event lines.
  • Markers are not parsed, sorted, grouped or localized; events appear in source order.
  • Events are not headings and do not appear in the TOC. Use update headings when they should.
  • Steps — numbered procedures the reader follows
  • Update — changelog entries that stay headings
  • Mermaid — Gantt charts and timeline diagrams for schedules

4.27 - Update

Write a changelog, a “What’s new” page or weekly notes as ordinary headings marked {.update}, with an optional date and tags under each entry.

An update is a changelog entry written as an ordinary Markdown heading with {.update} at the end. Each entry gets extra space and a separator rule above it, which gives a long stream of entries its rhythm, and optional date and tags attributes add a metadata line under the heading. Use updates for a one-page changelog, a “What’s new” page, weekly notes or a log of policy changes.

Because the entry is still a heading, it keeps everything a heading has: its table-of-contents entry, anchor, search section and print ID. No script loads. When each version needs a page of its own, use release pages instead.

Shortest form

Put {.update} at the end of the heading, with date and tags inside the same braces. Write an explicit #id first for version entries: Goldmark strips dots when building an anchor from heading text (v1.6.0 — … becomes #v160--…, and v1.10 collides with v11.0), while {#v1-6-0 .update …} keeps a clean, stable link even if the title changes.

Source
### v1.6.0 — PostgreSQL 18 by default {#v1-6-0 .update date="2026-11-23" tags="Breaking, Performance"}

New clusters get PostgreSQL 18, with asynchronous I/O turned on.

v1.6.0 — PostgreSQL 18 by default

, Breaking, Performance

New clusters get PostgreSQL 18, with asynchronous I/O turned on.

A changelog page usually writes each entry as ##. The examples here use ### so that they nest under this page’s own sections in the table of contents.

Date

date takes a year, a month or a day (YYYY, YYYY-MM or YYYY-MM-DD). It renders as <time datetime="…"> and shows exactly as written, so 2026-11 stays 2026-11.

## 2026 in review {.update date="2026"}
## November notes {.update date="2026-11"}
## v1.6.0 {.update date="2026-11-23"}

Any other value — including an impossible calendar date such as 2026-02-30 or 2025-02-29, a timestamp with a time or time zone, or an unquoted number such as date=2026 — warns, naming the heading and the page. The date is dropped while the heading, any valid tags and the rest of the entry stay. Leap days such as 2024-02-29 pass.

An unquoted full date such as {.update date=2026-11-01} goes further wrong: Goldmark cannot parse it, drops the whole attribute block and leaves it in the heading text. The build warns whenever a heading ends in an unparsed {…} block containing .update, with or without a leading #id, as in {.update date=2026-11-01} or {#v1-6-0 .update date=2026-11-01}. Quote every value.

Tags

tags is a comma-separated string of plain text (both , and full-width , separate items). Each item is trimmed and empty items are skipped, so tags=" Fix ,, Docs " gives two chips, Fix and Docs. A non-string value such as tags=true warns and is dropped. Every chip looks the same whatever it says, in a color set by the preset, and Markdown inside a tag shows literally.

These are not Hugo taxonomy tags: they create no term pages and link nowhere. The theme does not translate them, so write them in the page’s language.

Entries without metadata

Both attributes are optional. ## Unreleased {.update} is a valid entry with the entry spacing and separator rule but no metadata line, and the line is also left out when there is no date and tags holds only commas and spaces.

The text under an entry is ordinary Markdown, and lower headings inside an entry are ordinary headings that nest under it in the TOC without a marker.

Still a heading

The marker changes nothing a heading already does:

  • The TOC shows the heading text only, without the date or tags.
  • The anchor and the self-link that appears on hover work as usual.
  • Keyboard navigation stops at each entry with J and K.
  • Local search indexes the entry as a section titled with the heading text; when offline_search_index is content (the theme default), the date and tags are indexed as separated tokens inside that section’s text.
  • Multi-page Print namespaces the heading ID as it does for any heading.

The metadata line follows the heading rather than sitting inside it, so the heading text, its accessible name and its search title stay exactly as written. Without an explicit #id the anchor comes from the heading text (dots removed and titles turned into long slugs), and renaming the entry changes its link, so give an #id to every version entry and any entry that other pages link to.

A changelog on one page

A stream of entries, newest first. The three entries and the subsection below appear in the table of contents under this section.

Source
### Unreleased {#demo-unreleased .update}

One command sets up logical replication between two clusters.

### v1.6.0 {#demo-v1-6-0 .update date="2026-11-23" tags="Breaking"}

PostgreSQL 18 is the default version for new clusters.

#### Upgrade notes {#demo-v1-6-0-upgrade}

- Set `pg_version: 17` in the inventory to keep creating PostgreSQL 17 clusters.
- Rename `pg_backup_dir` to `backup_dir`.

### v1.5.1 {#demo-v1-5-1 .update date="2026-11" tags="Changed, Fixed"}

Failover no longer times out on clusters with more than three replicas.

Unreleased

One command sets up logical replication between two clusters.

v1.6.0

, Breaking

PostgreSQL 18 is the default version for new clusters.

Upgrade notes

  • Set pg_version: 17 in the inventory to keep creating PostgreSQL 17 clusters.
  • Rename pg_backup_dir to backup_dir.

v1.5.1

, Changed, Fixed

Failover no longer times out on clusters with more than three replicas.

Update or release pages

Need Use
One readable stream of entries on one page .update headings
One page per version, with its own URL, feed item, release assets or GitHub release release pages collected by layout: releases
A short dated sequence inside other prose Timeline

Choose one model as the source of truth for a product’s release notes — either a single .update changelog page or per-version release pages collected by layout: releases — rather than maintaining the same version in both places. If a separate “What’s new” page highlights a milestone that already has a release page, link to that release page instead of repeating its notes.

Output

Updates load no JavaScript. In HTML the heading gets class="update" and is followed by <div class="td-update-meta">, which holds the <time datetime> and one <span class="td-update-tag"> per tag. A comma that takes no space on screen sits between the items, so copied text, local search and feed readers get 2026-11-23, Breaking, Performance instead of 2026-11-23BreakingPerformance. Print uses the light paper colors in either color mode and keeps each heading on the same page as its metadata line. Markdown and LLMS output keep the heading line with its attribute block (raw Markdown viewers such as GitHub show {…} literally), and the page stays one page with one URL, so entries never become separate feed items.

Parameter reference

The attribute block at the end of the heading:

.update , marker , default—
Makes the heading an entry; any level, usually ##
date , string (YYYY, YYYY-MM or valid calendar YYYY-MM-DD) , default—
Rendered as <time datetime> and shown as written; non-strings and invalid dates warn and are dropped
tags , string (, or , separated plain text) , default—
One neutral chip per non-empty item, trimmed; non-strings warn and are dropped
id , anchor , defaultfrom the heading text
Recommended for version entries, written first: {#v1-6-0 .update …}

date and tags work only together with .update; on any other heading they warn as unknown attributes and are dropped.

Limits

  • There is no sticky label rail or two-column layout; the table of contents already tracks the entries.
  • Entries get no URLs or feed items of their own. Use release pages when each version needs one.
  • The TOC shows the heading text only, so put the date in the heading text when readers should see it there.
  • Tags are not translated, colored or linked.
  • Entries appear in source order, with no sorting, filtering or generation from data.

4.28 - Component presentation

Cards, disclosures, tabs, and compact procedures across OINK’s six visual presets.

This page shows the everyday components side by side with their compact variants, so you can judge how each looks before choosing it: switch between Paper, Slate, GitHub, Ink, News and Terminal, light or dark, from the Appearance menu and compare. Each variant is one extra class or a variant parameter on the Markdown you already write. None loads a script or changes links, keyboard use, copied text, print or Markdown output, and an unknown variant warns and falls back to the regular look.

Cards and card lists

The regular card grid:

For a compact directory of resources, {.cards .td-cards-list} turns the same link list into a single framed list with dividers, each row as tall as its description needs.

When the rows need icons, badges or longer descriptions, use the shortcode form with cards variant="list":

InstallationStart here

Build a local preview before changing the site configuration.

Notes and disclosures

Callouts have no variants; compare their colors and the disclosure row in each preset.

Keep a local preview

Review the page at a narrow width as well as on your desktop.

Check the destination

Confirm the destination before publishing a new version.

How does this work without JavaScript?

The disclosure is a native HTML details element. It remains usable with scripts disabled.

The title, chevron, and focus outline share one stable summary row.

Longer titles can wrap without displacing the chevron or reducing the interactive area

Each disclosure opens independently. Other content stays in its current state.

Tabs and commands

macOS / Homebrew
brew install hugo
Debian / Ubuntu
sudo apt install hugo

Add {class="td-code-command"} to a one-line fence to make it a command strip. The copy button gets its own column, so a long command scrolls or wraps without running under it.

hugo server --bind 127.0.0.1 --port 1313
hugo --environment production --baseURL https://example.com/documentation/ --destination public

wrap, copy and accessible labels work as on any code block. A command strip holds exactly one line, so a multiline, numbered or collapsed block with this class warns and renders as a regular code block.

Short procedures

For a short procedure, add .td-steps-compact to the marker: {.steps .td-steps-compact}. Keep the regular .steps for long tutorials, where the extra spacing helps.

  1. Review the configuration.
  2. Run the local preview.
  3. Check the generated output.

A procedure with headings uses the shortcode with variant="compact", written with percent delimiters:

Preview

Run the development server and open the changed page.

Review

Check the page in the language and appearance your readers use.

Tables and metadata

Tables, field lists, badges and key sequences have no variants either; they are here so you can check them against the rest of the preset.

View Purpose Input
Cards Related resources Link list
Steps Ordered procedure Ordered list
Tabs Equivalent alternatives Adjacent blocks
title , Typestring
A concise title that may wrap naturally.
description , Typestring
Supporting information, separate from the main label.

Preview Validated Review needed

Open search with Ctrl with K and move between results with the arrow keys.

5 - Customization

Configure the site brand, navigation, layout, search, languages, versions, print output, and agent output.

Customization covers whatever applies to the whole site rather than to one page: how it looks, how readers find their way around, what it publishes besides HTML, and which languages and versions it serves. Most of it is a key in hugo.yml; the rest lives in data files under data/ and in your own stylesheets under assets/. To write a page and set its front matter, see Authoring.

Find it by what you want to change

I want to change… Read
The site name, logo or favicon Brand and appearance
Colors, light and dark mode, fonts Brand and appearance
The navbar menu and its dropdowns Navigation and menus
Sidebar width, icon density or outline depth Layouts and page types
The home page and landing pages Home and landing pages
Full-text search and what it indexes Search
What the command palette offers Command palette
Keyboard shortcuts Keyboard navigation
The languages the site publishes Languages
Several versions of the docs, or the archive banner Versions
Tags and categories Taxonomies
“Edit this page”, last-modified dates and contributors Repository links and page info
Printing a page or a whole chapter Print
What AI agents read: llms.txt and per-page .md files AI-agent support
Any parameter’s type and default Configuration
Comments, analytics or the deployment target, which need an outside service Operations

5.1 - Configuration

Find every site parameter that the theme reads, with its type, default, description, and related guide.

Every site-wide setting OINK reads lives in hugo.yml and appears in a table on this page with its type, its default and a link to the guide that shows it in use. The defaults are conservative: local search, image zoom, comments, page feedback and the light/dark menu stay off until you turn them on, so your configuration only needs the keys you want to change. There is no master switch and no params.oink.* namespace, so a key that is not on this page does nothing. Settings for a single page are in Page parameters.

An empty Default cell means the theme has no default and the feature stays off until you set the key. Each group has its own anchor, such as /docs/customize/config/#sidebar.

The layers of hugo.yml

Configuration keys come in four layers, and the layer tells you where a key’s behavior is documented:

Layer Examples Who defines it
Hugo’s own top-level keys baseURL title languages markup outputs taxonomies module Hugo itself. See gohugo.io for behavior
Top-level params logo offline_search github_repo version page_width comments Site-level options the theme reads
params.ui.* navbar_enabled sidebar_width_min typography pager_types The shell, navigation and reading interface
params.<runtime> mermaid plantuml drawio markmap Each content runtime’s own switch and endpoint

A working site needs only the first two layers, including the Goldmark settings that OINK’s Markdown components depend on:

hugo.yml
title: Product Docs
baseURL: https://docs.example.com/
defaultContentLanguage: en
enableGitInfo: true

markup:
  goldmark:
    renderer:
      unsafe: true
    parser:
      attribute:
        block: true
      wrapStandAloneImageWithinParagraph: false
  highlight:
    noClasses: false

module:
  imports:
    - path: github.com/pgsty/oink

params:
  offline_search: true
  github_repo: https://github.com/example/product-docs

When a value is wrong

OINK checks every value it reads. When it cannot use one, such as a misspelled choice, a string where a boolean belongs, or a color that is not hex, it prints a warning that names the key, the value and the fallback, then continues with the documented default:

WARN invalid params.ui.typography "solarized" (allowed: technical | system) -- using "technical"

The site keeps building, so a typo under hugo server changes one setting instead of taking every page down. The same applies to front matter overrides, where the warning also names the page. Read the warnings after each change, because a warning usually means a feature you expected is running on its default or is switched off; Verifying a configuration change lists the common ones. For the same reason, leave Hugo’s --panicOnWarning off: OINK reports fallbacks as warnings on purpose, and the flag would turn each one into a failed build.

Features that depend on an outside service stay off until their configuration is complete. Draw.io without drawio_server, maps without tiles and attribution, Algolia without all three keys and giscus without its four required values each warn and render nothing; the theme never substitutes a public service of its own choosing. Upstream attribution that is missing required fields also warns and is left out entirely, because a partial credit line would look complete.

One check keeps your value. If theme_color reads below 4.5:1, the AA contrast for body text, against the theme’s canvas, the color still ships, since a custom canvas or a brand rule may justify it. The warning prints an ignoreLogs id you can add to silence it. Only a value that is not a hex color is dropped, leaving the default palette.

Hugo itself can still stop a build when a content reference resolves to no page.

Page-level override precedence

Most parameters can be overridden for one page or a whole section. Hugo’s .Param lookup takes the first value it finds, in this order:

  1. The page’s own front matter;
  2. cascade in an ancestor section’s _index.md (the nearest wins);
  3. Site params.

Drop the ui. prefix in front matter. The site key params.ui.reading_time becomes reading_time on a page. The theme silently ignores a ui: block in front matter, so when an override seems to have no effect, check the key name against Page parameters first.

content/docs/wide-reference.md
---
title: Wide reference
page_width: wide
navbar_enabled: false
footer_style: slim
reading_time: false
---

A cascade sets a whole subtree at once:

content/docs/_index.md
---
title: Docs
cascade:
  type: docs
  footer_style: slim
  feedback: true
---

Override where the content genuinely differs. A page that rebuilds its own visual system out of overrides tends to drift out of step with the rest of the site after a theme upgrade.

The three Goldmark prerequisites

Hugo does not merge a theme module’s markup settings into the site, so these lines belong in your own hugo.yml:

hugo.yml
markup:
  goldmark:
    parser:
      # block images may carry an attribute line ({caption=…}, numbered figures)
      wrapStandAloneImageWithinParagraph: false
      attribute:
        block: true
    renderer:
      # HTML emitted by `{{% … %}}` shortcodes has to survive
      unsafe: true
    extensions:
      passthrough:
        enable: true
        delimiters:
          block: [['\[', '\]'], ['$$', '$$']]
          inline: [['\(', '\)']]
  highlight:
    # class-based highlighting, so light and dark can each have a palette
    noClasses: false
  tableOfContents:
    endLevel: 4

The first three settings are the prerequisites every OINK site needs; the rest switch on math, theme-aware highlighting and a deeper outline. Each one shows a visible symptom when it is missing:

Setting Without it
parser.attribute.block: true Attribute lines such as {.fields}, {.steps} and {caption=…} print as literal text
parser.wrapStandAloneImageWithinParagraph: false A standalone image cannot take an attribute line, so captions and numbered figures do not work
renderer.unsafe: true Hugo escapes the HTML that steps, cards and {{% … %}} shortcodes produce
extensions.passthrough \(x\) and $$…$$ stay as text instead of becoming formulas
highlight.noClasses: false Code is colored with inline styles, so it cannot switch palette with dark mode
tableOfContents.endLevel: 4 Optional: without it the outline stops at ### headings

renderer.unsafe: true also lets raw HTML in Markdown through. That suits a team writing its own documentation, but it is not a filter: if the site publishes contributions from untrusted authors, review them before they merge.

Site identity and brand

Hugo’s own keys name the site and turn on Git metadata:

title , string
Site name, shown in the navbar, <title> and the footer
baseURL , string
The production domain. Include the path segment for a subpath deployment
copyright , string
Fallback copyright line, rendered as HTML when params.copyright is unset
enableGitInfo , boolean , defaultfalse
Needed for “last modified” dates and commit information
enableRobotsTXT , boolean , defaultfalse
Generates robots.txt
enableEmoji , boolean , defaultfalse
Allows :smile: emoji shortcodes

The theme’s keys add the logo, footer text and accent color:

params.logo , string , defaulticons/logo.svg
Brand mark, from an assets/ resource or a static/ path. See Brand and appearance
params.wordmark , string
Horizontal wordmark shown beside the logo in place of the site name. Below 992 px the navbar shows the logo alone
params.description , string
Site description, used as the meta description when a page has none
params.copyright , string or map
A string renders as Markdown. A map takes authors, from_year and to_year; present means the current year
params.footer_center_info , string , defaultPowered by Oink
Inline Markdown in the middle of the footer. An empty string hides it
params.author , string or map
The RSS author. A map takes name and email
params.ui.theme_color , string
#rgb or #rrggbb accent for the shell’s colored backgrounds. Prose links and inline code keep their own colors. See Brand and appearance
params.ui.theme_color_dark , string , defaultderived
The dark-mode accent. When omitted, the theme lightens theme_color until it meets AA contrast on the dark canvas

Favicons have no parameter: the theme picks up the conventional file names in static/ (favicon.ico, favicon.svg, favicon-NxN.png, apple-touch-icon.png, apple-touch-icon-NxN.png). See Brand and appearance.

Shell types and section roots

The reading shell follows a page’s type, not its folder, so documentation can live in any directory as long as a cascade gives it type: docs.

params.ui.shell_types , list , default[docs, book, blog, swagger, expo]
Types that get the reading shell with a sidebar. See Layouts and page types
params.ui.docs_section , string , defaultdocs
Folder name of the documentation section, used only to resolve navigation
params.ui.blog_section , string , defaultblog
Folder name of the blog section
params.ui.docs_sidebar_root , enum , defaultsection
Where a docs sidebar starts: section at the documentation section, home at the site home
params.ui.quick_links , list , default[docs_section, blog_section]
Top-level menu identifiers the command palette lists before you type. See Command palette
params.ui.sidebar_root_enabled , boolean , defaulttrue
Lets a subsection become its own sidebar tree with sidebar_root_for: self
params.ui.sidebar_root_menu , boolean , defaulttrue
Section switcher above the sidebar. With a single entry it becomes a plain link
params.ui.section_index , enum , defaultlist
How a section index lists its children: list or cards. Overridable per section
params.ui.section_index_columns , integer , default2
Columns when section_index: cards

Expo albums

Site-wide defaults for Expo albums. A page’s own expo block replaces this block as a whole and takes built-in defaults for the fields it leaves out, and a reader’s saved mode and size override both. The complete rules are in Expo defaults.

params.ui.expo.images , string , defaultimages/*
Pattern that selects the image resources in the page bundle
params.ui.expo.mode , enum , defaultwall
wall, cards or seamless
params.ui.expo.size , integer , default240
Target tile size, from 160 to 360 CSS pixels

Blog

These keys shape the section named by params.ui.blog_section, and each can be overridden for one section through front matter or a cascade on the blog root. The blog layout guide compares the four index layouts side by side.

params.ui.featured_image , enum , defaultnone
How a post’s featured image appears on its page and in section indexes: none shows nothing, banner a 16:9 figure above the title, wash the image behind the article header at one-tenth opacity, hero a full-bleed background behind the shell that moves the opening down. It is the same image as the post card and og:image, so the three always agree. Without an image, every mode shows nothing
params.ui.blog_index , enum , defaultlist
list horizontal entries, cards image cards, table compact rows, gallery linked covers. All are newest first; table always lists the whole section on one page
params.ui.blog_index_columns , integer , default3
Columns for blog_index: cards from the xl breakpoint up. Between md and xl there are always two columns, below md one
params.ui.blog_index_size , integer , default12
Posts per page for list, cards and gallery, and for all four layouts when blog_index_toggle is on. A standalone table ignores it
params.ui.blog_index_toggle , boolean , defaultfalse
Publishes all four layouts and lets readers cycle list → cards → table → gallery, remembering their choice. When false, only the configured layout is published
params.ui.blog_gallery.mode , enum , defaultwall
Tile arrangement inside gallery: wall with 6px gaps, seamless with none, cards as a masonry with visible captions. Independent of blog_index
params.ui.blog_gallery.size , integer , default240
Target gallery tile size, 160–360 CSS pixels. It does not change the number of posts per page
params.ui.toc_style , enum , defaultfixed
Right-rail presentation: fixed pins a panel to the viewport; flow uses a wider panel that starts level with the article and pins only once you scroll
params.ui.toc_taxonomies , boolean , defaulttrue
Taxonomy term clouds in the right rail. A rail with neither an outline nor clouds is not rendered

A page or cascade blog_gallery block replaces the whole site block. Fields it leaves out take wall and 240. A reader’s saved arrangement and size override the author’s defaults and are kept separately from Expo preferences. See Gallery.

Authors and series are taxonomies rather than parameters; see Taxonomies and Writing a blog.

The navbar, the footer and the page-action menu at the right end of the breadcrumb row:

params.ui.navbar_enabled , boolean , defaulttrue
Whether the site navbar renders. A page overrides it with a top-level navbar_enabled. See Navigation and menus
params.ui.navbar_autohide , boolean , defaultfalse
The navbar slides up out of view and returns when the pointer reaches its wake zone at the top. Inactive below 768px and on coarse pointers
params.ui.footer_style , enum , defaultfat
fat is a multi-column grid plus the copyright line, slim the copyright line only, none nothing
params.ui.dark_mode , boolean or map , defaultfalse
true turns on the dark palette and the light/dark control. { show_menu: true } implies enable: true; { enable: true, show_menu: false } keeps the palette without showing the menu control
params.ui.breadcrumb , boolean , defaultper-shell (true; false in blog)
Breadcrumbs above the title. A top-level section never shows a one-level breadcrumb
params.ui.page_context_menu.enable , boolean , defaulttrue
The page-action split button at the right end of the breadcrumb row
params.ui.page_context_menu.assistant_links , boolean , defaultfalse
Adds “Open in ChatGPT” and “Open in Claude”. A click sends the page’s full URL to that site
params.ui.page_context_menu.links , list , default[]
Your own external actions. url may use the {url}, {title} and {markdown_url} placeholders
params.ui.github_stars , string or number
Star count on the navbar GitHub mark. It is a constant you write; the page makes no request
params.ui.alt_site , map
Link to a sibling site in a single-language footer. Needs both label and an absolute http(s) url

The fat footer’s columns come from data/footer/<language>.yaml, not from a parameter; see Navigation and menus.

Sidebar

How the left navigation tree renders. Its structure comes from the content/ folders (Organizing content), and Layouts and page types shows these keys in use.

params.ui.sidebar_menu_compact , boolean , defaulttrue
Expands only the current branch and its neighbours
params.ui.sidebar_menu_foldable , boolean , defaulttrue
Lets the reader expand and collapse sections
params.ui.sidebar_menu_truncate , integer , default2000
Most entries rendered in one section; the rest are cut
params.ui.sidebar_cache_limit , integer , default500
From this page count on, pages that share a language, sidebar root and effective settings reuse one copy of the navigation markup, and the browser marks the active entry
params.ui.sidebar_width_min , integer , default220
Narrowest width, in pixels, the reader can drag the sidebar to on the desktop
params.ui.sidebar_width_max , integer , default480
Widest width, in pixels, for drag-resizing
params.ui.sidebar_item_overflow , enum , defaultellipsis
A long title is cut with ellipsis or wraps with wrap
params.ui.sidebar_icon_policy , enum , defaultall
Icon density: all everywhere, groups only on the root and on entries with children, none nowhere
params.ui.sidebar_expand_levels , integer , default2
Tree levels expanded by default
params.ui.sidebar_headings , boolean or integer , defaultfalse
type: book only: shows the current page’s headings as a branch under its sidebar row. Takes an integer from 2 to 4; true means 2
params.ui.sidebar_enabled , boolean , defaulttrue
The left sidebar. Usually turned off per page rather than for the whole site
params.ui.taxonomy_icons , map , defaultbuilt-in
Icons per taxonomy, keyed by plural. Each taxonomy has two: taxonomy for the whole classification, such as a right-rail cloud heading, and term for one term’s badge. A string such as tags: fa-solid fa-tags sets both; a map with taxonomy and term sets them separately, and a key it leaves out keeps the built-in. Built-in pairs cover tags, categories, modules, authors and series; any other taxonomy uses a generic shapes icon

Table of contents

Hugo decides which heading levels the right-hand outline collects; the theme only controls how it follows your reading. Hide the outline on one page with notoc: true (Page parameters).

markup.tableOfContents.startLevel , integer , default2
Hugo’s own: the highest heading level collected
markup.tableOfContents.endLevel , integer , default3
Hugo’s own: the lowest heading level collected
params.ui.scroll_spy , boolean , defaultfalse
No effect: the outline always highlights the current heading. Safe to delete from older configurations

Pager and page end

The blocks at the end of a page always come in the same order: share, feedback, page information, pager, comments. Each has its own switch. Backlinks sit in the right rail beside the outline.

params.ui.share , list , default[]
Share targets at the page end, in the order listed, chosen from x bluesky mastodon facebook linkedin reddit hackernews telegram whatsapp line pinterest weibo chatgpt claude email copy. An empty list hides the bar. Each target is a plain link, with no SDK, iframe, third-party script or share count. An unknown target warns and is dropped. See Writing a blog
params.ui.pager_types , list , default[docs, book, blog]
Types that show previous and next links. Turn them off on one page with pager: false. An unknown type warns and is dropped
params.ui.annotation , boolean , defaulttrue
The “last modified” and provenance block at the end of the body. Upstream attribution comes from the page’s upstream_link keys; see Page parameters
params.ui.backlinks , boolean , defaultfalse
A “Backlinks” group in the right rail listing the pages that link here, worked out at build time from ordinary links. See Navigation and menus
params.ui.compare , boolean , defaultfalse
Duo View: two panes side by side on Docs, Book and blog pages that have an HTML translation on the same site. A language can set it to false to opt out. See Duo view
params.ui.translation_notice , language code or false , defaultfalse
The language code of the authoritative version, so that a translated page shows a line pointing back to it. A page opts out with translation_notice: false
params.ui.reading_time , boolean , defaultfalse
Reading time under the page title
params.ui.book_draft_banner , boolean , defaultfalse
A banner at the top of a draft Book page

Local search is off by default. Turning it on also brings up the command palette, which opens from the navbar magnifier, Cmd/Ctrl with K, / and \.

params.offline_search , boolean , defaultfalse
Builds one local index per language and turns on the command palette. See Search
params.offline_search_on_serve , boolean , defaulttrue
Builds the index under hugo server too, so the preview searches like production. On a very large site, false speeds up local rebuilds
params.offline_search_index , enum , defaultcontent
How much of each page is indexed, each level adding to the one before: title, heading, summary, content
params.offline_search_summary_length , integer , default70
Length, in characters, of the excerpt stored for each page; a result shows it when no passage matches
params.offline_search_max_results , integer , default10
Most page results one search returns
params.ui.landing_search , boolean , defaulttrue
Keeps a search entry point on layout: landing pages
params.ui.command_palette.commands , list , default[]
Your own palette commands, each with either a url or a built-in action. See Command palette
params.gcs_engine_id , string
A Google Programmable Search engine ID. Searches then go to Google
params.search.algolia , map
Algolia DocSearch. appId, apiKey and indexName are all required

A custom command takes only seven keys: id, title, description, icon, keywords, url and action. The id must match ^[a-z][a-z0-9_-]*$ and must not repeat a built-in action ID. Put per-language titles under languages.<lang>.params.ui.command_palette.commands.

Keyboard

params.ui.keyboard_nav , boolean , defaulttrue
Twenty-nine single-key shortcuts for navigation, page actions and the view, plus the browsing history and the reader’s column width. With false, the runtime is left out of the page, so nothing is bound, recorded or restored. See Keyboard navigation

Image zoom

params.ui.image_zoom , boolean , defaultfalse
Lets body images open full size. A page overrides it with image_zoom in front matter

Images explains which images can be zoomed.

Typography

The visual preset, the fonts and the page widths:

params.ui.preset , enum , defaultpaper
Site-wide look: paper or slate, or the explicit experiments github, ink, news and terminal
params.ui.preset_menu , boolean or list , defaultfalse
true lets readers choose Paper, Slate or the site default. A list names the presets offered, may include the experiments, and must include the site default. Independent of dark_mode
params.ui.typography , enum , defaulttechnical
technical uses the selected preset’s bundled fonts (Paper: Plex Sans; Slate: Inter); system uses the platform font stack and requests no brand font
params.ui.fonts , map
Font-family names for the ui, body, heading, code, display, meta, brand and print roles. The theme checks the names but loads no font files. End each list with a generic family
params.page_width , enum , defaultnormal
Overall shell width: normal, wide, full. Overridable per page
params.reading_width , enum , defaultnormal
Body text width on Book pages: slim, normal, wide. The shell is unaffected

params.ui.fonts suits faces that are already on the reader’s system or that the site declares with @font-face. To ship font files with the site or change finer typography, use the project stylesheet; see Brand and appearance.

Comments and feedback

Comments use giscus, which keeps each page’s discussion in a GitHub repository; page feedback is two buttons with no backend of its own.

params.comments.enable , boolean , defaultfalse
Site-wide comment switch. A page overrides it with comments in front matter. See Comments
params.comments.type , string , defaultgiscus
Only giscus renders today
params.comments.giscus.repo , string
The GitHub repository that holds the discussions; required
params.comments.giscus.repoId , string
The repository ID; required
params.comments.giscus.category , string
The discussion category name; required
params.comments.giscus.categoryId , string
The discussion category ID; required
params.comments.giscus.mapping , string , defaultpathname
How pages map to discussions
params.comments.giscus.term , string
The discussion title or number when mapping is specific or number. Omitted when unset
params.comments.giscus.strict , string , default0
Strict title matching
params.comments.giscus.reactionsEnabled , string , default1
Shows reactions on the main post
params.comments.giscus.emitMetadata , string , default0
Sends discussion metadata to the parent page
params.comments.giscus.inputPosition , string , defaulttop
Whether the input box sits above or below the comments
params.comments.giscus.theme , string , defaultauto
The giscus theme. auto follows the site’s light/dark state
params.comments.giscus.lightTheme , string , defaultOINK palette
giscus theme name or custom CSS URL for light mode. By default, OINK’s own stylesheet for the active preset, so comments match the page
params.comments.giscus.darkTheme , string , defaultOINK palette
giscus theme name or custom CSS URL for dark mode. By default, OINK’s own stylesheet for the active preset
params.comments.giscus.loading , string , defaultlazy
lazy requests the giscus script only when the reader nears the comments, except on return from GitHub sign-in; eager requests it at once
params.comments.giscus.lang , string , defaultderived from the site language
The giscus interface language. When unset, Chinese sites resolve to zh-CN, zh-TW or zh-HK and other languages use their base code; a language giscus does not support falls back to en
params.comments.giscus.ariaLabel , string , defaulttranslated
The comment container’s aria-label. The default is “Comments” in the page’s language
params.comments.giscus.errorMessage , string , defaulttranslated
Text shown when loading fails. The default is “Comments could not be loaded.” in the page’s language
params.ui.feedback.enable , boolean , defaultfalse
“Was this page helpful?” buttons at the page end. There is no backend; when gtag is present, each answer is recorded as a structured event
params.ui.feedback.reasons , boolean , defaulttrue
Offers four optional reasons after “no”

Without all four required giscus values, the page has no comment section. Comments shows where to find them.

Repository links and page information

Links from each page back to its source, and the information block at its end:

params.github_repo , string
URL of the repository that holds the content. Drives “Edit this page”, “View edit history”, “Create child page” and “Create docs issue”. See Repository links and page info
params.github_project_repo , string , defaultgithub_repo
URL of the product repository, for “Create project issue” and the navbar GitHub entry
params.github_branch , string , defaultmain
The branch that edit links point at
params.github_subdir , string
The content site’s subdirectory inside a monorepo
params.path_base_for_github_subdir , string or map
Rewrites source paths (normalized to /) before they become repository links. A map takes from and to. Content mounted from outside the repository needs an explicit mapping to a repository-relative path. See repository links
params.github_url , — , default—
Removed and ignored. Use params.github_repo
params.ui.lastmod_commit , enum , defaultsubject
What follows “last modified”: subject the commit subject, hash the short hash, none nothing
params.images , string array , default—
Site-wide social card: supplies og:image for pages without their own image. Metadata only; never shown as a list thumbnail
params.upstream_source , string , default—
Default data/upstreams record for pages that declare upstream_link. A page’s front matter can override it
params.upstream_modified , boolean , defaultfalse
Site default for whether attributed material has been adapted. A page can override it. Nothing renders without upstream_link
params.default_featured , — , default—
Removed and ignored. Use params.images, or images in a section cascade

Content runtimes

Mermaid, KaTeX, ECharts, Infographic, Asciinema, Swagger UI and Redoc load by themselves on the pages that use them, and only in HTML output, so they have no switch. The features below need one, mostly because they talk to a service you choose. PlantUML renders in the reader’s browser unless you set svg_image_url, which hands rendering to a server; PlantUML compares the two modes.

params.markmap , boolean , defaultfalse
Turns on the mind-map fence site-wide. See Markmap
params.mermaid , map
Configuration passed to mermaid.initialize(). Keys are lowercase. Dark mode overrides theme automatically
params.plantuml , boolean or map , defaultdisabled
true turns on local rendering; false turns off all PlantUML rendering
params.plantuml.enable , boolean , defaultfalse
Turns on local PlantUML rendering. See PlantUML
params.plantuml.svg_image_url , string
Optional PlantUML server endpoint. Without it, diagrams render in the browser
params.plantuml.svg , boolean , defaultfalse
Server mode only: inline SVG instead of an <img>
params.drawio.enable , boolean , defaultfalse
Adds an edit button to .drawio.svg images. See Draw.io
params.drawio.drawio_server , string
Address of the Draw.io editor. Required when enable is true
params.video_embeds , list , default[]
Platforms (youtube, bilibili, vimeo) whose player loads in place after a reader clicks a video card. Empty: cards only link out. See Video
params.map , boolean or map , defaultdisabled
Interactive maps above map place lists. See Map
params.map.enable , boolean , defaultfalse
Turns on interactive maps; needs tiles and attribution
params.map.tiles , string
HTTPS tile template with {z}, {x} and {y} ({s}, {r} and {-y} allowed; any other placeholder warns and the template is ignored). The theme names no tile service; required when enabled
params.map.attribution , string
The plain-text attribution the tile service requires. Required when enabled
params.map.attribution_url , string
Optional https:// URL turning attribution into a clickable link
params.map.dark_tiles , string
Optional tile template for dark mode
params.map.subdomains , string
Optional {s} subdomain characters as a quoted string (e.g. abcd, "01234567"); empty uses Leaflet’s abc
params.map.max_zoom , integer , default19
Highest zoom level, 1–22
params.map.loading , lazy | click , defaultlazy
Mount near viewport (lazy) or wait for a reader click (click)
params.highlight_classes , boolean , defaulttrue
Emits Chroma classes for syntax highlighting; false returns to Hugo’s inline styles
params.ui.code_copy , boolean , defaulttrue
Copy button on code blocks. false removes it site-wide; a fence’s own copy= still wins
params.ui.rich_copy , boolean , defaulttrue
Typeset HTML copy for article prose selections pasted into rich-text editors; overridable per page or cascade. See Copying into rich-text editors

Math needs no parameter, only the passthrough setting.

Output formats

The theme defines extra output formats but turns none of them on, because some are expensive to build and most sites need only a few. List the ones you want under outputs:

hugo.yml
outputs:
  home: [HTML, markdown, LLMS, NAVJSON]
  page: [HTML, markdown]
  section: [HTML, RSS, print, markdown]
Format Output Description
HTML index.html The interactive page; required
markdown index.md A plain Markdown version of each page. “Copy Markdown” and “View markdown” need it. See AI-agent support
LLMS llms.txt A plain-text site index for language models, usually on home only
LLMSFULL llms-full.txt Opt-in for a top-level section: its pages’ Markdown joined in sidebar order, one file per language
NAVJSON navigation.json Opt-in on home: the sidebar and pager tree as JSON, once per language, validated by schema/nav.v1.schema.json
print _print/index.html A whole section as one printable page. See Print
BookManifest book.json Optional JSON at a Book root for EPUB and PDF packaging tools. It is not an ebook itself
RSS index.xml Hugo’s own format. Add it to section to give each section a feed

LLMSFULL and BookManifest go in the front matter of the top-level section that publishes them, not in the site configuration, and NAVJSON belongs on outputs.home. AI-agent support and Books have complete examples.

Two parameters shape the print output:

params.print.toc , boolean , defaulttrue
A table of contents at the top of the print page. false leaves it out
params.print.section_break_wordcount , integer , default50
How many words a section needs before it starts on a new print page

Languages and versions

Languages are defined in Hugo’s own languages block, and the theme reads the translation links Hugo builds from it:

defaultContentLanguage , string , defaulten
The primary language, served without a path prefix
languages.<lang>.label , string
The language’s own name, shown in the language menu
languages.<lang>.locale , string
The full locale, used for <html lang> and SEO
languages.<lang>.weight , integer
Language order, which is also the cycle order when the reader clicks the language icon
languages.<lang>.title , string
The site name in that language
languages.<lang>.direction , string , defaultltr
rtl for a right-to-left language

Paired files, anchor alignment and fallback for untranslated pages are covered in Languages.

Version keys:

params.version , string
Identifier of this site variant; it need not be a Git ref. See Versions
params.version_menu , string , defaultVersion
Title of the version menu
params.version_menu_pagelinks , boolean
When switching version, try the same path on the target site first
params.versions , list
Version entries with version, url and kind; name: '---' is a divider
params.archived_version , boolean
Shows the “this is an archived version” banner at the top
params.url_latest_version , string
Link to the current version inside that banner
params.time_format_blog , string , default2006-01-02
Blog date format, overridable per language
params.time_format_default , string , default2006-01-02
Every other date format, overridable per language

Miscellaneous

taxonomies , map
Hugo’s own: turns on tag: tags and category: categories. See Taxonomies
params.taxonomy.page_header , list
Taxonomies shown in a post header. When unset, all of them
services.googleAnalytics.id , string
Hugo’s own: the analytics script is added to production builds only. See Analytics and SEO

Editor completion via generated schemas

The theme publishes JSON Schemas for its configuration, so your editor can complete keys, show each key’s documentation on hover and flag a wrong type as you type. schema/site-params.schema.json covers hugo.yml, and schema/front-matter.schema.json covers page front matter. Take them from the same release tag as the theme pinned in your go.mod, because keys change between releases.

With the VS Code YAML extension, map the site schema in your settings. This example uses OINK v1.8.0 and covers both common file names; replace the tag with the one in your go.mod:

.vscode/settings.json
{
  "yaml.schemas": {
    "https://raw.githubusercontent.com/pgsty/oink/v1.8.0/schema/site-params.schema.json": ["hugo.yml", "hugo.yaml"]
  }
}

To confirm the mapping works, give a boolean such as params.offline_search a string value for a moment: the editor should flag the type. Then put the valid value back. Front matter completion depends on your Markdown tooling; associate it with front-matter.schema.json in the same way. That schema does not enforce types, because keys such as share and theme_color also accept a bare boolean to opt out.

Verifying a configuration change

Build once after each configuration change:

hugo --printPathWarnings

The build is good when it ends with Total in … and prints no ERROR. Then read each WARN line; these are the common ones:

Warning fragment Cause
invalid params.ui.typography The only choices are technical and system
invalid params.ui.footer_style … (allowed: fat | slim | none) A misspelled footer style. When it comes from front matter, the warning names the page
invalid params.page_width … (allowed: normal | wide | full) A misspelled page width
invalid params.ui.section_index … (allowed: list | cards) A misspelled section index style
invalid params.offline_search_index The scopes are title, heading, summary and content
params.drawio.enable requires an explicit params.drawio.drawio_server Draw.io is enabled without an editor address
params.map.enable requires params.map.tiles … and params.map.attribution Maps are enabled without a complete tile service
params.map.tiles may use only the {s}, {z}, {x}, {y}, {-y} and {r} placeholders The template has a placeholder such as {apikey} that nothing fills; write the key into the URL
params.video_embeds must be a list of platforms Written as a single string or a boolean
params.search.algolia requires explicit appId, apiKey, and indexName One of the three Algolia values is missing
params.ui.image_zoom must be true or false Written as a string such as "true"
theme_color … is not a #rgb or #rrggbb hex color The value is not a hex color; the default palette stays
theme_color … reads at about N:1 against the theme's … canvas Advisory: the color still ships, and the message prints the id that silences it
theme_color_dark … has no theme_color to pair with Only the dark color was set. It is ignored, and both modes keep the default palette
command … must define exactly one of url or action A custom command has both url and action, or neither
invalid params.ui.sidebar_icon_policy …; using all A misspelled icon policy

Then check three things in a browser: one page in each language, one page without a translation to see the fallback, and links under the production baseURL, including any subpath the site is deployed under. Build with the same Hugo that builds the site in production; Get started lists the versions it needs.

5.2 - Brand and appearance

Give the site your name, logo, favicon, accent color and fonts, choose a visual preset, and add your own CSS.

A site starts to look like your own once it carries your name, your logo and your color. All three are settings in hugo.yml, so a first pass at a brand is one edit and a reload:

hugo.yml
title: Acme DB Docs

params:
  logo: images/acme-mark.svg # under assets/ or static/
  ui:
    theme_color: '#0f766e'
    dark_mode: true

Fonts, the overall look and the footer are settings too. For anything a setting cannot reach, write plain CSS in assets/css/project.css, which loads after the theme’s stylesheet. Leave the theme’s own files alone, because the next hugo mod get replaces them.

Site name

The site name appears in the navbar, the browser tab and the footer. On a multilingual site, give each language its own under languages.<lang>.title; the top-level title is the fallback for a language that sets none.

hugo.yml
title: Acme DB Docs

languages:
  en:
    title: Acme DB Docs
    label: English
    locale: en-US
    weight: 1
  zh:
    title: Acme DB 文档
    label: 简体中文
    locale: zh-CN
    weight: 2

Out of the box the navbar shows the theme’s mark, assets/icons/logo.svg, beside the site name. Replace either half by putting an image in the site’s assets/ or static/ directory and naming its path relative to that directory:

hugo.yml
params:
  logo: images/acme-mark.svg
  wordmark: images/acme-wordmark.svg # optional
  • params.logo is the square mark in the navbar, the sidebar header and the footer. A file under assets/ goes through Hugo’s resource pipeline; a file under static/ is published unchanged.
  • params.wordmark is an image of the name that takes the place of the site name text next to the mark. The navbar draws it 16px tall and, like the site name, hides it below 992px, leaving the mark alone, so the wordmark should contain the name only. The footer shows it on its own unless the footer data names a logo.

Crop the SVG tightly around the artwork and give it a viewBox, or it will not line up with the text beside it. The theme places both images with <img>, which page CSS cannot recolor and in which currentColor resolves to black. Choose colors that read on both the light and the dark canvas, or do what the theme’s own mark does: put a <style> inside the SVG with a @media (prefers-color-scheme: dark) rule. That rule follows the reader’s system setting, not the site’s light/dark toggle.

Favicon

There is no favicon setting. The theme looks in the site’s static/ directory for the conventional file names and adds a <link> to every page for each one it finds:

static/favicon.ico
rel="icon"
static/favicon.svg
rel="icon" type="image/svg+xml"
static/favicon-32x32.png
rel="icon" type="image/png" with sizes; several sizes are linked smallest first
static/apple-touch-icon.png
rel="apple-touch-icon"
static/apple-touch-icon-180x180.png
rel="apple-touch-icon" with sizes

favicon.ico, favicon.svg and apple-touch-icon.png are enough for every browser. A file with a size in its name must be square (NxN); the theme ignores any other.

Other head metadata, such as a Web App Manifest, goes in layouts/_partials/hooks/head-end.html. To look in another directory or accept other names, override layouts/_partials/favicons.html in the site.

Accent color

The accent color marks where the reader is: the selected sidebar row and hover backgrounds, the outline’s current-section marker and its rail, tag and chip hovers, card borders and share buttons on hover, text selection, focus rings, and each section’s mark in the sidebar switcher. Set it with one hex value:

hugo.yml
params:
  ui:
    theme_color: '#0f766e'
    theme_color_dark: '#5eead4' # optional

It is most useful per section. Put the pair in a section root’s cascade and the whole section, its index page included, takes that color, so readers can tell Docs from Blog at a glance while the rest of the site keeps the default:

content/blog/_index.md
cascade:
  theme_color: '#6d28d9'
  theme_color_dark: '#a78bfa'

Prose links, external URLs and inline code keep the preset’s colors in every section, because a reader should recognize a link or an identifier the same way everywhere. To change those, override the palette.

theme_color_dark is optional. Without it, the theme lightens the light color toward white until it reaches AA contrast for body text on the dark canvas; set it yourself when the derived shade drifts from your brand. The light color is required: a theme_color_dark on its own, or next to an invalid theme_color, is ignored with a warning, so a page is colored in both modes or in neither.

To return one page to the default palette, set theme_color: false in its front matter; that drops the inherited dark color too, without a warning. Any other value that is not a #rgb or #rrggbb hex, such as a number, true or a color name, warns and keeps the default. Hugo merges parameters key by key, so a page that overrides only theme_color still inherits the section’s theme_color_dark: override both or neither.

The theme checks each color you write against its own canvases and warns when contrast falls below 4.5:1, the AA level for body text. The color is still applied, since a custom canvas or a fixed brand color may justify it, and the warning carries an ID you can add to Hugo’s ignoreLogs once you have checked it on the real background. A color that only just passes deserves a second look on interactive surfaces that use it for text over a 12% wash of itself, such as a linked badge; pick a darker shade if those read poorly.

Fonts

OINK bundles its Latin typefaces as local fonts served from your own site, so no page requests Google Fonts or any other font service. Chinese uses fonts already on the reader’s system, and the theme ships no Chinese font file. Each visual preset arranges the faces its own way:

Preset Interface and body text Headings Chinese
Paper IBM Plex Sans IBM Plex Sans Hei throughout
Slate Inter Inter; Chakra Petch for display titles Hei throughout
GitHub GitHub’s system font stack GitHub’s system font stack Hei throughout
Ink Palatino Palatino; italic for sections Kai headings and chrome over Fangsong text, or Song where they are missing
News A system serif Times New Roman, heavy Song throughout, heaviest in headlines
Terminal IBM Plex Mono, IBM Plex Sans in print IBM Plex Mono Hei throughout

Code is IBM Plex Mono and the wordmark Chakra Petch in Paper and Slate. Plex Sans and Inter include Latin, Cyrillic, Greek and Vietnamese. Chinese emphasis and quotations switch to Kai where the reader has it installed, so Han is never slanted; Terminal colors emphasis instead.

To use the platform’s own fonts and load none of the bundled ones, switch the typography policy:

hugo.yml
params:
  ui:
    typography: system # technical (default) | system

With system, every role uses the platform font stack. An invalid value warns and falls back to technical. The policy in effect is written to <html data-td-typography="…">.

Use fonts readers already have

To change a family without writing CSS, set params.ui.fonts:

hugo.yml
params:
  ui:
    fonts:
      # Body text and headings follow this face in every preset
      ui: "'Source Han Sans SC', 'PingFang SC', sans-serif"
      # Give monospace a CJK fallback, or mixed code blocks stop aligning
      code: "'Sarasa Mono SC', 'Noto Sans Mono CJK SC', monospace"

Setting ui changes body text and headings in every preset. Set heading to choose a separate face for headings. The other keys are listed under Font roles.

These values are family names, not files: the theme never downloads or loads a font because of this key. A family must already be on the reader’s system or declared by your own @font-face, so end every list with a generic family (sans-serif, serif, monospace) for readers who have neither.

A value may contain only font family syntax: quoted names, bare identifiers, a leading hyphen as in -apple-system, and names in any script (苹方 is a family name). Semicolons, braces, parentheses, url() and angle brackets are rejected. An unknown role or an unsafe value warns and drops that one entry; the rest of the map still applies. The theme writes these values after its stylesheet, so they win over both the preset and typography: system.

Bundle your own font

To ship a font file, or to give one kind of content its own face, use the project stylesheet. Put the .woff2 file in the site’s static/webfonts/, declare it, and point the roles at it:

assets/css/project.css
@font-face {
  font-family: 'My Sans';
  font-display: swap;
  font-style: normal;
  font-weight: 400 800;
  src: url('../webfonts/my-sans-variable.woff2') format('woff2');
}

:root {
  --td-ui-font-family: 'My Sans', 'Noto Sans SC', sans-serif;
  --td-body-font-family: var(--td-ui-font-family);
  --td-heading-font-family: var(--td-ui-font-family);
  --td-display-font-family: var(--td-heading-font-family);
}

Roles are ordinary inherited custom properties, so scoping one to a body class changes the face for that kind of page without touching component selectors:

assets/css/project.css
body.td-blog {
  --td-body-font-family: 'My Serif', 'Noto Serif SC', serif;
  --td-heading-font-family: var(--td-body-font-family);
}

A monospace stack needs a CJK fallback, or code that mixes Latin and Chinese stops aligning:

assets/css/project.css
:root {
  --td-code-font-family: 'My Mono', 'Sarasa Mono SC', 'Noto Sans Mono CJK SC', monospace;
}

Font roles

Eight CSS custom properties carry the font roles, and each can also be set by its key under params.ui.fonts:

Property Config key Where it is used
--td-ui-font-family ui Navigation, controls and interface text
--td-body-font-family body Body text and blog posts
--td-heading-font-family heading Headings in the body
--td-code-font-family code Code and terminals
--td-display-font-family display Display headings
--td-meta-font-family meta Technical labels and metadata
--td-brand-font-family brand Wordmark
--td-print-font-family print Print body text; follows body unless set

Visual presets

A preset is a complete look: palette, fonts, link style and table style, in light and dark. Pick the one closest to your brand before adjusting colors by hand.

Preset Look
paper (default) Warm paper, ink text, blue links and accent, Plex Sans and framed tables
slate A cool blue-gray technical look
github (experimental) Markdown as GitHub shows a README: GitHub’s fonts and colors, ruled tables, alert colors and green buttons
ink (experimental) A written page on warm paper, Palatino and Kai throughout the chrome and headings, Fangsong or Song text, vermilion marks (emphasis dots, a first letter, the current row), brush-stroke rules and underlined prose links; at night gold and silver writing on indigo-violet paper
news (experimental) A printed page on grey newsprint: heavy Times New Roman and Song headlines, serif text and chrome, one spot blue, a masthead rule, a deck and dateline under the title, thick-and-thin section rules, pull quotes and open tables; at night a darkroom, silver type on black with a safelight orange
terminal (experimental) Monospace controls, headings and prose, teal links, amber accents and compact desktop navigation; at night a phosphor screen, grey type on black with green headings, links and cursor

Each preset’s dark mode keeps the fonts of its light mode but has a palette of its own, so switching to dark is a different experience rather than an inverted page.

params.ui.preset sets the site’s look. params.ui.preset_menu decides whether readers may choose another in the Appearance menu:

hugo.yml
params:
  ui:
    preset: paper
    preset_menu: [paper, slate, github, ink, news, terminal]
    dark_mode: true
preset_menu Readers can choose
false (default) Nothing; every page uses preset
true Paper, Slate and the site’s own preset
A list Exactly the listed presets; the site’s preset is added with a warning if missing

GitHub, Ink, News and Terminal appear only when you name them, as preset or in the list. The menu always lists them in the order of the table above. The experiment record lists what has been tested on Ink and Terminal. A reader’s style and light/dark choice are saved separately in the browser, and choosing the entry marked as the site default goes back to following the site. Print always uses a light palette on white paper.

Font settings and theme_color win in every preset. Dark palette overrides in your own CSS do not automatically: Paper scopes its dark palette to [data-td-preset='paper'][data-bs-theme='dark'], which outranks a bare [data-bs-theme='dark']. Write dark overrides as shown under Palette colors.

Light and dark mode

Sites are light-only until you turn dark mode on:

hugo.yml
params:
  ui:
    dark_mode: true

This adds the dark palette and a Light / Dark / System choice to the Appearance control in the navbar and footer, whose icon shows the reader’s choice: a sun for Light, a moon for Dark, and a half-filled circle for System, which stays while the system switches between modes. The control works with touch and keyboard and opens as a bottom sheet on phones. A reader’s choice is saved in the browser and shared across tabs; with no saved choice the page follows the system’s prefers-color-scheme. A small inline script applies the mode before the stylesheet loads, so pages never flash the wrong palette.

To support the dark palette for readers whose system asks for it, without showing the control, write dark_mode: { enable: true, show_menu: false }. If preset_menu still offers styles, the control stays and shows a palette.

hugo.yml
params:
  ui:
    footer_style: fat # fat | slim | none
  copyright:
    authors: '[The Acme DB team](https://example.com/)'
    from_year: 2026
    to_year: present
  footer_center_info: 'Powered by [Oink](https://oink.pgsty.com)'
footer_style Footer
fat (default) A grid of link columns above the copyright line
slim The copyright line only
none No footer

The link columns come from data/footer/<language>.yaml, described in Navigation and menus. Until that file exists, a fat footer renders as slim, so you can switch it on before you write the links. Front matter, or a section’s cascade, can set a different style (for example, slim on a focused reading section while keeping fat elsewhere). An unknown value warns and uses fat.

params.copyright is either a Markdown string or a map of authors, from_year and to_year, where present means the current year. footer_center_info is inline Markdown for the middle of the copyright line; set it to an empty string to leave that space blank.

Project stylesheet

Anything the settings above cannot reach is plain CSS in the site’s assets/css/:

File Use
project.css Your selectors and custom property overrides
project/*.css Optional further files, appended to project.css in path order

The theme publishes them as one stylesheet that loads after its own, minified, fingerprinted and with an integrity attribute in production. Because it is a separate file, editing your styles leaves the theme’s stylesheet, and the copy in readers’ caches, untouched.

Hugo minifies this file but does not compile it, so write CSS, not SCSS: // comments, Sass variables, mixins, @extend and &-suffix selectors do not work, and native CSS nesting reaches the browser as written. Relative URLs resolve from /css/, so ../webfonts/my-font.woff2 is the site’s static/webfonts/my-font.woff2. A site upgraded from an older OINK or from Docsy may still have files under assets/scss/; the build warns and ignores them until you convert them as described in Retired SCSS hooks.

Rely only on the public part of the theme’s CSS: the eight font roles and the --td-brand-* properties keep their names and meanings across minor releases. Component aliases such as --td-asciinema-font-family work only inside their component, and other variables, such as --td-shell-*, can change in any release. Use a variable where one exists, and otherwise the narrowest selector that works; overriding baseof.html to change a color makes every theme upgrade a merge.

To add a third-party stylesheet, copy it into the site and publish it as a local resource from layouts/_partials/hooks/head-end.html, not with a <link> in Markdown. Keep stylesheets and fonts local rather than pointing at a CDN, so the site keeps working when that host does not.

Palette colors

Colors other than the accent are CSS custom properties that you override in the project stylesheet. Each preset sets them in light and dark, so override both modes together, or one mode keeps the preset’s color.

Links use Bootstrap’s link tokens, --bs-link-color and --bs-link-hover-color with their -rgb twins. Bootstrap components such as buttons use the semantic colors; override the property, and the button variables that hold the color as a fixed value:

assets/css/project.css
:root,
[data-bs-theme='light'] {
  --bs-primary: #315f8f;
  --bs-primary-rgb: 49, 95, 143;
}

.btn-primary {
  --bs-btn-bg: #315f8f;
  --bs-btn-border-color: #315f8f;
  --bs-btn-hover-bg: #2a5179;
  --bs-btn-hover-border-color: #274c72;
}

The theme’s brand layer works the same way. Write the dark block with both selectors below: the bare one covers Slate, and the preset-scoped one is needed to outrank Paper’s dark palette.

assets/css/project.css
:root {
  --td-brand-copper: #a66722;
  --td-brand-mark-from: #1d588c;
  --td-brand-mark-to: #a66722;
}

[data-bs-theme='dark'],
[data-td-preset='paper'][data-bs-theme='dark'] {
  --td-brand-copper: #e0a35c;
  --td-brand-mark-from: #7fb8e8;
  --td-brand-mark-to: #e0a35c;
}
Property Used for
--td-brand-copper, --td-brand-copper-dim A warm secondary accent, used in the footer and Landing sections, and its muted form
--td-brand-mark-from, --td-brand-mark-to, --td-brand-mark-gradient The brand gradient, for example on the site name in the navbar
--td-brand-header-bg Navbar background
--td-brand-elev Overlay backgrounds
--td-brand-silk Secondary text
--td-brand-line-strong Strong rules
--td-brand-shadow-sm, --td-brand-shadow-md Shadows

Whatever you recolor, check hover, focus, disabled and selected states in both modes: body text needs 4.5:1 contrast and large text 3:1.

Styles for a site-owned shell

A page with its own layout, such as a hand-built home page, can use parts of the theme’s styling without the reading shell. Instead of main, the stylesheet every OINK page loads, such a layout asks for a smaller stylesheet by name:

chrome
Tokens, typography, the six palettes, the site navbar, and the language, theme and appearance controls
landing
The Landing sections; load it after chrome
search
The command palette and local search
compare
Duo View
layouts/_partials/my-head.html
{{ with partial "css/bundle.html" "chrome" }}
  <link rel="stylesheet" href="{{ (. | minify | fingerprint).RelPermalink }}">
{{ end }}

The partial returns a Hugo resource published as css/<name>.css, one directory below the site root, where its ../webfonts/… references resolve; your layout minifies and fingerprints it. An unknown name warns. These stylesheets follow the pinned theme version, so ask for them by name rather than copying them into the site, and do not read the layer files under the theme’s assets/css/td/, which can change in any release.

Verify

hugo --printPathWarnings
  • The build ends with Total in … and reports no ERROR. Read any warnings: a rejected color, font value or preset name is reported there and replaced by the default.
  • The navbar shows your logo and site name, the browser tab shows your favicon, and switching language switches the site name.
  • <html> carries the data-td-typography and data-td-preset values you set.
  • In dark mode, body text, tables, callouts, code blocks and focus rings are still readable. Check every color change in both modes and in each preset you offer.
  • In the browser’s developer tools, a paragraph’s font-family lists your family, and the rendered font is the file or system font you expect.

5.3 - Home and landing pages

Build the home page, or any product or pricing page, from sections listed in a YAML data file, with no template to write.

An OINK home page is data, not a template. data/home/<language>.yaml lists the sections from top to bottom (a hero, a grid of cards, pricing, a closing call to action) and holds the content of each, so you change the page by editing YAML and never touch HTML. Any other page can use the same sections as a landing page.

Edit the Starter’s home page

The OINK Starter ships a three-section home page in data/home/en.yaml. Replace the text and links with your own and the browser reloads with the result:

data/home/en.yaml
sections: [hero, cards, cta]

hero:
  align: center
  eyebrow: Open-source time-series database
  title_lines:
    - words: [{ text: Acme DB. }]
    - words: [{ text: Fast queries over years of metrics. }]
  lead: Install it, load your data and run your first query in ten minutes.
  actions:
    - { label: Install, url: docs/install/, icon: fa-solid fa-download, style: primary }
    - { label: Read the docs, url: docs/, style: ghost }

cards:
  eyebrow: Where to start
  title: Everything has a place
  columns: 3
  items:
    - title: Install
      desc: Packages for Linux and macOS, a container image, and a Helm chart.
      icon: fa-solid fa-download
      url: docs/install/
    - title: Query language
      desc: Every function and operator, with an example for each.
      icon: fa-solid fa-terminal
      url: docs/reference/
    - title: Release notes
      desc: What changed in each version, and how to upgrade.
      icon: fa-solid fa-tag
      url: blog/

cta:
  title: Run your first query today.
  text: The quick start takes ten minutes on a laptop.
  label: Get started
  url: docs/install/
  style: primary

Write internal links as site paths without a leading slash, such as docs/install/; the theme adds the language prefix, so the same link reaches /zh/docs/install/ from the Chinese home page. To add a section, append its name to sections and give it a key of the same name; to reorder the page, reorder the list. The section types table lists everything available.

Where the data lives

The home page’s content file holds only its title and description:

content/_index.md
---
title: Acme DB
description: An open-source time-series database
---

The sections live in one data file per language:

home page data

  • data/
    • home/
      • en.yamlEnglish home page
      • zh.yamlChinese home page

For each language the theme reads data/home/<language>.yaml, falls back to data/home/en.yaml, and on a single-language site accepts a plain data/home.yaml.

Each file has two levels: the sections list, and the keys it names. A section normally reads the key that matches its type; give it a key to read another, which is how one page shows two card grids:

data/home/en.yaml
sections:
  - hero          # reads hero:
  - cards         # reads cards:
  - type: cards   # a second card grid, reading release:
    key: release
  - cta

hero: { … }
cards: { … }
release: { … }
cta: { … }

Section entries

An entry in sections is either a type name or a map:

Key What it does
type The section type. If omitted, key is used as the type
key The top-level key that holds the data. Defaults to the type name; use it to tell two sections of the same type apart
data The section’s data inline, instead of under a top-level key
id The section’s anchor ID, generated from key or type by default
enabled: false Hides the section and keeps its data
partial Renders the data with one of the site’s own partials. This ties the data to your templates, so it no longer moves between sites

Type names use hyphens (logo-wall); underscores are accepted and normalized. A misspelled type warns with unknown section type and the section is skipped. A home page migrated from Docsy’s blocks/* shortcodes has to be rebuilt this way; see Migrating from Docsy.

Hero

The hero is the first screen, and the only section with a large title and an illustration:

data/home/en.yaml
hero:
  eyebrow: Acme DB 3.0 · Open source         # small text above the title, with a status dot
  title_lines:                               # the large title, one entry per line
    - words:
        - { text: Acme DB }
  lead: One sentence saying what this is.    # inline Markdown and <br> allowed
  note: Runs on a single binary              # a supplementary line with an icon
  note_icon: fa-solid fa-circle-check
  title_size: 4.25rem                        # rem, em or px only
  image:
    light: images/hero-light.webp
    dark: images/hero-dark.webp              # with only one, both modes use it
    alt: Query latency dashboard
  media:
    ratio: '1fr 240px'                       # column widths of text and image
    max_width: 240px
    hide_below: md                           # hide the image below sm | md | lg | xl
  actions:
    - { label: Get started, url: docs/install/, icon: fa-solid fa-rocket, style: primary }
    - { label: GitHub, url: 'https://github.com/example/acme-db', external: true, style: ghost }
  detail: { label: See a live demo, url: docs/demo/ }

An image path names a file under the site’s static/ or assets/; the example expects static/images/hero-light.webp and static/images/hero-dark.webp. The image is a CSS background: with alt its container is announced as an image with that label, and without alt it is hidden from assistive technology. Without title_lines the hero shows title, and without either it shows the site title.

align: center gives a text-only first screen, as in the Starter: the text block widens and centers, title lines are balanced, and note moves below the buttons. A centered hero cannot hold an image, so when both are present the theme warns and keeps start alignment and the image.

Section types

There are 22 section types. Every type except hero accepts the same heading fields, eyebrow, title and desc (or text), plus a class for your own CSS.

Type What it holds
hero The first screen: large title, buttons, an image that follows light and dark mode
metrics Numeric facts, with optional count animation and source links
capabilities Capabilities described one per row, alternating sides, each with a visual panel
principles Numbered product principles
cards A general card grid: features, use cases, entry points
logo-wall Tools and partners, as a grid or a pure-CSS marquee
gallery A wall of screenshots
testimonials Quotations with attribution
contributors People, roles, avatars and links
faq Questions and answers, collapsible or flat
markdown Free Markdown content
cta The closing call to action
pricing Pricing tier cards
pricing-compare A tier-by-feature comparison matrix
command-box One copyable command
steps An ordered procedure, optionally with commands
timeline Dated milestones
code-plate Code inside a presentation panel
preview Markdown source beside its rendered result
case-study A case: metrics, a quotation and its source
download One or more data/download/ records
bar-chart Numeric comparison drawn without chart JavaScript

Common sections

cards sets its column count with columns:

data/home/en.yaml
cards:
  title: Use cases
  columns: 4
  link_label: Learn more
  items:
    - title: Monitoring
      meta: Metrics
      icon: fa-solid fa-chart-line
      desc: Keep a year of per-second metrics queryable in milliseconds.
      url: docs/use-cases/monitoring/

capabilities gives each capability a row of its own with a visual panel beside it. visual.type is one of shell, components, code, image or card. In a components panel, items with url become links, and items with preset become in-place style switchers whenever params.ui.preset_menu offers that preset:

data/home/en.yaml
capabilities:
  eyebrow: Why Acme DB
  title: Built for data that only grows
  items:
    - ref: 01 / Operations
      title: One binary, no cluster to babysit
      url: docs/install/
      motto: From the first install to the hundredth upgrade
      bullets:
        - 'Rolling [upgrades](docs/upgrade/) without downtime'
        - 'Built-in [backups](docs/backup/) and point-in-time recovery'
      value: Teams spend their time on queries, not on the database.
      visual:
        type: code
        title: install.sh
        lines:
          - { class: c, prefix: '# ', text: One command, one running server }
          - { class: p, prefix: '$ ', text: acme-db start --data ./data }
          - { class: ok, prefix: '✓ ', text: listening on :5433 }
Minimal YAML for eleven more sections
metrics:
  title: Facts
  animate: true
  items:
    - { value: 2189, compact: true, label: Stars, source: { label: Local CI data, url: 'https://example.org/' } }
    - { value: 32, suffix: '+', label: Languages }

command-box:
  title: Install
  code: hugo mod get github.com/pgsty/oink
  lang: bash
  note: The copy button comes from the on-demand landing runtime.

steps:
  title: Three steps to publish
  items:
    - { title: Clone, desc: Copy the documentation site repository. }
    - { title: Configure, desc: Change three settings., cmd: { code: hugo server } }
    - { title: Publish, desc: Push to GitHub Pages. }

timeline:
  title: Project history
  items:
    - { date: '2024', title: Prototype, desc: The first data-driven sections. }
    - { date: '2026', title: Scenario components, desc: Landing becomes a reusable shell. }

code-plate:
  title: Page configuration
  aria_label: Example configuration
  lang: yaml
  code: |
    layout: landing
    landing: pricing

preview:
  title: What you write is what you get
  file: guide.md            # the filename in the source panel header, default page.md
  source: |                 # the right side renders this Markdown with the site's own hooks
    > [!TIP] Markdown only
    > Callouts, steps and tabs are all ordinary syntax.

    1. Write Markdown
    2. Run `hugo`
    {.steps}

case-study:
  title: Migration outcome
  stats:
    - { value: 12, label: Reusable sections }
    - { value: 0, label: Remote requests }
  quote: "One YAML file replaced a bespoke page template."
  source: A site maintainer

pricing:
  title: Pricing
  tiers:
    - name: Community
      price: Free
      period: forever
      desc: The full open-source capability.
      features: [Every component, Community support]
      cta: { label: Download, url: docs/start/ }
    - name: Professional
      featured: true
      price: $3.4K
      period: /year
      features: [Priority response, Release packages]
      cta: { label: Contact us, url: 'mailto:example@example.org' }

pricing-compare:
  title: Tier comparison
  tiers: [Community, Professional]
  groups:
    - name: Support
      rows:
        - { name: Priority response, cells: [N, Y] }
        - { name: Annual fee, price_row: true, cells: [Free, $3.4K] }

download:
  title: Download
  keys: [prd5]

bar-chart:
  title: Build time
  unit: seconds
  items:
    - { label: Cold build, value: 12.3, group: cold }
    - { label: Warm cache, value: 1.6, group: warm, note: A repeat build on the same machine. }

The download section reads the same data/download/<key>.yaml records as Releases and downloads, so a version number is written once for both.

Landing pages

A pricing page, a product overview or an event page can use the same sections as the home page. Two front matter lines turn an ordinary page into a full-width landing page that keeps the navbar, the command palette and the footer and drops the sidebar and outline:

content/pricing.md
---
title: Pricing
layout: landing
landing: pricing
---

landing: pricing names the data, which sits beside the home page’s and is split by language the same way:

landing page data

  • data/
    • landing/
      • pricing/
        • en.yaml
        • zh.yaml

A single data/landing/pricing.yaml also works: with sections at its top level it serves every language, and with one map per language code it works like the directory form. For a language tagged zh-cn, the theme tries zh-cn, then zh, then en. When it finds nothing, the page warns and renders the landing shell without sections.

A page with only a section or two can write them in its front matter instead, each with its data inline. Use either landing: or sections:, not both; with both, the theme warns and uses the inline sections.

content/pricing.md
---
title: Pricing
layout: landing
sections:
  - type: hero
    data:
      title: Acme DB Cloud, priced per node
      actions:
        - { label: Read the docs, url: docs/, style: primary }
  - type: cta
    data:
      title: Ready to start?
      label: Read the docs
      url: docs/
---

Landing pages show the search button and command palette when the site has local search on. To leave search off landing pages other than the home page, set params.ui.landing_search: false.

Languages and local facts

Put each language’s text in its own file (en.yaml, zh.yaml). A record that is mostly shared facts, such as a pricing tier, can instead carry per-language fields: the theme reads <field>_<language>, then <field>_<base language>, then <field>, with - in the language tag written as _. A page in zh-cn therefore reads title_zh_cn, then title_zh, then title. CamelCase suffixes are not recognized.

Section text is site data and does not go through the theme’s interface strings; only the theme’s own controls, such as the marquee’s pause button and pricing states, are translated by the theme. For the rest of a multilingual setup, see Languages.

No section fetches anything in the browser: prices, star counts, screenshots, avatars and download states must all be in the repository when Hugo runs. The same holds for the two navbar facts you can set in hugo.yml:

hugo.yml
params:
  ui:
    github_stars: 2189            # shown on the GitHub link; never fetched from GitHub
    alt_site: { label: 中文站, url: 'https://example.cn/' }  # sister-site link on a single-language site

The footer has its own data, data/footer/<language>.yaml or data/footer.yaml on a single-language site; see Navigation and menus. A footer key left in data/home/<language>.yaml is ignored with a warning that names the new location.

Output

  • HTML: every section rendered on the server, plus landing.js, loaded only when needed, for reveal effects, counters, copy buttons and light/dark image switching.
  • Print: the content, with moving parts such as the marquee laid out as a static grid and controls removed.
  • Markdown: titles, prose, lists, tables and code, without component classes.
  • RSS: no landing sections.

Without JavaScript, or if landing.js fails to load, every section is still visible: metrics already show their final formatted value, prefix and suffix, and the marquee’s pause control works without script. Readers who ask for reduced motion get no movement or reveal effects.

Verify

  1. Run hugo --printPathWarnings. Misspelled types, missing data keys and a page with both landing and sections are reported here.
  2. Open the home page and each landing page in every language, and compare the sections with their data files.
  3. Reload with JavaScript disabled; the content stays, only the motion goes.
  4. Switch between light and dark mode and check that image.light and image.dark each appear in the right one.
  5. On a site deployed under a subpath, check that internal links and images carry the prefix.

5.4 - Navigation and menus

Configure the navbar menu, dropdowns, section switcher, breadcrumbs, page actions, pager, and footer links.

The menu across the top of every page is the map of your site: the handful of places, such as Docs, Blog and Download, that a reader should reach from anywhere. You write it once per language in hugo.yml. The other ways of moving around (the section switcher at the top of the sidebar, breadcrumbs, previous and next links, backlinks) follow from your content tree, so you adjust them rather than build them. The sidebar tree and the page outline are covered in Layouts and page types.

The navbar menu

Top-level entries go in each language’s menus.main:

hugo.yml
languages:
  en:
    menus:
      main:
        - identifier: docs
          name: Docs
          pageRef: /docs
          weight: 20
        - identifier: blog
          name: Blog
          pageRef: /blog
          weight: 50
        - identifier: download
          name: Download
          pageRef: /download
          weight: 60
          params:
            icon: fa-solid fa-download

Entries appear in ascending weight. Point at your own pages with pageRef, so that Hugo resolves the page in each language and marks the entry active on every page beneath it, and use url for anything else. An external url opens in a new tab with rel="noopener noreferrer" and carries an external-link mark. Translate name in every language but keep identifier the same, because other settings refer to entries by it: params.ui.quick_links picks command palette quick links by identifier, and the default icon is matched against it.

A page can also add itself to the menu from its front matter, which is handy when the page itself is the top-level destination:

content/download/_index.md
---
title: Download
menu:
  main:
    weight: 30
---

The GitHub button at the right end of the navbar is not a menu entry, and a menu entry with the identifier github is skipped. The button links to params.github_project_repo, or to params.github_repo when that is unset, so change those to change it; see Repository links and page info.

Dropdowns

Give an entry a parent to place it in that entry’s dropdown panel:

hugo.yml
menus:
  main:
    - identifier: docs
      name: Docs
      pageRef: /docs
      weight: 20
    - identifier: docs-start
      parent: docs
      name: Get started
      pageRef: /docs/start
      weight: 10
      params:
        icon: fa-solid fa-rocket
    - identifier: docs-components
      parent: docs
      name: Components
      pageRef: /docs/components
      weight: 20
      params:
        icon: fa-solid fa-cubes

The panel is a single column with one icon and one name per row; it does not display a child’s params.description, and a params.columns setting is ignored with a build warning. The parent stays an ordinary link: hovering or focusing it opens the panel, while clicking it or pressing Enter opens the parent page. Touch readers therefore go straight to that page, so it should link to the same children, as a section index does by itself. With the keyboard, ↓ opens the panel and focuses its first item, and Esc closes it and returns focus to the parent; clicking outside also closes it.

Dropdowns go one level deep. A grandchild entry is rendered as a plain group heading inside the panel, not as a third-level flyout, and the build warns only one interactive child level is supported. Put deeper structure in the sidebar.

Menu icons

Below the lg breakpoint the navbar shows each top-level entry as its icon alone, so give every top-level entry one. An entry’s icon is the first of:

  1. the menu entry’s own params.icon;
  2. icon in the target page’s front matter;
  3. a built-in default matched against the identifier, the target’s section or the first segment of its URL (docs, guide, blog, news, examples, community, about, download, github);
  4. fa-solid fa-link.

An icon is one Font Awesome class pair; the theme ships the free icon set, so nothing is downloaded. Setting params.icon to false or "none" removes the icon, and the entry then keeps its text label at every width:

hugo.yml
menus:
  main:
    - identifier: handbook
      name: Operations handbook
      pageRef: /handbook
      weight: 40
      params:
        icon: false

Taxonomy menus

A top-level entry that points at a taxonomy list page such as /tags/ needs no children: its panel fills itself with the taxonomy’s terms and their page counts, most-used first. The entry is written like any other; see The taxonomy panel in the navbar.

Navbar controls

The 50px navbar holds the brand logo or wordmark at the start, the menu in the middle, and utility controls at the end. It adapts to the viewport in three tiers:

Viewport State
lg and above Brand, menu labels, and the search, version, language, appearance and GitHub controls. No drawer button
md to below lg Menu icons in the middle, utility controls at the end. No drawer button
Below md Menu icons in the middle; only search and a drawer button at the end. Version, language, appearance and keyboard help move to the footer’s bottom bar

The drawer button opens the sidebar on pages that have one, and a site menu on Home and Landing pages.

Menu entries never wrap onto a second line. When the brand, a fixed desktop sidebar and the utility controls leave too little room, entries with icons collapse to their icons first, while entries with params.icon: false keep their labels; whatever still does not fit folds into a trailing … panel that shows each entry’s icon, name and children.

Each utility control appears once its feature is configured: search with params.offline_search (Search), the version menu with params.versions (Versions), the language menu with two or more languages (Languages), and the appearance menu when the site offers a color-mode or preset choice (Brand and appearance).

Auto-hide

On long pages you can give the navbar’s space back to the content:

hugo.yml
params:
  ui:
    navbar_autohide: true

The hidden navbar keeps its 50px band, so nothing below it moves. Pointing into the upper 60% of that band, or tabbing into the navbar, fades it back in place without covering the page. The wake zone leaves out 64px at each side, so the buttons that restore a collapsed sidebar or outline stay clickable.

Auto-hide stays off below 768px and on coarse-pointer or touch-only devices, where the navbar is always visible. Home ignores the site setting unless its own front matter turns it on, and hero pages keep their overlay navbar, which scrolls away with the hero. A top-level navbar_autohide in page front matter or a section cascade overrides the site setting.

Turning the navbar off

For pages that need the whole viewport, such as a full-screen report or an embedded application, turn the navbar off for the site:

hugo.yml
params:
  ui:
    navbar_enabled: false

or for one page or section:

content/docs/_index.md
---
title: Docs
cascade:
  navbar_enabled: false
---

Without the navbar, the theme moves its essentials elsewhere: a mobile subnavigation, a brand and search row at the top of the sidebar, and the utility buttons on the outline rail. Readers lose the site menu, though, so reserve this for pages that need it rather than using it as a style choice.

The section switcher

The row at the top of the sidebar switches between whole trees: Docs, Blog, a Book, or any large subtree you promote to a root of its own. It lists every top-level section, then every section marked sidebar_root_for: self, without duplicates, and adds the root the reader is currently in when it is not already listed. Sections without a permalink (build.render: never) and divider groups never appear. With no entries the switcher is absent, with one it is a plain link, and with two or more it is a dropdown.

hugo.yml
params:
  ui:
    sidebar_root_enabled: true
    sidebar_root_menu: true

Both default to true. sidebar_root_menu: false removes the switcher. sidebar_root_enabled: false ignores sidebar_root_for, so every page shows the tree of its top-level section.

To make a large subtree, such as a versioned API reference or a self-contained handbook, a root of its own, mark its _index.md:

content/docs/api-v2/_index.md
---
title: API reference v2
sidebar_root_for: self
sidebar_root_link_self: true
---

With self, the section index and everything below it use the new tree; with children, the index stays in its parent’s tree and only its descendants switch. sidebar_root_link_self (default true) points the link at the top of the new tree to the section’s own index; set it to false to point that link at the parent section instead. The switcher picks the tree, and that root link opens a page in it.

To keep a top-level section or a self root out of the switcher, set sidebar_root_menu: false in its front matter. While a reader is inside that section, it still appears in the switcher to mark where they are.

Breadcrumbs and page actions

Above each page title, a breadcrumb shows where the page sits, using the localized linkTitle of each ancestor in the same hierarchy as the sidebar. The page action menu sits at the right end of the same row. A top-level section leaves out the one-item breadcrumb that would only repeat its title, and the action menu keeps its place. Blog pages show no breadcrumb by default, because a post reads as a standalone piece; set breadcrumb in front matter or a cascade to change that for a page or section, or turn breadcrumbs off for the whole site:

hugo.yml
params:
  ui:
    breadcrumb: false

The page action menu

The split button at the end of the title row gives readers what they can do with the page: take its content elsewhere, or change it at the source. Its left half copies the page’s Markdown and shows a green check mark when the copy succeeds; the arrow opens the full menu. Each entry appears only when the site can serve it, and each has a stable action ID that the command palette and custom CSS use:

Entry Action ID Appears when
Copy Markdown copy_markdown The page has the markdown output format
Open in ChatGPT open_chatgpt page_context_menu.assistant_links: true
Open in Claude open_claude page_context_menu.assistant_links: true
View markdown view_markdown The page has the markdown output format
View edit history view_history params.github_repo is set and the page’s source path resolves
Edit this page edit_page The same
Create child page create_child_page The same
Create docs issue create_issue params.github_repo is set
Create project issue create_project_issue params.github_project_repo is set
Print entire section print_section The section has the print output format
hugo.yml
params:
  ui:
    page_context_menu:
      enable: true
      assistant_links: false
      links: []

page_context_menu: false, for the site or in a page’s front matter, removes the button; the same actions stay in the command palette. The assistant entries are off by default because clicking one sends the page’s full URL, query and fragment included, to that third party. A page can switch them off but cannot switch them on when the site has not; AI-agent support covers the prompt they send and what to put in your privacy statement.

links adds your own external actions at the end of the menu. In url, {url} is the page’s full address, {title} its title and {markdown_url} the address of its Markdown version, each URL-encoded:

hugo.yml
params:
  ui:
    page_context_menu:
      links:
        - name: Ask the internal assistant
          icon: fa-solid fa-wand-magic-sparkles
          url: https://assistant.example.com/new?source={markdown_url}&title={title}

On the blog root and its first-level sections the left half is an RSS subscription link instead, and Copy Markdown moves into the menu. A page without Markdown output has no left half, and the arrow becomes a labeled “Actions” button.

The pager

Two text links at the end of the body lead to the previous and next page in the order of the visible sidebar tree, from the root page down to the last page. The root has no previous link and the last page no next link. When the site supplies data/docs_nav.json, that tree orders the pager and the section indexes it declares, so the sidebar, the pager and the index list children in the same order; other sections follow the content tree.

hugo.yml
params:
  ui:
    pager_types: [docs, book, blog]

pager_types accepts only docs, book and blog; any other value warns and is dropped. To remove the pager from one page:

content/docs/appendix.md
---
title: Appendix
pager: false
---

The same order goes into the page’s <head> as <link rel="prev"> and <link rel="next">, so browsers and crawlers can follow the reading sequence:

page source
<link rel="prev" href="/docs/customize/home/">
<link rel="next" href="/docs/customize/layout/">

Only HTML pages carry the pager and these links; print, Markdown and RSS output have neither. The pager is one of the blocks at the end of a page, which appear in a fixed order; see What the page end is made of.

Backlinks list the pages that link to the current one, so a reader who lands from search sees which pages consider it worth pointing to and where it sits in the rest of the site. They are off until you turn them on:

hugo.yml
params:
  ui:
    backlinks: true

A page overrides the setting with backlinks in its front matter, and a section passes it down with a cascade:

content/docs/_index.md
---
title: Docs
cascade:
  backlinks: true
---

The list appears in the right rail as an expanded “Backlinks” group, below the outline and above the taxonomy clouds; below xl it moves into the sidebar drawer with the outline. The first eight entries are visible and the rest sit behind a native “Show N more” disclosure, and hovering an entry shows its source page’s description. A page that nothing links to has no backlinks block at all, heading included. A non-boolean value warns and counts as off.

Hugo builds the list at build time from the ordinary Markdown links and ref / relref shortcodes you already write, so there is no new syntax and no JavaScript. Links inside code are ignored, as are self links, external links, mailto: and same-page anchors; several links to one page count once, and a fragment is ignored when matching the target. Each language has its own list, so a Chinese page never appears under an English one, and entries are sorted by page path, so the same content always gives the same order.

URLs in custom shortcode parameters or raw <a href> elements are not counted, and links that do not resolve are dropped silently. Backlinks help readers navigate; keep running a link checker to find broken links.

The page’s Markdown output carries the same list after a “Backlinks:” line; RSS and the print view leave it out. This site enables backlinks everywhere, so the right rail of this page shows a live example, and Configuration lists more than forty, most of them behind the disclosure.

params.ui.footer_style chooses fat, slim or none; see Brand and appearance. The link grid of the fat footer comes from data/footer/<language>.yaml, not from a menu (the theme has no menus.footer):

data/footer/en.yaml
brand:
  name: Product Docs
  tagline: A short description that **supports Markdown**.
  slogan: Close to the product, with clear answers.
columns:
  - title: Docs
    links:
      - { label: Get started, url: /docs/start/ }
      - { label: Components, url: /docs/components/ }
  - title: Project
    links:
      - { label: GitHub, url: https://github.com/pgsty/oink, external: true }
      - { label: Releases, url: /blog/release/ }
  • Without brand.name and brand.logo, the footer uses the site’s own brand name, logo and wordmark. tagline and slogan render Markdown.
  • An internal url resolves against the current language root. external: true opens the link in a new tab with rel="noopener noreferrer".
  • The grid has as many columns as the data has.
  • A single-language site can use data/footer.yaml.
  • A fat footer with no data falls back to slim, so you can switch it on before writing the data.

An arrow at the end of the fat footer’s copyright row collapses and restores the link grid. The grid starts expanded, and the reader’s choice is kept in localStorage under td-footer-collapsed across pages; it is independent of Zen Mode. slim and none have no such arrow.

The footer’s bottom bar ends with an icon dock holding, in order, the version, language, appearance and keyboard-help controls, followed by the fat footer’s collapse arrow. Their menus open upward. Hovering keyboard help previews the full three-column shortcuts sheet above the footer, and clicking it opens the centered modal dialog. The version button shows only an icon, while its choices keep their full labels. The sidebar does not repeat these controls, and footer_style: none removes the bottom bar together with the footer.

The copyright row and the note in its center are set in Configuration.

Verify

Build, then check the warnings and the rendered navigation:

hugo --printPathWarnings
  • No build warning says only one interactive child level is supported; if one does, a menu is nested three levels deep.
  • On desktop, hovering a parent opens its panel, clicking it opens its page, and Esc closes the panel.
  • Below lg, every top-level entry shows an icon; an entry without one is blank at that width.
  • Below md, the Home and Landing navbars keep only search and the drawer button at the end, and version, language, appearance and keyboard help are in the footer’s bottom bar.
  • The switcher at the top of the sidebar lists every top-level section and marks the current one.
  • On a documentation page, E / Q page through the sidebar order, and the page source has the matching rel="prev" / rel="next".
  • With backlinks on, grep td-backlinks public/<a page that is linked to>/index.html finds the block, and a page nothing links to has none.
  • The page action menu shows the entries you expect and nothing else; for example, Create project issue is absent without github_project_repo.

5.5 - Layouts and page types

Choose which shell a page renders in, and tune its sidebar, table of contents, section index and page width.

Every page renders in a shell: the reading shell, with a sidebar on the left and an outline on the right, or a plain single column. The page’s type chooses the shell, not the folder it lives in, so documentation can sit anywhere under content/. To give an operations handbook in content/handbook/ the documentation shell, set the type on its section and cascade it to every page below:

content/handbook/_index.md
---
title: Operations handbook
type: docs
cascade:
  type: docs
---

Where content goes and how the sidebar tree follows the folders is covered in Organizing content; this page covers the shell around it.

Shell types

type Shell
docs The reading shell: left sidebar with section switcher and page tree, the body, and the outline on the right
book The reading shell, plus numbered chapters, figures and tables, the reading_width measure and an optional draft banner
blog The reading shell, with blog sections expanded in the sidebar and the breadcrumb off; on blog index pages the page-action button leads with RSS
swagger The reading shell, with Swagger UI or Redoc rendering the body. See API reference pages
expo The shared sidebar and a full-width image album, without the outline. See Expo albums
Any other type A plain page: navbar, a single-column body and the footer, with no sidebar

Taxonomy and term pages, such as /tags/, also use the reading shell.

params.ui.shell_types lists the types that get the reading shell’s behavior; its default is the five types above:

hugo.yml
params:
  ui:
    shell_types: [docs, book, blog, swagger, expo]

If you override the list, keep those five in it, because the theme loads the shell’s scripts only for listed types. Listing a type of your own switches the shell’s behavior on for it but does not draw a sidebar unless your own templates for that type do; to make a section read like documentation, give it type: docs as above.

Section roots

hugo.yml
params:
  ui:
    docs_section: docs
    blog_section: blog

These keys name the top folders of the documentation and the blog. The theme uses them to find sidebar roots, the command palette’s quick links and default icons, but they do not choose the shell: the handbook above gets the documentation shell while docs_section stays docs.

A docs page’s sidebar normally starts at the documentation section. To start it at the site home instead, so it shows every top-level section:

hugo.yml
params:
  ui:
    docs_sidebar_root: home # home | section

Any other value warns and uses section.

Documentation at the site root

A site that is mostly documentation can serve it from the URL root, as /install/ rather than /docs/install/, while the source stays in content/docs/. It takes three changes, made together.

First, drop the docs/ segment from URLs with Hugo’s own permalinks:

hugo.yml
permalinks:
  page:
    docs: /:sections[1:]/:slug/
  section:
    docs: /:sections[1:]

Second, stop each language’s site root index (content/_index.md, content/_index.zh.md, …) from rendering, so it no longer competes with the docs section for the same output path while remaining a valid link target:

content/_index.md
---
title: Product Docs
build: { render: link }
---

Third, root the sidebar at the site home, so the sidebar and the previous/next links walk one tree:

hugo.yml
params:
  ui:
    sidebar_root_enabled: true
    docs_sidebar_root: home

With docs_sidebar_root: home, every top-level section joins that tree. Take out the ones that are not part of the reading order, such as the blog, a community page or downloads, with toc_root: true in their _index.md; they then appear neither in the tree nor in the paging order:

content/blog/_index.md
---
title: Blog
toc_root: true
---

The documentation now shares the URL root with every other section, so build with --printPathWarnings and resolve any duplicate target before you publish.

Landing pages

A page with layout: landing gets neither shell: it keeps the navbar and footer and fills the width between them with sections such as a hero, cards and pricing. See Home and landing pages.

Sidebar

The sidebar mirrors the folders under content/, ordered by weight and labeled with linkTitle where a page has one. These settings, shown with their defaults, tune how much of the tree is open and how wide it is:

hugo.yml
params:
  ui:
    sidebar_menu_compact: true
    sidebar_menu_foldable: true
    sidebar_menu_truncate: 2000
    sidebar_width_min: 220
    sidebar_width_max: 480
    sidebar_item_overflow: ellipsis # ellipsis | wrap
    sidebar_expand_levels: 2
  • sidebar_menu_compact opens only the branch of the current page and its neighbors; false opens the whole tree.
  • sidebar_menu_foldable lets readers open and close sections. Blog sections start open; set sidebar_expanded: false in a section’s _index.md to start it closed.
  • sidebar_expand_levels is how many levels are open by default.
  • sidebar_menu_truncate caps the entries rendered per section, which keeps the HTML of a thousand-page tree usable. When a section is cut, a build warning names it and the value it needs.
  • sidebar_width_min and sidebar_width_max bound the width, in pixels, that readers can drag the sidebar to on desktop. Double-clicking the divider restores the default.
  • sidebar_item_overflow: ellipsis cuts long titles short; wrap suits a site with many long titles, such as Chinese ones.

Each reader’s open sections, sidebar width and scroll position are kept in the browser, separately for each language. Below the md breakpoint the sidebar becomes a drawer with a backdrop.

On a large site, rendering every page’s sidebar separately slows the build. Once the site reaches params.ui.sidebar_cache_limit pages (500 by default), pages with the same effective sidebar settings share one cached tree, and the browser marks the current page and opens its ancestors. The shared tree is still complete and navigable without JavaScript. Below the limit, each page’s current position is rendered at build time. A Book page with sidebar_headings on always gets its own tree.

To remove the sidebar from one page:

content/docs/fullscreen-report.md
---
title: Full-screen report
sidebar_enabled: false
---

An explicit navigation tree, data/docs_nav.json

Use an explicit tree when the order of a manual comes from somewhere else, such as a Sphinx toctree you migrated and want to keep; when weight in content/ already gives the order, you do not need this file. The theme uses data/docs_nav.json instead of the folder tree when all three hold:

  • the file exists and has a sections key;
  • the page’s type is docs or book;
  • the page’s resolved sidebar root is not the site home.

The file is a tree of nodes. Each node’s page names a content path and its children are its children in the navigation. The theme resolves links and the current branch from page identity; url and the active_path_by_url ancestor map are optional hints kept for older files:

data/docs_nav.json
{
  "sections": [
    {
      "page": "/docs/start",
      "url": "/docs/start/",
      "children": [{ "page": "/docs/start/install", "url": "/docs/start/install/" }]
    }
  ],
  "active_path_by_url": {
    "/docs/start/install/": ["/docs/start/"]
  }
}

Write paths without a language prefix and without the deployment subpath from baseURL. The theme strips both before comparing, so /docs/start/ matches /zh/docs/start/ and /handbook/zh/docs/start/, and rendered links keep the real prefixes.

The tree can also group pages without moving their files. With docs_section: docs and docs_sidebar_root: section, root-level pages of type docs can be arranged like this:

data/docs_nav.json
{
  "sections": [
    { "page": "/intro" },
    { "page": "/config", "children": [{ "page": "/api" }] }
  ]
}

content/config.md and content/api.md stay sibling files, but API appears under Config, and opening API expands Config. A node applies to a sidebar root when it is that root, sits below it in content/, or is a Docs or Book page that resolves to the same root. A custom page URL changes the link, not where the page sits in the sidebar. A separate Book root, or a root nested with sidebar_root_for, uses its own branch, and a root missing from the file keeps its folder tree.

The same tree drives the previous/next links and the navigation JSON, so the pager and the sidebar always agree. An empty sections array warns and falls back to the folder tree, and a page that does not exist warns and is skipped. Placeholder nodes with manual_link and sidebar_divider rows stay in the sidebar without becoming paging targets. A divider section keeps its children here too; use the same group-only front matter as in the folder tree.

Sidebar icon density

A page’s icon front matter shows in the sidebar. An icon on every leaf makes a long tree harder to scan, so you can limit them:

hugo.yml
params:
  ui:
    sidebar_icon_policy: groups # all | groups | none
Value Effect
all (default) Every entry with an icon shows it
groups Only the root and entries with children show icons
none No entry icons in the sidebar

An invalid value warns and uses all. This site uses groups.

Expanding headings in the sidebar

On a long Book chapter, readers can jump between sections from the sidebar when the current page’s h2–h4 headings appear as a branch under its row. The branch is off by default; turn it on with:

hugo.yml
params:
  ui:
    sidebar_headings: 3 # false | true | 2 | 3 | 4

An integer from 2 to 4 is the deepest level shown, true means 2 (h2 only), and false turns the branch off; any other value warns and turns it off. It applies only to type: book pages and only under the current page’s row, and the outline on the right stays. Front matter or a section cascade can set the same key, and sidebar_headings: false turns off an inherited setting.

Table of contents

The outline on the right lists the page’s Markdown headings. Which levels it collects is Hugo’s own setting:

hugo.yml
markup:
  tableOfContents:
    startLevel: 2
    endLevel: 4
    ordered: false

The outline always follows the reader: a continuous rail marks the current section as the page scrolls, with no setting to turn on. Readers can collapse the right column, and the browser remembers it. Below the xl breakpoint the column hides and the outline moves into the sidebar drawer. An older configuration may still set params.ui.scroll_spy or a page-level scroll_spy; both are accepted and ignored.

To hide the outline on one page, set notoc: true in its front matter.

Only headings that reach Hugo’s table of contents appear. Headings produced by Markdown-style shortcodes ({{%/* … */%}}) do; headings inside ordinary shortcodes ({{</* … */>}}) usually do not, so write structural headings in Markdown.

Section index style

A section with an _index.md lists its child pages automatically, either as a list or as cards:

hugo.yml
params:
  ui:
    section_index: cards # list | cards
    section_index_columns: 2
  • list (default): each child’s title, then its description.
  • cards: a grid of cards showing each child’s title (or linkTitle), description and icon; section_index_columns (default 2) sets the columns.

A section can choose its own style in its front matter. An invalid value warns and uses the default:

content/docs/components/_index.md
---
title: Components
section_index: cards
section_index_columns: 3
---

no_list: true lists no children, simple_list: true lists them as plain bullets without descriptions, and a child with hide_summary: true leaves itself out. Let the theme build these lists rather than writing them by hand, because a hand-written list drifts out of step with the sidebar.

Page width

hugo.yml
params:
  page_width: normal # normal | wide | full

normal is a comfortable reading width, wide widens the content column and full fills the window. Set it per page or, through a cascade, per section; wide tables, large images and API references often need wide:

content/docs/api/reference.md
---
title: API reference
page_width: wide
---

Book pages also accept reading_width (slim, normal or wide), which changes the measure of the text without changing the shell. An invalid value for either key warns and uses normal.

Navbar and footer switches

The navbar and footer can be switched per page with top-level front matter keys, not keys under ui. To change a whole section, set them once in its cascade:

content/docs/_index.md
---
title: Docs
cascade:
  navbar_enabled: false
  footer_style: slim
---

What each key does is described in Navigation and menus and Brand and appearance; the full list of keys is in Page parameters.

Verify

hugo --printPathWarnings
  • The build ends with Total in … and reports no ERROR.
  • A new type: docs page has the left sidebar. If not, check that the cascade reaches it and that its type is in shell_types.
  • Dragging the sidebar divider and reloading keeps the width; double-clicking restores the default.
  • Below md the sidebar is a drawer you can close, and below xl the outline sits in that drawer.
  • A section index shows as many entries as the sidebar has child pages.
  • A page with page_width: wide is wider than its neighbors.
  • With documentation at the site root, the build reports no duplicate output paths.

5.6 - Search

Add full-text search that runs in the reader’s browser, and control what it indexes and how it ranks results.

OINK’s search runs entirely in the reader’s browser. Hugo writes one JSON index per language at build time, the browser downloads it on the first search, and every query is answered locally, so there is no crawler, account, CDN or search service to set up, and queries never leave the page. Search is off by default; one line turns it on.

Readers search from the command palette; Command palette covers how they open it and what else it offers.

Turning on local search

hugo.yml
params:
  offline_search: true

Search then appears on the home page, on every page with a shell layout (docs, book, blog, swagger or expo; see Layouts and page types), and on landing pages while params.ui.landing_search is on. Print output never carries it. Other pages get no search dialog, index reference or engine at all: these are not hidden, they are never generated.

hugo server builds the index too, so the preview searches exactly like production. On a very large site, rebuilding the whole index slows every preview noticeably, and you can skip it during preview:

hugo.yml
params:
  offline_search: true
  # skip index building during preview; only needed on very large sites
  offline_search_on_serve: false

Controlling index size

offline_search_index decides how much of each page goes into the index. That is a trade between what readers can find and how much their browser downloads on the first search:

hugo.yml
params:
  offline_search: true
  offline_search_index: summary
  offline_search_summary_length: 70
  offline_search_max_results: 10
Value What is indexed When to use it
title Title, tags, categories, search_keywords A very large site where titles alone locate a page
heading The above plus every heading in the page When headings are specific enough
summary The above plus description and summary Sites with thousands of pages. This site uses it
content The above plus the full plain text The default, suitable up to a few hundred pages

offline_search_summary_length sets the length, in characters, of the excerpt stored for each page (default 70), which a result shows when no passage matches. offline_search_max_results caps the page results of one search (default 10). Configuration has the full definitions.

A large content index does not delay the first search. While a language’s index stays within 2 MiB, it is published as one file. Above that, the build moves page text into a second file, offline-search-body.<lang>.json, so the first download holds only titles, headings, field entries, descriptions and keywords, and the palette answers from those at once. It then fetches the page text in the background when that file is 8 MiB or smaller, or waits for the reader to choose Search page text when it is larger or the browser asks to save data (Save-Data). To leave page text out altogether, use summary.

Adjusting ranking

A page can help readers find it through its own front matter:

content/docs/reference/pgsql.md
---
title: PostgreSQL parameters
search_keywords: [postgres, postgresql, pg, database parameters, GUC]
search_boost: 1.5
---

search_keywords adds the words readers type that the page itself may never use, as a string or a list. It usually helps more than a boost: a reader who types pg or GUC now finds a page titled only “PostgreSQL parameters”. Keywords rank just below the title and above the body.

search_boost multiplies a page’s score, both its field strength and its section BM25 score, and defaults to 1.0. A value of 1.5 lifts a page without ever letting a partial match beat a complete one. Zero, negative and non-numeric values warn and count as 1.0.

Set a default for a whole section once with a cascade; a page’s own value still wins over the inherited one:

content/docs/_index.md
---
title: Docs
cascade:
  search_boost: 1.25
---

On this site, every page under docs/ lists its Chinese phrasing, its English terms and the configuration keys it documents in search_keywords.

Keeping a page out of the index

content/internal/draft-plan.md
---
title: Internal plan
search_exclude: true
---

The index also leaves out pages with an empty body. Only search_exclude works: the retired exclude_search and excludeSearch keys are ignored, so a page that still uses them stays searchable; the migration checker reports them.

The index is a static JSON file anyone can download; it is not access control.

Do not put content that should stay private on the site, and do not use search_exclude to protect it.

Chinese, mixed queries, and identifiers

The engine scores the downloaded index with BM25 as it scans it, and builds no index of its own in the browser. It splits text by each character’s Unicode script rather than by the page’s language, so one query can mix English, Chinese and code identifiers:

  • Unspaced CJK queries. Runs of Chinese, Japanese and Korean match through overlapping character pairs, with no dictionary, so 数据库连接池超时 or PostgreSQL备份 works without spaces. A single CJK character stays one term, and a boundary between CJK and Latin text splits automatically. search_keywords is still the place for synonyms and abbreviations.
  • Identifiers and symbol runs. Names with underscores, hyphens or dots, paths, command options and runs of two or more symbols (shared_buffers, pg_basebackup, --baseURL, /pg/data, ->>) match literally and are never spelling-corrected.
  • Word boundaries, stemming and typos. Ordinary words match whole words exactly, so port does not match support. Loose matches count for 0.7 of the field’s weight: the prefix of a longer word, a Porter inflection of an ASCII word, a four-character stem in other alphabets, a word of five or more characters inside an underscore name or compound, and a spelling correction. Spelling correction applies only to ASCII words of five or more characters that appear in no form in the selected scope: one edit for 5–7 characters, two from 8, with a swap of adjacent letters counting as one.
  • Query terms and stop words. Case and Unicode width are normalized, and up to 30 terms of a query take part. A short list of English function words and six Chinese question words (为什么, 如何, 怎么, 怎样, 什么, 请问) score at 0.1 and are not required, unless the query consists of nothing else.

The terms of a query may match in different fields of a page. Results rank by these rules, in order:

  1. A page that covers at least 90% of the query’s weight is a complete match, and complete matches hide partial ones. When there is none, partial matches appear in descending tenths of coverage, labelled with how many terms matched.
  2. Among complete matches, a page whose match fits in one section (plus page-level fields) comes before one whose match spans several sections.
  3. Field strength is the weighted mean of each term’s strongest field (title 10, keywords 8, tags and categories 6, headings and search entries 5, description 3, body 1; loose matches × 0.7), multiplied by 1.5 when the terms appear adjacent and in order, and then by search_boost.
  4. Equal strength is broken by the best section’s BM25 score (k1 = 1.2, b = 0.5) times search_boost, and after that by title and URL.

A boost cannot lift a partial match above a complete one. Results stay grouped by content root in the navbar’s order; the result limit applies first, and the ranking orders each group. A page found only through its keywords shows its description or excerpt, never the keyword list.

Each page takes one result row, however many of its sections match. The row names the best matching section or entry, shows up to 160 characters around the hits with inflections and corrections highlighted as the page spells them, and opens the rendered anchor. Every anchored field, whether from {.fields} or fields/field, carries data-td-search-entry automatically, so searching for a parameter name jumps straight to its definition; your own markup with an id and a non-empty data-td-search-entry works the same way. A match only in page metadata opens the page itself. The heading and summary scopes can still land on headings and field entries, but words that appear only in body text need content.

The palette’s Search in control narrows results to the current top-level section (the home page has none); Command palette describes it. While an input method is composing, results and Enter wait until the text is committed. Empty, loading, unavailable, result-count and partial-match states all have readable text and are announced to screen readers.

Optional: hosted search

The theme also integrates two hosted search services, both off by default. Each sends every query to a third party, so if you enable one, describe its crawling, availability and privacy terms in the site’s privacy statement. A site uses one search backend: when more than one of local search, Algolia and Google is configured, the build warns params: more than one site-search backend is configured.

Algolia DocSearch

hugo.yml
params:
  search:
    algolia:
      appId: YOUR_APP_ID
      apiKey: YOUR_SEARCH_ONLY_KEY
      indexName: YOUR_INDEX

All three values are required, and OINK never falls back to another project’s public index. DocSearch’s script and styles ship with the theme, so nothing loads from a CDN, but every query goes to Algolia. It needs real credentials and an index, so this page shows no live demo.

Google Programmable Search

hugo.yml
params:
  gcs_engine_id: YOUR_ENGINE_ID

Results also need a page of their own:

content/search.md
---
title: Search results
layout: search
---

The search box submits to <baseURL>/search/?q=…, where Google’s script renders the results; the reader’s browser must be able to reach cse.google.com. Because it depends on that service, this page shows no live demo.

Verify

  1. Build, and confirm there is one index per language:

    hugo --printPathWarnings
    ls public/offline-search-index.*

    A development build names the file offline-search-index.zh.json; a production build adds a fingerprint, as in offline-search-index.zh.7ab….json. A missing file means that language’s pages never reached an index.

  2. When Chinese queries find nothing, inspect the index first:

    python3 -c "import glob,json; f=sorted(glob.glob('public/offline-search-index.zh*.json'))[0]; \
      d=json.load(open(f)); print(f, len(d)); print(d[0])"

    The entry count should be close to the number of Chinese pages, and the keywords and boost fields should show what the front matter set.

  3. Open the site and press /. Search for an English word, then a Chinese one. Results are grouped by content root, each group named after the first breadcrumb segment.

  4. For a subpath deployment such as https://example.com/docs/, open the browser’s network panel and check that the index request includes the subpath. An index request to the domain root returns 404 while the page itself works, and this is the most common reason search returns nothing.

  • Command palette — search’s entry point, and the commands and page actions beside it
  • Keyboard navigation — the four single keys that open search and commands
  • Languages — per-language indexes and untranslated fallback
  • Configuration — full definitions of the offline_search* keys
  • Page parameters — search_keywords / search_boost / search_exclude

5.7 - Command palette

Use one dialog for page search, page actions, and site commands. Open the palette, use its groups, and add custom commands.

The command palette provides one modal dialog for page search and site actions. Use it to copy page Markdown, switch language or version, and open site links. The theme assembles it with local search. If params.offline_search is off, the page has no palette, index, or search engine. See Search.

Opening the palette

How to open it What opens
Click the search box in the navbar or sidebar Full search mode
⌘ / Ctrl + K Full search mode. Press again to close
/ Full search mode
\ Command-only mode (equivalent to a prefilled >)
f / c The same two, provided by keyboard navigation
Typing a query beginning with > in the box Command-only mode

On layouts where \ is hard to reach, use c or type > instead.

/, \, f, and c are bare single keys. They do not open the palette during typing. This applies to focus in an input, textarea, select, or contenteditable, and to input-method composition. The keys type ordinary characters instead. The modified ⌘/Ctrl + K can open the palette from a text box. It also remains inactive during input-method composition. Another open native dialog or visible ARIA dialog blocks every opening shortcut, including fixed-position dialogs. Hidden ARIA dialogs do not block them.

Inside the palette, use ↑ ↓ to select an item. Press Enter to run it. Press Esc to close the palette and return focus to the opening control.

What the palette holds

With nothing typed, the palette lists four groups in a fixed order:

Quick links1

A few entry points chosen from the navbar’s top-level menu.

Decided by: params.ui.quick_links.

Page actions2

Copy Markdown, Open in ChatGPT / Claude, view Markdown source, view history, edit this page, create a child page, create docs/project issue, print the section, open the duo view (compare_translations).

Decided by: repository configuration, assistant_links, whether this page has a Markdown output, and for the duo view params.ui.compare plus a same-origin translation.

Preferences3

Switch version → switch language → switch style → switch theme.

Decided by: whether the site configures versions, languages, the preset menu (preset_menu), and the light/dark menu.

Commands4

Copy link (copy_link), open the GitHub repository, open the browsing history, then the site’s own commands.

Decided by: always available for copy_link, params.github_project_repo (falling back to github_repo), whether keyboard navigation is on, and ui.command_palette.commands.

The four preferences follow the navbar order: version, language, style, theme. Selecting a preference such as “switch language” does not navigate immediately. The palette expands its options in place. Select an option in a second action.

When you type text, page results appear first, grouped by content root. Each group uses the first breadcrumb segment as its name. Groups follow the navbar’s top-level menu order. Commands and actions appear together in the final group.

A query starting with > lists commands and actions only and searches no pages. Use it when you are unsure which menu holds a feature.

If the theme can explain why an item is unavailable, the item remains listed. Without repository configuration, “edit this page” remains with an “unavailable” note.

The palette also offers two adjacent Search in options for all sections or the current top-level section. It filters page results before the result limit, while commands and page actions remain available. The choice persists only while this page stays loaded. Matching sections appear beside page titles and open real heading anchors; multiple hits on one page share one row. Partial matches show their term coverage. See query semantics. Tab focuses the selected scope; arrow keys switch it. The control disappears in command and preference-choice modes.

Select quick links from Hugo’s main menu by identifier. You do not need to define them again:

hugo.yml
params:
  ui:
    quick_links: [docs, blog]

Values use the identifier of entries in menus.main. If unset, the list defaults to the documentation and blog sections (params.ui.docs_section and blog_section). To configure the menu, see Navigation and menus.

Custom commands

A site’s own commands go under params.ui.command_palette.commands, after the built-in ones, in the order written:

hugo.yml
params:
  ui:
    command_palette:
      commands:
        - id: theme_issues
          title: OINK issues
          description: Report or browse theme and documentation issues
          url: https://github.com/pgsty/oink/issues
          icon: fa-brands fa-github
          keywords: [bug, support, roadmap]

This site uses the command above. Commands have seven fields. An unsupported key or invalid record warns and discards that command:

  • id is required. It must start with a lowercase letter and contain only lowercase letters, digits, underscores, and hyphens. It must not duplicate a built-in action ID.
  • title supplies the displayed title. The description supplies the smaller line below it. The icon is one Font Awesome class pair.
  • keywords is an array of possible reader search terms. It participates in matching but is not displayed.
  • url and action are mutually exclusive and one is required. The url accepts a full http/https address, site path, or in-page anchor beginning with #. An address with a host opens in a new tab. The action references a built-in action ID.
Do not alias a built-in action with action:

Built-in actions are already in the palette, and wrapping one makes the same feature appear twice under two names.

For a multilingual site, put commands under languages.<lang>.params.ui.command_palette.commands. This lets you localize titles and keywords. The default language’s list sets the order. An entry with the same id in another language overrides only fields. A new id is appended. Command order therefore remains the same across languages.

Configuration can supply only a link or built-in action reference. It cannot inject a JavaScript callback. The palette reads a plain data manifest.

Page actions

The palette’s “page actions” and the documentation title’s split button share one implementation. They use the same action descriptors, URL generation, and executor. The button’s left half copies the page’s Markdown. Its right arrow expands all actions.

To hide the button beside the title, set page_context_menu: false. The corresponding actions stay in the palette:

hugo.yml
params:
  ui:
    page_context_menu: false

To hide the button on just one page, use page_context_menu: false in that page’s front matter instead.

The assistant_links setting is off by default. Clicking an assistant link sends the current page’s full URL, including query string and anchor, to a third party. It never uploads the body. Enable links site-wide through params.ui.page_context_menu.assistant_links. A page can only restrict that policy with this front matter:

Page front matter
page_context_menu:
  assistant_links: false

Check the title menu and palette. Neither should offer assistant links on that page. See AI-agent support for handoff behavior.

The links open ChatGPT and Claude.

links adds external actions that appear only in the menu beside the title, not in the palette:

hugo.yml
params:
  ui:
    page_context_menu:
      links:
        - name: Ask in Discussions
          url: https://github.com/pgsty/oink/discussions/new?title={title}
          icon: fa-solid fa-comments

The three placeholders {url}, {title} and {markdown_url} are replaced with the current page’s values.

Whether “edit this page”, “view history” and “open an issue” are available depends on repository configuration. See Repository links and page info. “Copy Markdown” and “view Markdown source” require the page’s markdown output. See AI-agent support.

The dialog uses two independent data sources:

  • Page results come from the local search index. If the index was not generated or fails to download, the palette still opens and runs commands. The page section reads “the page index is unavailable; actions still work”.
  • Commands and actions come from a JSON manifest embedded in the page and need no network.

The theme does not assemble the palette for print output. If offline_search is off, there is also no palette. The keys f and c then do nothing and do not affect normal typing.

Query-aware site actions

Trusted site JavaScript can register query-aware tail rows through window.OinkCommandPalette.registerSearchTail. Feature-detect the hook before calling it, because pages without local search do not provide it. Load the integration after the theme scripts, for example through layouts/_partials/hooks/body-end.html. This example assumes the site implements openSiteAssistant and owns its provider settings:

if (window.OinkCommandPalette?.registerSearchTail) {
  const unregister = window.OinkCommandPalette.registerSearchTail({
    id: 'ask-site',
    rows(context) {
      return [{ id: 'ask', title: 'Ask the site', description: context.query }];
    },
    activate(row, context) {
      context.handoff();
      return openSiteAssistant(context.query, {
        locale: context.locale,
        signal: context.signal,
      });
    },
  });
  // Call unregister() when removing this integration.
}

Rows follow native results and actions, including empty/error searches. They are absent in empty, command, choice, and loading states. Keep rows() pure and synchronous. All strings render as text. Activation receives the query that created the row, not newer input. Before opening another coordinated surface, use handoff(). The site then owns its focus and failure UI. For non-UI actions, return the operation without calling handoff.

The Shell contract defines fields, cancellation, validation, and lifecycle. YAML cannot contain callbacks. OINK adds no remote service or telemetry by default.

Verify

Run from your site’s root after a production build. In the commands below, replace public/docs/getting-started/index.html with an actual generated documentation page in your site (including a language prefix if needed).

  1. After a build, confirm the command manifest reached the page:

    hugo --printPathWarnings
    PAGE=public/docs/getting-started/index.html
    test -f "$PAGE" && grep -o 'td-action-manifest' "$PAGE"

    This confirms that HTML contains the action data. The remaining steps check the palette interface with local search enabled.

  2. Open the site. Press ⌘/Ctrl + K without typing. Confirm this order: quick links, page actions, preferences, commands.

  3. Type >. Confirm that only commands and actions remain. A new command should appear after “open the GitHub repository”.

  4. Repeat step 3 in another language. Confirm that command titles change and order remains the same.

  5. Open print preview (⌘/Ctrl + P). Confirm that it contains no palette.

5.8 - Keyboard navigation

Use single-key shortcuts and understand when typing disables them. Disable shortcuts for the site or individual pages.

Your readers can work through your documentation without reaching for the mouse: every interactive OINK page answers twenty-nine single-key shortcuts, ten for moving around, nine for acting on the page and ten for changing the view. Press ' on any page to see all twenty-nine; keys the current page cannot use are dimmed. Shortcuts are on by default, step aside whenever the reader is typing, and can be turned off for a site or a page.

Navigation

Key Action
W S Move to the previous / next entry of the sidebar tree
A D Collapse / expand the section
Enter Space Open the focused tree entry
Q E Previous / next page in sidebar order
K J Previous / next heading of the page outline
X Switch to the next language
R Switch to the next top-level section
V Switch to the next version
H Open the browsing history
G Go to the home page

Sidebar tree

The tree keys work on every page with a sidebar tree, and you do not have to enter the tree first: with focus in the article, S moves from the current page’s entry to the next one in a single press. The focused row is tinted one step darker than the current-page row, so “where I am” and “where the cursor is” stay distinguishable. When the sidebar sits in the phone drawer or is collapsed on desktop, the first press opens it.

Once focus is in the tree, ↑ ↓ ← → work like the letters; in the article the arrows keep native scrolling. In a right-to-left language ← and → follow the reading direction, while A always collapses and D always expands.

From a page entry, A first moves to the parent section and a second press collapses it. D opens a collapsed section, or steps into its first visible child when it is already open. Sections without a page of their own take focus through their disclosure button, which Enter or Space toggles. Esc leaves the tree and returns focus to where it was.

Reading

K and J visit the same targets as the right-hand outline and land where an outline click would. Every jump takes 100 ms however far it goes, and you can press again before it finishes. Deep inside a section, K first returns to that section’s start. A page without headings scrolls a short step instead. On the home page the two keys move between the landing sections.

Q and E follow the order the sidebar shows, not dates, and skip collapsed branches, so paging and tree focus always agree. A section’s index page is an entry of its own: at a blog boundary the order runs from the last post of one section to the next section’s index, then to its first post. Without a sidebar tree, paging uses the page-end pager, then the rel="prev" and rel="next" links in <head>.

Language, section and version

These keys work on every interactive page and do nothing when there is no other choice:

  • X switches to the next language, wrapping after the last one. It opens this page’s translation, or that language’s home page when the page has none.
  • R cycles through the same-origin top-level navbar entries. It skips external links and the navbar’s utility controls.
  • V opens the next version listed in params.versions that has a URL, wrapping after the last one.

Browsing history

H opens a search-style list of the pages you have read on this site, newest first. The page you are on is left out, so H then Enter takes you back to the previous page.

Key In the history list
Typing Filter by title and path; every word must match
↑ ↓ Select an entry
Enter Open it; Ctrl with Enter (⌘ with Enter on macOS) opens it in a new tab
Shift with Delete Remove the selected entry
Esc Close the list

Clear history removes all stored visits, including the current page. The command palette also offers a Browsing history command that opens the same list.

History keeps the last 100 pages in this browser’s localStorage, under a key named after the site’s base path, such as td-history:/. Every language of the site shares one list, and two sites on the same domain keep separate ones. OINK never sends it anywhere. It is recorded only on pages where keyboard navigation is on, and there is no separate switch for it.

G opens the home page of the current language. On the home page itself it scrolls back to the top.

Actions

Key Action
/ F Search
\ C Open the command palette with commands only
U Edit this page
N Create a child page
I Create a docs issue
O Expand or collapse everything that folds
P Print this page
[ Open in ChatGPT
] Open in Claude

/ opens the command palette ready to search, and \ opens it with commands only. Both keys belong to the palette, so they keep working when keyboard navigation is off; F and C are the keyboard navigation equivalents. ⌘ with K on macOS and Ctrl with K elsewhere open the palette from anywhere, even a text field, and close it again. On layouts where \ is hard to reach, press C or type > at the start of the search box.

The palette needs local search (params.offline_search: true); without it these four keys do nothing.

Page actions

U, N and I run the same actions as the page menu beside the title and open their target in a new tab. All three need a repository configured for the site; U and N also need a page with a source file, so they do nothing on generated pages such as tag lists. P prints the page, exactly like the browser’s print command.

[ and ] hand the page to ChatGPT or Claude in a new tab. They work only when the site enables params.ui.page_context_menu.assistant_links.

Expand or collapse all

O opens everything on the page that folds: the sidebar sections, the right-rail groups (outline, backlinks, term clouds), collapsible callouts, file trees, “show more” lists and long code blocks. When everything is already open, it folds all of them instead, except the sidebar branch of the current page, so you never lose your place. The line you are reading stays where it is while the page above it grows or shrinks.

Menus and popovers such as navbar dropdowns are not folded content and stay closed. Collapsed rails stay collapsed; restore them with their own buttons.

View

Key Action
B Open or close the Duo View
Z Turn Zen Mode on or off
M View the page’s Markdown source
T Switch to the next visual style
Y Switch color mode: light, dark, system
L Switch the index layout: list, cards, table, gallery
; Switch the gallery layout: wall, cards, seamless
, . Smaller / larger gallery images
- = Narrower / wider reading column
' Open or close the shortcut help

Zen Mode and Duo View

Z hides the navigation shell so only the text remains: the navbar and footer on the home page, and also both rails and the floating buttons on documentation pages. The choice lasts for the browser tab and is restored before the first frame, so paging with Q E keeps it without a flicker. At phone width the top bar stays, because it is the only way back to the navigation. While the shell is hidden, the tree keys do nothing.

B opens the Duo View when the site sets params.ui.compare: true and the page has a translation, and closes it again from either pane.

M opens the page’s Markdown output in a new tab on sites that publish it.

Appearance

T steps through the visual styles the site offers in params.ui.preset_menu and wraps after the last one; it does nothing when the site offers a single style. Y steps through light, dark and system color modes and does nothing when the dark palette is off (params.ui.dark_mode disabled). Both work on every interactive page and remember the choice like the Appearance menu does.

Index and gallery layouts

On blog, release and case index pages with params.ui.blog_index_toggle, L cycles the index through list, cards, table and gallery. On an Expo album, and on an index while its gallery view is showing, three more keys control the grid:

Key Gallery action
; Cycle the layout: wall, cards, seamless
, or < Shrink the target image size by 20 px, down to 160 px
. or > Enlarge the target image size by 20 px, up to 360 px

The toolbar follows each change, the grid reflows at once, and the choice is remembered: td-expo-mode and td-expo-size for Expo albums, td-blog-gallery-mode and td-blog-gallery-size for index galleries. Clicking a layout icon or dragging the size slider does not stop these keys.

Page width

On wide screens the reading column keeps its page width even when the window has room to spare. - and = (or +) narrow and widen it by 100 px at a time on documentation, book, blog and Expo pages:

  • The column never gets narrower than 600 px and never wider than the space between the rails. Widening until it touches the rails makes it fill that space on any screen size.
  • The width applies to every page of the site in this browser and is restored before the first frame. It replaces each page’s page_width and the Book content measure. Printing ignores it.
  • A step that reaches the page’s own width stops there and forgets the stored width (td-shell-article-w in localStorage), so stepping back always returns every page to the width its author chose.

Expo viewer

An Expo image opens in a viewer with its own keys for moving, zooming and changing images, listed in the Expo guide. Page shortcuts pause while the viewer is open and resume when it closes. The viewer keys work even when keyboard_nav is off.

Shortcut help

' opens all twenty-nine shortcuts in a centered dialog: navigation, actions and view side by side (ten, nine and ten rows). Rows the current page cannot run stay in place but are dimmed, and screen readers hear them as unavailable, so the grid keeps the same shape everywhere. The dialog opens from anywhere: in the middle of a long page, in Zen Mode, or on pages without a footer (footer_style: none). ', Esc, the close button or a click outside the dialog closes it.

The question-mark button at the end of the footer’s bottom bar offers the same sheet. Hovering or focusing it previews all twenty-nine shortcuts directly above the footer (three columns side by side on wide screens, wrapping cleanly on narrower screens), with unavailable rows already dimmed; clicking it opens the centered modal dialog with the Enable shortcuts toggle, and closing the dialog returns focus to the button.

With keyboard navigation off and local search on, the button keeps only the two palette keys, / and \, and opens no dialog.

Keys left free

? and the digits are deliberately unbound, and modified letters keep their usual meaning except for the exact search chord Ctrl with K or ⌘ with K. Use the character printed by your keyboard layout. For example, German Shift with 7 opens search. The gallery and width keys also accept Shift to produce ,, ., ;, <, >, = or +.

When shortcuts stand down

Every binding is a single key, so each one steps aside when it could collide with typing or an overlay:

  • Focus is in a text field: <textarea>, <select>, contenteditable, or an <input> you type into, such as text, search, email, password or number. Non-text controls such as gallery layout radio buttons and the size slider keep the page shortcuts and their own arrow keys.
  • Focus is inside a map or an audio or video player, which keeps its own keys.
  • An input method is composing, which matters on every Chinese, Japanese or Korean site.
  • A modifier key is held. ⌘ with C still copies, Shift with M does nothing, and Shift with ↓ stays a browser action.
  • The command palette, the browsing history, the shortcut help, the Expo viewer, another open dialog or a visible ARIA dialog owns the keyboard. Hidden ARIA dialogs do not block shortcuts.

Comments load in an iframe, so their keystrokes never reach the page.

Focus order and accessibility

  • Skip link: the first Tab on a page reveals “Skip to content”, which passes the navbar and sidebar in one step and marks the article title.
  • Real focus: tree navigation moves the actual DOM focus, so a screen reader announces the link name and its “current page” state, Enter keeps the link’s native behavior, and the Tab order is unchanged.
  • Hidden content: a collapsed sidebar or closed drawer leaves the Tab order, while the button that restores it stays reachable. Clicking the article, a table or a code block does not leave a large outline behind for the next key.
  • High contrast: under forced-colors the focused row and the selected history entry are outlined in the system highlight color.
  • Reduced motion: with prefers-reduced-motion, heading jumps and paging land instantly.
  • The keycaps in the shortcut help are the same as the Kbd component you write in pages.

Turning it off

To turn off single-key shortcuts for yourself, open shortcut help and uncheck Enable shortcuts (enabled by default). At the start of any page with these shortcuts, Tab past Skip to content to reach the same checkbox. This also works on pages without a footer. Space toggles the checkbox. Your choice applies across the site’s languages in this browser. Ctrl+K or ⌘K still opens the search palette.

Site-wide:

hugo.yml
params:
  ui:
    keyboard_nav: false

For one page, such as an interaction-heavy demonstration, or for a whole section through cascade:

content/docs/playground.md
---
title: Interactive playground
keyboard_nav: false
---

The key takes a boolean only; see Configuration for the complete definition. A page with keyboard navigation off ships no keyboard runtime at all: no shortcuts, no browsing history recording and no restored page width. /, \ and ⌘ with K belong to search and keep working, and the footer’s collapse arrow is unaffected.

Verify

Build your site, then replace public/docs/getting-started/index.html below with a documentation page your site actually generates, including any language prefix.

  1. Confirm that the help button is in the page:

    hugo --printPathWarnings
    PAGE=public/docs/getting-started/index.html
    test -f "$PAGE" && grep -c 'td-shell-keyboard__trigger' "$PAGE"

    With keyboard navigation off and no local search, the button is not generated.

  2. Open a documentation page and press ': three columns appear, with dimmed rows for features this page lacks. Press it again to close the dialog.

  3. With focus in the article, press S a few times. The sidebar focus moves down from the current page and the article stays still. Then press E and check that pages follow the sidebar order.

  4. Read two pages, then press H and Enter: you are back on the first one.

  5. Press O twice. Every sidebar section opens, then everything folds again except the branch of the current page.

  6. On a wide window, press = and -. The column widens and narrows, and keeps its width after a reload.

  7. Click in the search box and press J. The letter is typed and the page does not scroll. Repeat with an input method.

5.9 - Languages

Add a second language end to end, keep heading anchors aligned across translations, and let readers compare two languages side by side.

OINK uses Hugo’s multilingual model as it is: a languages block in hugo.yml, and each translation saved beside its original with a language suffix. Adding a language touches five places: the configuration, the translated pages, the menus, the home page data and, only if you want to reword them, the theme’s interface strings. The language picker, hreflang links and per-language search follow from those without further setup.

Enable a second language

hugo.yml
defaultContentLanguage: en

languages:
  en:
    label: English
    locale: en-US
    weight: 1
    title: Acme DB Docs
    params:
      description: Documentation for the Acme DB time-series database
  zh:
    label: 简体中文
    locale: zh-CN
    weight: 2
    title: Acme DB 文档
    params:
      description: Acme DB 时序数据库文档
      time_format_default: 2006年1月2日
      time_format_blog: 2006年1月2日
  • label is the name in the language picker, written in that language: 简体中文, not Chinese.
  • locale is the standard language tag used for <html lang>, the hreflang alternate links and Open Graph metadata.
  • weight orders the languages, lowest first, in the picker and in its one-click cycle.
  • params overrides site parameters for this language; any key not set here keeps the global value. Date formats usually need a per-language value.

The default language is served without a path prefix (English at /docs/…) and every other language under its own (Chinese at /zh/docs/…). To prefix the default language too, add defaultContentLanguageInSubdir: true; on a live site this changes every URL, so set up redirects at the same time.

Translate the pages

Save each translation beside its original with the language code before the extension. Hugo pairs files that share a base name, so these are one page in two languages:

  • content/docs/
    • install.mdEnglish
    • install.zh.mdChinese
    • _index.md
    • _index.zh.md

Page bundles work the same way, with index.md and index.zh.md in one directory. Inside a bundle, a resource without a language suffix is shared by every language and a suffixed one belongs to that language only. Reference a suffixed resource without its suffix, ![Screenshot](screenshot.webp), and Hugo picks the file for the current language:

  • content/docs/install/
    • index.mdEnglish page
    • index.zh.mdChinese page
    • topology.webpused by both languages
    • screenshot.zh.webpused by the Chinese page only

A bundle that has only index.zh.md needs the .zh. suffix on every resource. Unsuffixed resources belong to the default language, which has no page in that bundle, so the Chinese page would not see them.

Translate what readers see and keep what Hugo uses for structure identical:

  • Translate: title, description, summaries, menu labels, tag names, image alt text, callout bodies and reader-facing shortcode parameters.
  • Keep identical: dates, weight, aliases and anything else that affects routing or order; a different weight puts the page in a different sidebar position in each language.
  • Leave untranslated: commands, configuration keys, file names, URLs, version numbers, product names and shortcode names.

Menus, home page and interface strings

Three things live outside content/ and need one copy per language.

Menus are written under each language:

hugo.yml
languages:
  zh:
    menus:
      main:
        - identifier: docs
          name: 文档
          pageRef: /docs
          weight: 20

Use the same identifier in every language, because the command palette’s quick links and the grouping of search results are matched by it. The full menu syntax is in Navigation and menus.

Home page data is one file per language, data/home/en.yaml and data/home/zh.yaml; a language without a file falls back to en.yaml. See Home and landing pages.

Interface strings, such as the search placeholder and the page-action labels, are already translated: the theme ships complete, native catalogs for 32 locales (ar, az, bg, bn, de, en, es, et, fa, fi, fr, he, hi, hu, it, ja, ko, nl, no, oc, pl, pt-br, ro, ru, sr-cyrl, sr-latn, sv, tr, uk, zh, zh-cn and zh-tw). zh and zh-cn are Simplified Chinese and zh-tw Traditional. To reword a string, create a file of the same name in the site’s own i18n/ with only the keys you change; key names are in the theme’s i18n/en.yaml, and any placeholder such as {{ .Count }} in the original must stay in your version.

i18n/en.yaml
ui_search: Search the docs

Align heading anchors

Hugo derives a heading’s ID from its text, so a translated heading gets a different ID: /docs/install/#prerequisites and /zh/docs/install/#前置条件 are the same section under two anchors. A deep link copied from one language then fails in the other, every cross-reference has to be written twice, and Duo View cannot keep its two panes at the same section. Give the translated heading the original’s ID explicitly:

install.zh.md
## 前置条件 {#prerequisites}

Take the ID from the English page’s rendered HTML rather than guessing it from the heading text, because inline code, badges and shortcodes in a heading change the generated ID. Keep the same headings, in the same order, with the same IDs on both sides; a section that exists in only one language gets its own stable ID that does not collide with the other’s. Adding {#id} when you write a page costs far less than retrofitting it.

To compare one translated pair after a build:

ids() { grep -oE '<h[2-6][^>]* id="?[^" >]+' "$1" | sed -E 's/.*id="?//'; }
diff <(ids public/docs/install/index.html) <(ids public/zh/docs/install/index.html)

To check every pair in CI, the OINK documentation site runs check-doc-translations.mjs, which compares source structure and rendered heading IDs. It is written for that repository’s content sections and EN/ZH file names, so adapt both before running it on another site.

Missing translations and the language picker

The language picker’s icon is itself a link to the next language by weight, wrapping round after the last, so a bilingual site switches with one click. Hovering over it or focusing it opens a menu of every language; on a touch screen a tap switches directly.

The menu always lists every configured language. Choosing one opens the translation of the current page when there is one, and that language’s home page when there is not. The home page beats a 404, but readers may not notice they have moved, so treat “every page has a translation” as a rule to check rather than relying on the fallback.

A missing translation is never filled in with the original

If a page has no Chinese version, the Chinese site has no such page: its sidebar, search index and page order leave it out.

Search engines see only real translations: hreflang lists the current page and its actual translations, never the home page fallback. See canonical URLs and language alternates. Local search also works per language, so a search on a Chinese page finds Chinese content, including unspaced Chinese, mixed-language queries and technical identifiers; see Search.

Duo view

Duo View lets a reader open a page beside one of its translations, which helps anyone checking a translation or reading in a second language. Turn it on with:

hugo.yaml
params:
  ui:
    compare: true

On Docs, Book and blog pages with a published translation on the same site, an Open duo view button appears beside the page actions. Readers can also start Duo View from the command palette, or press B when keyboard navigation is on (try it on this page), and press B again to return. The current page stays on the side where reading starts and the other pane loads the translation; on a page with more than two languages, readers pick the target language from the toolbar menu. Below 900px the view becomes a single pane with a language toggle bar.

The Sync Scroll switch keeps both panes at the same section by matching heading IDs, which is why aligned anchors matter here. When some headings have no counterpart, or the pages share none, it estimates the position between matching headings or from overall progress, and an orange ! beside the switch says which; hover, focus or tap it to read the note. When heading IDs are duplicated or ordered differently between the languages, Sync Scroll turns itself off and both panes scroll independently.

Duo View adds no pages to the build: only when a reader opens it does the browser load the two existing HTML pages, in same-origin frames. Pages without a translation, drafts, home page fallbacks and translations hosted on another domain are left out automatically. To keep one language out entirely, both as the page being read and as the translation shown, set compare: false under languages.<lang>.params.ui.

Before enabling it in production, check two things:

  • Analytics snippets in hooks/head-end.html run again inside each pane unless you guard them with window.OinkComparePane; see Analytics.
  • Your Content Security Policy must allow frame-src 'self', and the server must not send X-Frame-Options: DENY or frame-ancestors 'none'; see Content Security Policy.

Right-to-left languages

Declare the writing direction on the language:

hugo.yml
languages:
  ar:
    label: العربية
    locale: ar
    direction: rtl
    weight: 3

<html dir> follows this setting and the theme adds Bootstrap’s RTL stylesheet. The theme’s own CSS uses logical properties, such as margin-inline-start rather than margin-left, so the layout mirrors by itself. Use logical properties in your own CSS too, or your elements will sit on the wrong side in RTL.

Verify

  1. Build from the site root and confirm that both languages produced output. These paths assume English at / and Chinese at /zh/; the index check applies only with local search on:

    hugo --printPathWarnings
    ls public/index.html public/zh/index.html
    ls public/offline-search-index.*
  2. Check the hreflang links of a translated page against SEO behavior: they list only real translations, each blog pagination page has its own canonical URL, and pages after the first omit language alternates.

    # Replace with a page your site actually generates.
    PAGE=public/zh/docs/getting-started/index.html
    test -f "$PAGE" && grep -o '<link[^>]*hreflang[^>]*>' "$PAGE"
  3. On a translated page, switch language from the picker and confirm that the same document opens; on an untranslated page, confirm that the other language’s home page opens rather than a 404.

  4. Search for the same concept in each language and confirm both return results.

  5. Compare the heading IDs of a translated pair as shown under Align heading anchors.

5.10 - Versions

Publish documentation for several product versions side by side, with a version switcher and a banner that marks unmaintained versions as archives.

A site needs versioned documentation when readers run different releases of your product at the same time and those releases differ in ways a reader acts on: commands, configuration keys, defaults. If most readers can move to the latest release, or old releases differ only in fixed bugs, keep one site and mark the exceptions in the text; a single site is easier to maintain and to search.

OINK treats each version as a separate site: its own Hugo build, usually from its own Git branch or tag, published at its own address. The theme connects those sites with a version menu in the navbar and an archive banner on the versions you no longer maintain.

The version switcher

List the versions under params.versions. When the list is not empty, a branch icon in the navbar opens the version menu, and an icon-only menu in the footer’s bottom bar opens upward with the same entries.

hugo.yml
params:
  # the version this site is
  version: v2.1
  # the menu's accessible name and tooltip (default: Version)
  version_menu: v2.1
  versions:
    - version: v2.1
      url: https://docs.example.com
    - version: v2.0
      url: https://v2-0.docs.example.com
    - version: v1.9
      url: https://v1-9.docs.example.com

An entry shows its version, or its name when it has one. The entry whose version equals params.version, or whose url equals the site’s baseURL (a trailing slash aside), is marked as the current one.

An entry without a url is a gray item that cannot be clicked, which makes a group heading, and name: '---' draws a divider (a url on a divider warns). name accepts inline Markdown:

hugo.yml
params:
  versions:
    - name: '**Current**'
    - version: v2.1
      url: https://docs.example.com
    - name: '---'
    - name: '**Older versions**'
    - version: v1.9
      url: https://v1-9.docs.example.com

The same list feeds “switch version” in the command palette, so the menu and the palette always agree.

By default a menu entry opens the target version’s home page. version_menu_pagelinks: true appends the current page’s path to the target URL instead, so switching version keeps the reader on the same document. The risk is a 404: documentation structure changes between versions, and a page added in v2.1 does not exist in v1.9. This site leaves the option off.

When most versions share a structure and one does not, turn the option on and opt that one entry out:

hugo.yml
params:
  version_menu_pagelinks: true
  versions:
    - version: v2.1
      url: https://docs.example.com
    - version: v1.9
      url: https://v1-9.docs.example.com
      pagelinks: false # restructured since; go to its home page

pagelinks: false is the only per-entry setting; an entry cannot turn page links on when the site-wide option is off. Decide by how stable the structure is rather than by how far apart the version numbers are: one extra click from a version’s home page costs the reader less than a 404.

The archive banner

When you stop maintaining a version, mark its site as a snapshot so that readers arriving from a search engine know to look for something newer:

hugo.yml
params:
  archived_version: true
  version: v1.9
  url_latest_version: https://docs.example.com

With archived_version: true, every page of the site, blog and landing pages included, opens with a banner saying that version v1.9 is no longer actively maintained and that this is an archived snapshot, with a link to url_latest_version. The text comes in the site’s language, so you write none of it. The version number in the banner is params.version; without it the build warns and leaves the banner out, so set both. A url_latest_version that fails the theme’s URL check warns, and the banner appears without the link.

params.version versus params.versions

The two keys look alike but describe different things:

  • params.versions is a list of sites: the versions in the menu and where each one lives.
  • params.version names the version this build is. It marks the current menu entry, supplies the banner’s version number, and is the fallback when a data/download/*.yaml file omits version (see Releases and downloads).

params.version is a label for readers and need not be a Git ref. When content needs a release tag that resolves, such as the version in an install command, declare a separate parameter for it instead of reusing params.version. Both keys are defined in Configuration.

Deployment layouts for multiple versions

Subdomain

baseURL: https://v1-9.docs.example.com/

Versions are fully independent; each needs its own DNS record and certificate.

Subpath

baseURL: https://docs.example.com/v1.9/

One domain collects all search ranking; the host must route each path to a different build.

Build each version on its own: check out its branch or tag, build with that version’s hugo.yml, and publish to its address. Because the menu is part of each build, adding a version means updating params.versions on every branch you still publish and rebuilding those sites; an old site that is not rebuilt keeps its old menu. Archived sites carry the same list plus archived_version: true.

On a subpath deployment, baseURL must include the path segment

Otherwise the search index, page actions and asset links all point at the domain root. The page looks correct, but search returns nothing, which makes this the most common subpath failure. See Deploy for the rest of the host setup.

Verify

Run these from your site’s root after a production build. Replace public/docs/getting-started/index.html with a documentation page your site actually generates, including the language prefix if it has one.

  1. Confirm that the version menu reached the page:

    hugo --printPathWarnings
    PAGE=public/docs/getting-started/index.html
    test -f "$PAGE" && grep -c 'nav-version-menu' "$PAGE"

    With params.versions empty or unset there is no menu at all.

  2. Check that the current version is marked:

    grep -o 'td-nav-hover-menu__option td-is-active[^>]*' "$PAGE"

    No result means that no entry’s version equals params.version and no entry’s url equals baseURL.

  3. Follow each menu link. With version_menu_pagelinks on, switch from a page that an older version lacks and check that the reader lands somewhere acceptable.

  4. On an archived site, open any page and check that the banner is at the top, in the site’s language, with a working link to the current version.

  5. Press ⌘/Ctrl + K and check that “switch version” lists the same versions as the menu.

5.11 - Taxonomies

Use tags and categories to index pages across directories, with automatic term pages, term cards, rail clouds, and navbar panels.

The directory tree gives each page one place; tags and categories give it more. A PostgreSQL backup guide can live under “Operations” and still be one click away from the “backup” tag, so readers who think in topics rather than in your folder structure find it too. Declare the taxonomies in hugo.yml and tag your pages; OINK generates the term pages, the term cards, the clouds in the right rail and the navbar panel without a template of your own.

This page is an example: the “Categories: Customization” line under its title and the counted chips under the outline in the right rail come from its section’s category, with no configuration on the page itself.

Enabling a taxonomy

Taxonomies are a Hugo feature, so there is no theme switch. Write taxonomies: at the top level of hugo.yml, with the singular name as the key and the plural as the value:

hugo.yml
taxonomies:
  tag: tags
  category: categories
  • The list is complete, not added to Hugo’s defaults: once you write taxonomies:, tags and categories exist only if you list them.
  • The plural is also the URL segment: /tags/, /categories/.
  • disableKinds: [taxonomy, term] turns all taxonomies off.

To classify pages by product module as well:

hugo.yml
taxonomies:
  tag: tags
  category: categories
  module: modules

tags, categories, modules, authors and series, and their singular forms, have translated names in every theme language file. Any other taxonomy is named after its plural (products becomes “Products”). To choose the name yourself, write title / linkTitle in content/<plural>/_index.md and its translations, such as _index.zh.md; that name takes precedence:

content/modules/_index.md
---
title: Product modules
linkTitle: Modules
---

Tagging a page

The front matter key is the plural (the value side of taxonomies), and its value is always a list, even with a single term:

content/docs/ha/patroni.md
---
title: Patroni high availability
description: Managing PostgreSQL failover with Patroni.
categories: [High availability]
tags: [PostgreSQL, Patroni, failover]
---

When a whole section shares a category, set it once in the section index’s cascade instead of on every page:

content/docs/customize/_index.md
---
title: Customization
linkTitle: Customization
icon: fa-solid fa-sliders
cascade:
  categories: [Customization]
---

All six documentation sections of this site do this. A page’s own categories: replaces the cascaded value rather than merging with it, so to add a category next to the section’s, list both.

The term line on a page

Documentation and blog pages list their terms under the title and summary, each linked to its term page; on this page that is “Categories: Customization”. To style the line, target its container .taxonomy-terms-article and the .taxo-<plural> class each taxonomy adds.

By default the line shows every taxonomy except authors and series, whose terms already appear in the byline and the series strip; listing them again as chips would say the same thing twice. To show only some taxonomies, in a fixed order, name them in page_header; naming authors or series there brings them back:

hugo.yml
params:
  taxonomy:
    page_header: [categories]

page_header cannot hide the line; see Limits. The key is listed in Configuration.

Two taxonomies the theme knows by name

authors and series are ordinary Hugo taxonomies with no theme parameters of their own. Declaring them is the whole switch, because the theme has a dedicated presentation for each:

hugo.yml
taxonomies:
  category: categories
  tag: tags
  author: authors
  series: series
authors

What the declaration turns on: portraits and linked names in the article head, names on list rows, and one <dc:creator> per author in the feed.

The term page becomes: the author’s profile. The display name is linkTitle, or title if absent; description is the short introduction and the body the long one; the featured-image resolver picks the portrait.

series

What the declaration turns on: a strip above the article body naming the series, this article’s position and the next part, with the whole list behind a <details>.

The term page becomes: the series introduction, listing its members in reading order rather than newest first.

Writing a blog covers both in full, with the front matter each needs. Two design choices are worth knowing in advance:

  • There is no data/authors file. The term page is the profile, so there is never a second source to disagree with it.
  • Series members are ordered for reading: members with a series_weight come first in ascending order, then the rest by ascending date. Hugo cannot be given that order for a term page, so the theme computes it once and both the strip and the term page use the result.

Term and taxonomy pages

Each taxonomy generates two levels of page:

Taxonomy list/categories/

A heading with the taxonomy’s icon, its localized name (“Categories”) and the number of terms, then one card per term, most-used first, each with its icon (an author’s portrait), name and page count.

Term page/categories/customization/

A heading with the term’s title and page count, plus a “Categories” kicker linking to the list when breadcrumbs are off. The member pages follow, newest first, styled like a blog list.

Term cards appear only on the taxonomy list page; term pages show the rail cloud instead.

Hugo does not transliterate, so a Chinese term gets a Chinese URL: the address bar shows 定制站点 and the HTML carries it percent-encoded. For ASCII URLs, use English terms and give each a display name with title in content/categories/<term>/_index.zh.md, Hugo’s term page content file mechanism.

A term page has no place of its own in the content tree, so it borrows one. When all its members belong to one top-level section, it shows that section’s sidebar tree and root link, so a reader who clicks a documentation tag stays in the documentation navigation. When the members span sections, it shows the site-level tree.

The rail cloud

The right rail of documentation, blog and term pages has one group per taxonomy under the outline, with counted, collapsible chips. A group appears whenever the taxonomy is declared and has terms in the current scope. To hide the clouds and the taxonomy switcher, set toc_taxonomies: false in a page’s front matter, or params.ui.toc_taxonomies: false in hugo.yml for the whole site. This changes only the rail: the page keeps its terms, byline, series and membership.

Taxonomy list pages and term pages start the rail with a taxonomy switcher: one row per declared taxonomy with its icon, name and term count, linking to its list page, with the current one highlighted. A site with a single taxonomy has no switcher. A list page counts its clouds across the whole site and leaves out its own taxonomy, whose terms are already the cards beside it.

Elsewhere the counts are per top-level section, not site-wide. The theme first looks for a section named after the page’s type, so a type: docs page counts within /docs/; otherwise it uses the page’s own top-level section. “Tags: release 4” on a blog page therefore means four posts in the blog, not four pages on the site.

Each taxonomy has two built-in icons: one for its group heading and one for each term chip.

Taxonomy Group icon Term icon
categories fa-solid fa-folder-open fa-solid fa-folder
tags fa-solid fa-tags fa-solid fa-tag
modules fa-solid fa-cubes fa-solid fa-cube
authors fa-solid fa-users fa-solid fa-user-pen
series fa-solid fa-book-bookmark fa-solid fa-book
Any other fa-solid fa-shapes fa-solid fa-shapes

Override them by plural name. A string sets both icons; a map with taxonomy and term sets them separately, and a key you leave out keeps its built-in icon. Each value is one Font Awesome class pair:

hugo.yml
params:
  ui:
    taxonomy_icons:
      categories: fa-solid fa-folder
      tags: { taxonomy: fa-solid fa-tags, term: fa-solid fa-hashtag }
      modules: fa-solid fa-cubes

The taxonomy panel in the navbar

A main-menu entry that points at a taxonomy list page opens a panel of term chips with their counts, most-used first. You write no dropdown entries for it:

hugo.yml
languages:
  en:
    menus:
      main:
        - identifier: tags
          name: Tags
          pageRef: /tags
          weight: 60

The older url: /tags/ form works too, because the theme resolves a URL entry to the site page it names before checking whether that page is a taxonomy, so an existing menu needs no rewrite. Other menu options are in Navigation and menus.

Bilingual terms

Hugo counts and links taxonomies per language: /categories/ and /zh/categories/ are separate trees, and a Chinese page belongs only to the Chinese one. Write the terms in each language’s front matter:

content/docs/ha/patroni.md
categories: [High availability]
tags: [PostgreSQL, Patroni, failover]
content/docs/ha/patroni.zh.md
categories: [高可用]
tags: [PostgreSQL, Patroni, 故障切换]
  • The same string in both languages, such as release, still makes two term pages, /categories/release/ and /zh/categories/release/, each counting only its own language. Using English terms on Chinese pages for the sake of consistency therefore gains nothing and shows English chips to Chinese readers.
  • Taxonomy names are translated for the built-in plurals, but term names are not: a term is exactly the string in front matter. Write 高可用 on an English page and its chip shows 高可用.

Running a multilingual site is covered in Languages.

Switching by content type

The rail clouds are a display setting. To keep them in the documentation but hide them throughout the blog, set the switch on the blog index and cascade it to its pages:

content/blog/_index.md front matter
toc_taxonomies: false
cascade:
  toc_taxonomies: false

Which pages belong to a taxonomy is a separate choice, made by the terms you assign. This site, for example, uses categories for sections and tags only on the blog:

Content categories tags Effect
content/docs/** Section-level cascade (the six sections) none The term line has one row, Categories
content/blog/** Per post (release, oink) Per post (Oink, Release) Two rows in the term line, two chip groups in the rail

To take a whole section out of a taxonomy, delete categories from its index’s cascade. To take out one page, write categories: [] in its front matter; the empty list overrides the cascade.

Verify

On a page of your own that has terms assigned, check that:

  • the title area shows the taxonomies chosen by params.taxonomy.page_header;
  • with toc_taxonomies on, the right rail shows term groups with counts, and turning it off hides the clouds but keeps the page’s terms;
  • your taxonomy list page (for example /categories/) lists the terms, and each opens a page of its members.

From your site’s root, replacing both example paths with your own, language prefix included:

hugo --printPathWarnings
PAGE=public/docs/getting-started/index.html
TAXONOMY_DIR=public/categories
ls "$TAXONOMY_DIR"
test -f "$PAGE" && grep -o 'taxonomy-term' "$PAGE"

Limits

  • page_header: [] does not hide the term line: an empty list counts as unset, so every taxonomy is listed. To remove the line, stop tagging those pages, or hide .taxonomy-terms-article in assets/css/project.css.
  • toc_taxonomies: false hides the rail clouds, but no setting limits how many terms a visible cloud shows.
  • Term pages are not paired across languages, so switching language on a term page does not necessarily lead to the same term in the other language.

5.12 - Repository links and page info

Connect “edit this page”, “open an issue”, and “view history” to your repository. Show last-modified information, contributors, and feedback at the page end.

A reader who spots a mistake should be one click away from fixing it, and a reader who lands on a page should be able to tell how current it is. Point OINK at the GitHub repository that holds your content, and the page action menu at the right of the breadcrumb row gains Edit this page, View edit history and issue links, while the end of each page shows when it last changed and in which commit.

hugo.yml
params:
  github_repo: https://github.com/pgsty/oink.pgsty.com # the documentation source repository
  github_project_repo: https://github.com/pgsty/oink # the product repository (optional)
  github_branch: main # defaults to main
  github_subdir: '' # path from the repository root to the Hugo site root

With these settings, this page’s action menu points to:

Menu entry Target
Edit this page …/edit/main/content/docs/customize/repository.md
View edit history …/commits/main/content/docs/customize/repository.md
Create child page …/new/main/content/docs/customize?filename=change-me.md&value=<template>
Create docs issue …/issues/new?title=Repository links and page info
Create project issue https://github.com/pgsty/oink/issues/new
  • github_repo is the repository that holds your content, not the theme’s; pointing it elsewhere sends readers’ fixes to the wrong place. Without it, the first four entries above are unavailable.
  • github_project_repo is optional: a second repository where readers report bugs in the product rather than in the documentation. It alone controls Create project issue, and it is also where the navbar’s GitHub button points. Leave it out if your readers would not know which repository to choose.
  • github_branch (default main) is the branch your content is edited on, not a deployment or Pages branch.
  • github_subdir is the path from the repository root to the Hugo site. Leave it empty when the site is at the root; set it to website when the repository holds code with the site in website/.

Each key can be set for the site, for one language, in a section cascade, or in a page’s front matter, so one site can draw content from several repositories. The full definitions are in Configuration.

Content from another repository

When a section is copied or mounted from an upstream repository, its edit and history links should lead to that repository. Override the repository keys in the section’s cascade, and use path_base_for_github_subdir to strip or replace the prefix of each page’s source path before it is appended to github_subdir. For files copied into the site, that path is relative to the site root:

content/reference/_index.md
---
title: Upstream reference
cascade:
  github_repo: https://github.com/OWNER/UPSTREAM
  github_project_repo: https://github.com/OWNER/UPSTREAM
  github_subdir: docs
  path_base_for_github_subdir: content/reference
---

content/reference/api/client.md then maps to docs/api/client.md upstream.

For a directory mounted from outside the site, match its absolute source path, not the mount target inside Hugo. Paths are compared with / separators on every platform, Windows included, and keep their filename case:

External source at /srv/upstream/docs/
path_base_for_github_subdir: '^/srv/upstream/docs/'

With github_subdir: docs, /srv/upstream/docs/api/client.md maps to docs/api/client.md. The result must be a non-empty path inside the repository. When an external file matches no mapping, or the result is absolute, starts with a drive letter, is . or climbs out with .., the page gets no Edit, View edit history or Create child page entry; its issue links still follow their own repository settings.

path_base_for_github_subdir is a regular expression. When upstream files have different names from the local ones, give a from / to pair instead; this maps each section’s _index.md to the upstream README.md:

content/reference/_index.md
path_base_for_github_subdir:
  from: content/reference/(.*?)/_index.md
  to: $1/README.md

OINK keeps .md and .zh.md side by side in one directory, so both languages share a path prefix and the expression needs no language directory. After changing it, click Edit this page on a leaf page and on a section index, in every language: an expression that strips too much produces URLs that look right and return 404.

Turning individual entries off

Every entry in the menu has a stable action ID, listed in the page action menu. When your Git host does not support an action, hide its entry with CSS:

assets/css/project.css
.td-page-actions__item[data-td-action='create_child_page'] {
  display: none;
}

The command palette uses the same IDs and still offers an entry hidden this way. CSS can hide a link but cannot correct its target, so when a target is wrong for the whole site, remove the configuration key it comes from instead. To drop the whole menu from one page, set page_context_menu: false in its front matter; see Page parameters.

Create child page opens a new file prefilled from the theme’s assets/stubs/new-page-template.md. Put your own file at the same path in your site, assets/stubs/new-page-template.md, to prefill your own skeleton.

Last modified

The last-modified line comes from Git history, not file modification times, which a checkout resets. Turn on Hugo’s Git support:

hugo.yml
enableGitInfo: true
params:
  github_repo: https://github.com/pgsty/oink.pgsty.com
  ui:
    lastmod_commit: subject # subject | hash | none

The end of the page then reads “Last modified August 17, 2026 · (a1b2c3d)”, and the commit part links to …/commit/<hash>. lastmod_commit chooses that commit part:

Value What is shown
subject (default) The commit subject plus the abbreviated hash
hash commit a1b2c3d
none The date only, with no commit link

Any other value warns (invalid params.ui.lastmod_commit) and uses subject.

In CI, set fetch-depth: 0 on the checkout step: a shallow clone, the default in GitHub Actions, contains only the latest commit, so every page shows that commit’s date or none at all. Deploy has the complete workflows. A file you have not committed yet has no Git date, so a new page previewed locally shows no last-modified line. If your build has no Git history at all, leave the line off rather than substituting the build time, which says nothing about when the content changed.

The line belongs to the page’s annotation block, which is on by default; annotation: false turns the block off for one page. The same block also shows where a page came from, driven by its front matter with no template override:

  • Upstream attribution: on a page derived from someone else’s work, set upstream_link with the four required keys upstream_name, upstream_copyright, upstream_license and upstream_notice. The page end then names the work, its copyright holder and license, and links to the full notice. Add upstream_modified: true to say the page was changed downstream.
  • Translation notice: set params.ui.translation_notice to the language code of the authoritative version, and translated pages link back to the original. A page written natively in its own language opts out with translation_notice: false.

Both families are defined in full in Page parameters. To change the block itself, override the narrowest of three partials:

layouts/_partials/annotation-items.html
Add, remove or reorder the lines, keeping the theme’s markup, icons, print rules and accessible label
layouts/_partials/page-meta-lastmod.html
Replace the markup those lines render as
layouts/_partials/page-annotation.html
Replace the block’s outer container

What the page end is made of

Every reading layout ends a page with the same five blocks, always in this order:

Order Component Theme default Page switch
1 Share Off (params.ui.share is empty) share: false, or the page’s own list
2 Feedback Off feedback: true / false
3 Annotation On annotation: false
4 Pager On for docs / book / blog pager: false
5 Comments On when fully configured comments: false

The order follows what a reader does after the last paragraph: pass the page on, say whether it helped, check where it came from, move to the next page, join the discussion. Share comes first because a reader who wants to pass a page on has decided that before being asked whether it helped. The share bar is configured in Writing a blog, the pager in Navigation and menus, and comments in Comments.

The feedback widget

The feedback widget asks “Was this page helpful?” with Yes and No buttons, and after No offers four optional reasons, so you learn which pages fail readers without running a survey. It is off by default:

hugo.yml
params:
  ui:
    feedback:
      enable: true
      reasons: true # whether to ask for a reason after "no"

A blog usually keeps just comments, so you may prefer to turn the widget on for the documentation section only, with a cascade:

content/docs/_index.md
---
title: Docs
cascade:
  feedback: true
---
  • One click completes it: there is no text box, no submit button and no sign-in.
  • The browser keeps the choice in localStorage per page and language, so a returning reader sees it and can change it.
  • When the site has Google Analytics (gtag), the widget sends a docs_feedback event with result (solved / not_solved), page_path and language. Choosing a reason sends a second event that adds reason and refinement: true, so it is not counted twice. Without analytics the widget still works and reports nothing; it needs no backend.
  • When the page has comments, an “Add details in the comments” link appears under the answer. The widget never writes a comment on the reader’s behalf.

This page turns the widget on in its front matter, so you can try it at the end of the page.

The contributor wall

The contributors shortcode shows a grid of GitHub avatars for the people behind a project. It reads a file in your site’s data/ directory and never contacts GitHub at build time:

data/contributors.yaml
items:
  - github: Vonng
    name: Ruohang Feng
    role: Theme author
  - github: pgsty
    name: Pigsty
    role: Project organization
  - github: gohugoio
    role: Static site generator
    avatar: /icons/logo.svg
Source
{{</* contributors */>}}
  • github is required and must be a valid GitHub username; a repeated username warns and is skipped.
  • name defaults to the username, and role is optional.
  • url defaults to https://github.com/<github>.
  • avatar is optional. Without it the entry shows an initial and the page makes no network request; with it, the value must be an http(s):// URL or a path from the site root.

For several lists, keep one data file per list and name it with data=; class= adds classes for your own CSS:

Source
{{</* contributors data="maintainers" */>}}

In Markdown and RSS output, the grid becomes a list of - [@handle](url) — role lines.

This site has no data/contributors.yaml

The example therefore does not render on this page. Add a data file to data/ to render it.

Verify

From your site’s root, build and list the action links of a page whose source belongs to the configured repository. Replace the example path with one of your own pages:

hugo --printPathWarnings
PAGE=public/docs/getting-started/index.html
test -f "$PAGE" && grep -o '<a[^>]*data-td-action[^>]*>' "$PAGE"
  • The link with data-td-action="edit_page" points to github.com/<your repository>/edit/<branch>/<source path>, and every segment of the source path matches the real file.
  • A section index (_index.md) gets a correct source path too.
  • The page end shows a last-modified line, except on a new page that is not committed yet.
  • Page parameters — annotation / feedback / pager / page_context_menu and the other page switches
  • Configuration — full definitions of github_*, ui.lastmod_commit and ui.feedback
  • Comments — the last block at the page end
  • Analytics and SEO — where feedback events are sent
  • AI-agent support — the Markdown and assistant entries in the action menu

5.13 - Print

Print one page with the browser’s Cmd/Ctrl+P. Use the print output format to combine a section into one continuous document.

Documentation ends up on paper more often than you might expect: a runbook taken into a server room with no network, a chapter handed out at a training, a PDF attached to a change request. Any single page already prints cleanly with the browser’s Cmd/Ctrl+P: the navbar, sidebar, outline and buttons carry Bootstrap’s d-print-none class and stay off the paper, so the theme needs no “print this page” button. For a whole section or book, turn on the print output format. Every section then gets a print view that joins its pages, in sidebar order, into one document with a table of contents, ready to print or save as a PDF.

Enabling whole-section print

The theme defines the print output format but leaves it to the site, because it adds a page per section to every build. Add it to section in your hugo.yml:

hugo.yml
outputs:
  home: [HTML, markdown, LLMS]
  page: [HTML, markdown]
  section: [HTML, RSS, print, markdown]

Each key under outputs replaces the list for that page kind rather than adding to it, so keep every format the kind already had (here HTML, RSS and markdown); a format you leave out is no longer generated.

Each section’s print view lives under _print, which comes right after the language prefix:

Page Print view
/docs/customize/ /_print/docs/customize/
/docs/ /_print/docs/
/blog/release/ /_print/blog/release/

Readers reach it through Print entire section in the page action menu, or by searching the command palette for the same action (print_section). It prints the section the page belongs to: from /docs/customize/print/ it prints the whole Customization section, not just this page.

The structure of a print view

A print view contains, from top to bottom:

  1. A notice: “This is the multi-page printable view of this section. Click here to print. Return to the regular view of this page.” It appears on screen only, never on paper.
  2. The section title and summary.
  3. A table of contents for the whole section, numbered 1:, 2:, 2.1: by level and linked to anchors in the document.
  4. Every page in turn, titled “number - title” (for example “1 - Configuration”), with its description as a standfirst and its body unchanged.

Pages follow the sidebar order (weight), with subsections expanded in place. Every page after the first starts on a new sheet. The first page does so only when the section index’s own body is longer than 50 words, so that an index of one sentence does not waste a sheet. To change the threshold:

hugo.yml
params:
  print:
    section_break_wordcount: 120

To leave out the table of contents for the whole site:

hugo.yml
params:
  print:
    toc: false

or for one section, in its index’s front matter:

content/docs/components/_index.md
---
title: Components
print:
  toc: false
---

Excluding pages

Some pages add nothing on paper: a page of links, a redirect note, a single large screenshot. Set no_print to leave one out:

content/docs/about/showcase.md
---
title: Showcase
no_print: true
---

no_print affects only the section print view; the page itself still prints with Cmd/Ctrl+P. Sidebar dividers (sidebar_divider) are left out automatically, but when a divider is a section, its child pages stay in the print sequence.

How components look in print

On paper, nothing can be clicked or expanded, so the same rule applies to the section print view and to a single page printed from the browser: interactive components become static, and collapsed content is printed open.

Component Print shape
Callouts Static blocks. All collapsible kinds (- / + / DETAILS) expand. Borders turn gray and backgrounds are removed
Tabs The tab bar disappears and every panel is printed in turn, each under its own heading
Code Blocks Copy and fold controls removed, maximum height and scrolling dropped, long lines wrapped
Tables Complete static tables. On screen the print view keeps keyboard scrolling; on paper the table expands and its header repeats on every page
Images Image and caption kept, zoom removed, width limited to the text column
Gallery The grid becomes a vertical stack
FileTree A static panel with every directory expanded. A split layout keeps its build-time width
Fields The complete definition list, the same as on screen
Math Statically rendered KaTeX / MathML
Mermaid The print view keeps the source and loads no engine. A browser-printed page shows the rendered diagram, or the source if it has not rendered
Markmap The print view keeps the outline source and loads no runtime. A browser-printed page shows the rendered map without its floating notes, or the source if it has not mounted
PlantUML The print view keeps the source and loads no runtime. A browser-printed page shows the rendered image, or the source if it has not rendered
ECharts · Infographic The print view keeps the fenced source and draws no chart. A browser-printed page shows the rendered chart, or the declared options / DSL if it has not mounted
Asciinema · OpenAPI A labeled static link to the recording or specification; none of the three runtimes loads
Timeline · Updates Static axis or heading + metadata line on the light paper palette; avoids page breaks inside entries
Video · Audio Static figure with poster (for video), caption and visible file or watch URL; no <video>, <audio> or <iframe> in the print view
Social Static quoted card with author, body, attachments and original-post link on the paper palette
Maps Numbered place list with coordinates and links; no Leaflet map canvas
Cards / steps / badges / keys Static, with content unchanged

Besides the shell, print leaves out the page action menu, the feedback widget, heading anchor links and inline copy buttons. Before printing a page with diagrams from the browser, wait until they have finished drawing.

Browser print styles

A set of @media print rules, shared by single pages and section print views, lays the page out for paper:

  • A4 paper with 18mm 16mm 20mm margins, 10.5pt body text, and the light palette even when the reader browses in dark mode.
  • Text uses the --td-print-font-family typography token; see Brand and appearance.
  • Headings stay with the text that follows them (break-after: avoid-page), and paragraphs and list items keep at least three lines together at a page break.
  • Tables, images, blockquotes, callouts, cards and tabs avoid breaking across pages where they can. Code blocks may break, and long lines wrap rather than being cut off.
  • A closed <details> always prints open, so collapsed callouts and file tree directories show their content.
  • Links are dark blue and underlined, without the URL printed after them. If your readers need the addresses on paper, add them:
assets/css/project.css
@media print {
  .td-content a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
    word-break: break-all;
  }
}

Put any other print styling in a @media print block in assets/css/project.css; no template change is needed.

Copying into rich-text editors

Readers also copy articles into WeChat, Word or an email. When they copy part of an article and paste it into a rich-text editor, they get typeset text in the same light palette print uses, without the page background, dark-mode colors, heading anchors, copy buttons or line numbers. Selecting the whole page (⌘/Ctrl+A) copies only the article: title, description and body.

  • Headings, lists, quotes, callouts, tables and code blocks keep their structure, with sizes in pixels, so editors that drop stylesheets still show them correctly.
  • Code blocks keep their syntax colors. Copied in dark mode, a code block stays a dark card while the prose around it is dark text on white.
  • A few words selected inside one paragraph copy without formatting and take the style of the document they are pasted into.
  • Pasting as plain text is unchanged.

To restyle the pasted result, override the print palette, for example --td-print-ink or --td-print-quote-line, in assets/css/project.css. To keep the browser’s own copy behavior, set rich_copy: false for the site, or in a page’s front matter for that page:

hugo.yml
params:
  ui:
    rich_copy: false

Each editor filters pasted HTML in its own way, so check an important article in the editor you publish to.

Replacing the print templates

To change the structure, for example to add a running header or a different numbering, override the narrowest partial under layouts/_partials/print/:

print/render.html
The section view’s skeleton: notice, table of contents, the pages in order
print/page-heading.html
The title and standfirst at the top of the document
print/content.html
How one page appears inside the section view
print/toc-li.html
One row of the table of contents

The last three can also be overridden for one content type: a file such as print/page-heading-blog.html or print/content-book.html takes precedence over the generic partial for pages of that type.

A whole book (type: book) prints through its own path, which keeps chapter numbers, figure numbers and cross-references continuous across the book; see Books.

Verify

From your site’s root, build and check that a section where you enabled print has its print view. Replace the example path with that section’s output, including its language prefix if it has one:

hugo --printPathWarnings
PRINT_PAGE=public/_print/docs/index.html
test -f "$PRINT_PAGE"

Then open Print entire section on the running site:

  • The print view contains the section’s pages, without those marked no_print: true.
  • Cmd/Ctrl+P shows no notice, navbar or buttons in the preview.
  • On a page with tabs and a collapsed callout, every panel is open in the preview.
  • In a saved PDF, the page breaks fall where you want them; if not, adjust section_break_wordcount.

5.14 - AI-agent support

Publish a Markdown copy of every page and an llms.txt index, so AI agents and chat assistants can read the site without scraping its HTML.

More and more of your readers arrive through a language model: a coding agent looking up an option, or a person pasting a page into a chat to ask about it. An HTML page is a poor source for them, because the sidebar, scripts and styles have to be stripped away before the content appears, and what survives is a lossy copy. OINK can publish the same content as plain Markdown instead, so a model reads exactly what you wrote and spends its context on the content.

Three outputs do this: a .md file beside every page, an llms.txt index at the site root that tells an agent what the site contains, and a Copy Markdown button on each page. All three are files written at build time, so they need no runtime service and no content negotiation. The theme turns none of them on; you list them under outputs. Two more outputs serve an agent that reads more than one page: a full-text bundle per top-level section and a navigation tree per language.

A .md per page

markdown is one of Hugo’s built-in output formats. Add it to every page kind that should have one:

hugo.yml
outputs:
  home: [HTML, markdown, LLMS]
  page: [HTML, markdown]
  section: [HTML, RSS, print, markdown]

This is the configuration this site uses. Each key under outputs replaces the list for that page kind rather than adding to it, so keep every format the kind already had, such as RSS and print; a format you leave out is no longer published.

The Markdown file sits at the page URL plus index.md:

Page Markdown
/docs/customize/agents/ /docs/customize/agents/index.md
/docs/customize/ (section index) /docs/customize/index.md
/ (site home) /index.md

Every HTML page also announces its Markdown version in <head>, so a crawler does not have to guess the URL:

<link rel="alternate" type="text/markdown" href="https://oink.pgsty.com/docs/customize/agents/index.md">

What the .md contains

The file holds the source you wrote, not a conversion of the rendered HTML. The title becomes an H1 and the description a blockquote, then the body follows as written, with shortcodes expanded in place into their Markdown forms:

the start of /docs/customize/print/index.md
# Print

> A single page goes to the browser's Cmd/Ctrl+P; a whole section becomes one continuous document through the print output format.

---

LLMS index: [llms.txt](/llms.txt)

---

Printing one page needs no configuration: the shell (sidebar, outline, navbar,
buttons) all carries `d-print-none`, so the browser's `Cmd/Ctrl+P` yields a
clean body.

Native Markdown components keep their source: callouts, tables, field lists, image attribute lines, code fences and data fences reach the model exactly as you wrote them. A section index adds a Section pages: list of links to its children after the body, and when backlinks are on, a page ends with a Backlinks: list. Every list and label in the file is in the page’s language.

Each shortcode has a defined Markdown form. A badge becomes emphasized text or a link, a key becomes Ctrl + K, tabs become consecutive **Label** subsections, and fields become an item list. Each component page gives its own form in its Output section.

The LLMS index: line appears only when the site publishes llms.txt, so the file never links to something that does not exist.

llms.txt

llms.txt is a convention for a small plain-text map at the site root: an agent fetches one file and learns what the site contains and where the Markdown versions are. Add the LLMS output format to the home page to publish it:

hugo.yml
outputs:
  home: [HTML, markdown, LLMS]

A multilingual site gets one per language, /llms.txt and /zh/llms.txt, each generated from the site’s structure:

/llms.txt (excerpt)
# OINK

> A local-first Hugo theme for technical documentation

## Site index

- [Home page](https://oink.pgsty.com/index.md)
- [navigation.json](https://oink.pgsty.com/navigation.json)
- [Docs](https://oink.pgsty.com/docs/index.md): Build a technical content site…
- [Blog](https://oink.pgsty.com/blog/index.md): Oink engineering notes, design stories, and reading shell guides

## Documentation index

- [Introduction](https://oink.pgsty.com/docs/about/index.md): A local-first Hugo documentation framework that evolved from Docsy…
  - [Highlights](https://oink.pgsty.com/docs/about/features/index.md): Compare OINK with an ordinary Hugo theme…
  - [Cases](https://oink.pgsty.com/docs/about/showcase/index.md): Find the OINK production case closest to your site…
- [Get started](https://oink.pgsty.com/docs/start/index.md): Start from the official OINK Starter…
…

## Full-text bundles

- [Docs](https://oink.pgsty.com/docs/llms-full.txt)

## Site locales

- [English](https://oink.pgsty.com/index.md)
- [简体中文](https://oink.pgsty.com/zh/index.md)
  • Site index lists this language’s home page, its navigation.json when the site publishes one, and the entries of the main menu (menus.main), linking each entry’s Markdown version when it has one and adding its description.
  • Documentation index lists every page of the documentation section, each indented under its subsection and followed by its description.
  • Full-text bundles appears when at least one section publishes a bundle.
  • Site locales lists every configured language.

Menu entries that point off the site, such as GitHub or an issue tracker, are left out: they are navigation, not content. So to improve llms.txt, edit the main menu and each page’s description; the template rarely needs to change.

Full-text bundle

A .md per page suits an agent that knows which page it wants. An agent that needs the whole manual would otherwise crawl it page by page. The LLMSFULL output gives it one file instead: an llms-full.txt per top-level section, holding every page of that section in reading order.

You turn it on in the section index’s own front matter, not in the site configuration:

content/docs/_index.md
---
title: Docs
outputs: [HTML, print, RSS, markdown, LLMSFULL]
---

Front matter outputs replaces the site-level list for that page, so repeat the formats the section already had; leave out markdown or print and the section index loses them. Front matter is per language, so a bilingual site repeats the line in _index.zh.md to get the Chinese bundle.

Each language gets one file at the section root, /docs/llms-full.txt and /zh/docs/llms-full.txt, in the order of the sidebar and pager: the explicit data/docs_nav.json tree for a docs or book section that has one, and the weighted content tree otherwise. Pages hidden from the sidebar with toc_hide are left out of the bundle too.

A separator line with the source URL introduces each page, and the body that follows is byte for byte that page’s own .md:

/docs/llms-full.txt (excerpt)
================
Source: https://oink.pgsty.com/docs/customize/print/index.md
================

# Print

> A single page goes to the browser's Cmd/Ctrl+P; a whole section becomes one continuous document through the print output format.
…

================
Source: https://oink.pgsty.com/docs/customize/agents/index.md
================

# AI-agent support
…

Source: points at the page’s Markdown output, or at its HTML URL when the page publishes no .md.

Only a top-level section can publish a bundle. Listed further down the tree, LLMSFULL produces a warning (“LLMSFULL output requires a top-level section”) and no file. Every published bundle is listed under ## Full-text bundles in that language’s llms.txt, so an agent finds it in the file it already reads.

This site’s docs section publishes one: https://oink.pgsty.com/docs/llms-full.txt is the entire English documentation in one file.

Navigation JSON

The sidebar is the site’s table of contents, and an agent that can read it can plan which pages to fetch before fetching any. The NAVJSON output publishes that tree as navigation.json, one file per language at the language root. Turn it on for the home page:

hugo.yml
outputs:
  home: [HTML, markdown, LLMS, NAVJSON]

This produces /navigation.json and /zh/navigation.json, built from the same tree as the sidebar and pager: the explicit data/docs_nav.json tree for a docs or book section that has one, and the weighted content tree elsewhere:

/navigation.json (excerpt)
{
  "baseURL": "https://oink.pgsty.com/",
  "language": "en",
  "root": {
    "children": [
      {
        "children": [
          {
            "description": "Publish a Markdown copy of every page and an llms.txt index…",
            "id": "/docs/customize/agents/",
            "kind": "page",
            "markdown": "https://oink.pgsty.com/docs/customize/agents/index.md",
            "title": "AI-agent support",
            "url": "https://oink.pgsty.com/docs/customize/agents/"
          }
        ],
        "id": "/docs/",
        "kind": "section",
        "title": "Docs",
        "url": "https://oink.pgsty.com/docs/"
      }
    ],
    "id": "/",
    "kind": "home",
    "title": "OINK",
    "url": "https://oink.pgsty.com/"
  },
  "schemaVersion": 1
}
Key What it holds
id The page path without its language prefix. The same page has the same id in every language
url The absolute URL of this language’s HTML page
markdown The absolute URL of the page’s .md, present only where the page publishes one
title The navigation title (linkTitle, falling back to title)
description The page’s description, where it has one
kind home, section, or page for real pages. external or link for placeholders
children The ordered children, where the node has any

Array order is part of the contract. The theme has already applied the sidebar order and does not serialize weight, so a consumer that sorts the array again ends up with an order that no longer matches the sidebar.

Placeholder rows keep the sidebar’s structure. A manual_link entry becomes an external node with the URL as written, and a manual_link_relref entry becomes a link node with the resolved reference. Neither is a page, so neither has an id or a markdown URL. Sidebar dividers and pages Hugo never renders are left out, while their children stay in place.

The format is versioned: schemaVersion is 1, and the theme repository publishes its JSON Schema as schema/nav.v1.schema.json. Validate the file against it if you consume it. When a language publishes navigation.json, its llms.txt lists the file in the site index.

This site publishes it: https://oink.pgsty.com/navigation.json is the live tree.

Agent actions on the page

The page-action menu at the right end of the breadcrumb row has four entries for agents and chat assistants:

Entry What it does When it appears
Copy Markdown Copies this page’s .md to the clipboard. It prefetches on hover, so the copy feels instant This page has a markdown output
View markdown Opens the .md in a new tab This page has a markdown output
Open in ChatGPT Opens ChatGPT with a prompt about this page assistant_links: true
Open in Claude Opens Claude with a prompt about this page assistant_links: true

The first two come with the markdown output. Copy Markdown is also the left half of the split button, shown as a clipboard icon that briefly turns into a check mark after a successful copy.

The two assistant entries are off until you turn them on:

hugo.yml
params:
  ui:
    page_context_menu:
      enable: true
      assistant_links: true

When a reader clicks one, the page builds a prompt from the full URL in the address bar, including the real domain, query string and anchor. In English the prompt reads “Read from so I can ask questions about it.”, and the other site opens with it. Only the URL leaves your site; the page body is never uploaded, and the assistant fetches the content itself. Keep confidential information out of URLs, and mention this third-party hand-off in the site’s privacy statement.

A page can narrow the site policy but not widen it. In front matter, page_context_menu: { assistant_links: false } removes the assistant links from that page, while true has no effect when the site has not turned them on. page_context_menu: false removes the whole menu from a page. See Page parameters.

Your own entries go in params.ui.page_context_menu.links. This site uses one to add a Markdown index entry that opens llms.txt, and sets it per language so that the label is translated:

hugo.yml
languages:
  en:
    params:
      ui:
        page_context_menu:
          links:
            - { name: Markdown index, url: llms.txt, icon: fa-solid fa-list }

The command palette offers the same assistant actions, from the same action list; see Command palette.

Opting a page out of .md output

Set outputs in the page’s front matter. It replaces the whole list, so name only the formats you want to keep:

content/legal/terms.md
---
title: Terms of service
outputs: [HTML]
---

To drop only Markdown and keep a section’s feed and print view, list the rest:

content/blog/_index.md
---
title: Blog
outputs: [HTML, RSS, print]
---

Customizing the output

Most problems with these files are content problems: when llms.txt reads badly, fix the main menu and the description fields before you touch a template. When you do need a different shape, the theme renders the .md output with layouts/all.md, llms.txt with layouts/index.llms.txt, and the two optional outputs with layouts/list.llmsfull.txt and layouts/index.navjson.json. A file of the same name under your site’s layouts/ replaces the theme’s, but a narrower override is usually less work to maintain:

  • Per content type: a typed path such as layouts/blog/single.md or layouts/docs/list.md affects only that kind of content, the way the theme’s own print templates specialize (layouts/blog/single.print.html). Check Hugo’s template lookup order for your combination.
  • Per shortcode: a site shortcode can have an output-format-specific template that gives it a more machine-readable form in Markdown.
  • Per page: for a handful of important pages, writing the content by hand is cheaper than changing a template.

Replacing index.navjson.json makes you responsible for the nav.v1 format: your output must still validate against schema/nav.v1.schema.json for consumers that check it.

Verify

Run these from your site’s root after enabling the Markdown and LLMS outputs. Set PAGE_MD to the generated Markdown file of a real page; the paths assume a docs section, so adjust them and any language prefix to your site:

hugo --printPathWarnings
PAGE_MD=public/docs/getting-started/index.md
ls "$PAGE_MD" public/llms.txt
# Only if you enabled LLMSFULL on docs and NAVJSON on home:
ls public/docs/llms-full.txt public/navigation.json

Against a running preview or the production site, use your own base URL and page path. BASE_URL includes any deployment subpath and, for a translated site, the language prefix:

BASE_URL=https://your-site.example/
PAGE_PATH=docs/getting-started/index.md
curl -fsS "${BASE_URL}${PAGE_PATH}" | head -5
curl -fsSI "${BASE_URL}llms.txt" | head -3
# Only if you enabled LLMSFULL on docs:
curl -fsS "${BASE_URL}docs/llms-full.txt" | head -3

Then check four things:

  • The page’s HTML <head> has rel="alternate" type="text/markdown";
  • Clicking the copy button beside the breadcrumbs and pasting gives Markdown, not HTML;
  • llms.txt contains no off-site links;
  • If you enabled them, every page in llms-full.txt starts with a Source: line, and a page has the same id in every language’s navigation.json.

Limits

  • The theme produces four kinds of machine-readable file: a .md per page, llms.txt, and, when you enable them, llms-full.txt per top-level section and navigation.json per language. sitemap.xml remains Hugo’s own.
  • Bundles belong to top-level sections, and there is no whole-site llms-full.txt. An agent that wants everything reads the section bundles that llms.txt lists.
  • LLMS, LLMSFULL and NAVJSON get no <head> alternate link and no page action. Agents find them at their conventional paths and through llms.txt.
  • Serving Markdown from the page URL itself when a client sends Accept: text/markdown is content negotiation, which belongs to your web server or host, not the theme.
  • The Markdown output is built from the source, so anything drawn only in the browser, such as a chart rendered at runtime, appears in the .md as its fence source, not as a picture.

6 - Operations

Take a finished site from your machine to a live address and keep it running there.

Once the content is written, this section gets it online and keeps it there: previewing changes on your machine, building and hosting the output, adding comments and analytics, upgrading the theme, and finding out why a build or a page went wrong.

Find it by task

I want to… Read
See my changes as I write Local preview
Build the public/ directory I deploy Local preview
Publish to GitHub Pages, Cloudflare Pages, Netlify or my own server Deploy
Serve the site under a subpath such as example.com/docs/ Deploy
Keep preview deployments out of search engines Deploy
Let readers comment at the end of a page Comments
Count visits with Google Analytics, Plausible or another service Analytics and SEO
Check that search engines index the site correctly Analytics and SEO
Upgrade OINK, or migrate from Docsy or OINK 0.4 Upgrade
Fix a build error, empty search results or a 404 Troubleshooting

6.1 - Local preview

Watch your changes render as you save with hugo server, then build the public/ directory you deploy.

Two commands cover daily work. hugo server rebuilds the site every time you save and reloads the browser for you; hugo writes the finished site to public/, the directory you deploy:

Terminal
hugo server                                                   # preview at http://localhost:1313/
hugo --cleanDestinationDir --gc --minify --printPathWarnings  # build public/ for deployment

Neither needs Node.js, npm or a CDN. The tools they do need, Git, Go and Hugo, are listed in Get started.

The preview server

Run hugo server from the site root, the directory that holds hugo.yml, and open http://localhost:1313/. Each save, and each switch of Git branch, triggers a rebuild and a browser refresh. The first start is slower because Hugo downloads the theme module into its cache; later starts read the cache.

The switches worth knowing

-D / --buildDrafts , defaultoff
Also builds pages with draft: true
-F / --buildFuture , defaultoff
Also builds pages whose date / publishDate is in the future
-E / --buildExpired , defaultoff
Also builds pages whose expiryDate has passed
--disableFastRender , defaultoff
Re-renders the whole site on every change instead of only the pages Hugo thinks changed
-M / --renderToMemory , defaultoff (writes to disk)
Serves from memory and writes nothing to public/
-N / --navigateToChanged , defaultoff
Sends the browser to the page you just saved
--bind , default127.0.0.1
The listen address; use 0.0.0.0 to reach the server from your LAN or from outside a container
-p / --port , default1313
The listen port
--minify , defaultoff
Minifies the preview as well, to reproduce production rendering
--printPathWarnings , defaultoff
Warns when two pages write to the same output path

A good combination while writing:

Terminal
hugo server -DFE \
  --disableFastRender --renderToMemory --minify \
  --printPathWarnings --logLevel info

-DFE is short for -D -F -E, so drafts, future-dated and expired pages all appear while you work on them. --renderToMemory keeps those pages out of public/, so a later deploy cannot pick them up by accident.

A change that did not take effect

By default Hugo re-renders only what it judges affected by a change, and edits to layouts, configuration, data/ or an included file sometimes slip past that judgment. When a page looks unchanged:

  1. Restart with --disableFastRender.
  2. Force a browser reload (Cmd/Ctrl + Shift + R) to rule out the browser cache.
  3. If the page is still stale, clear the caches and restart.

Reaching it from another device

The server listens on 127.0.0.1 only, so a phone or another computer cannot reach it. Bind to every interface and give the address the other device will use:

Terminal
hugo server --bind 0.0.0.0 --port 1313 --baseURL http://192.168.1.10:1313/

Without --baseURL, the page opens but its absolute links, the stylesheet and the search index among them, still point at localhost.

Production build

Build what you deploy with hugo, never with hugo server:

Terminal
hugo --cleanDestinationDir --gc --minify --printPathWarnings

The output in public/ is self-contained, so you can copy it anywhere without the source tree. Each switch earns its place:

--cleanDestinationDir
Deletes files the current build did not write, so a page you removed does not stay live
--gc
Removes processed resources in resources/_gen that nothing references any more
--minify
Minifies the HTML, CSS, JS and XML output
--printPathWarnings
Warns when two pages claim the same output path, the most common silent error on a multilingual site

A successful build ends with a Total in … line. Read any warnings before you deploy: each one names a setting the theme ignored, and the build kept going with a safe default.

Two settings matter as soon as the output leaves your machine. baseURL decides every absolute link, including a subpath such as /docs/; see Getting baseURL right. The build environment, production for hugo and development for hugo server, decides whether pages ask to be indexed and whether analytics load; see Keeping preview deployments unindexed.

Previewing in a container

A container is optional. It helps when a team wants everyone on the same toolchain, or does not want Hugo installed on every machine.

Dockerfile
FROM debian:bookworm-slim

ARG HUGO_VERSION=0.170.1
ARG TARGETARCH

COPY --from=golang:1 /usr/local/go /usr/local/go

RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates curl git \
    && curl --fail --location -o /tmp/hugo.deb \
      "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-${TARGETARCH}.deb" \
    && apt-get install -y /tmp/hugo.deb \
    && rm -rf /var/lib/apt/lists/* /tmp/hugo.deb

ENV PATH="/usr/local/go/bin:${PATH}"
WORKDIR /src
EXPOSE 1313
ENTRYPOINT ["hugo"]
CMD ["server", "--bind", "0.0.0.0", "--disableFastRender"]
Terminal
docker build -t oink-hugo .

# preview: mount the site source, and the Go module cache with it
docker run --rm -it -p 1313:1313 \
  -v "$PWD:/src" \
  -v "$HOME/go/pkg/mod:/root/go/pkg/mod" \
  oink-hugo

# production build: override the default server command
docker run --rm --user "$(id -u):$(id -g)" \
  -v "$PWD:/src" \
  oink-hugo --gc --minify

Set HUGO_VERSION to the release your team builds with (OINK is tested on 0.170+). A site still pinned to OINK 1.5.1 or older needs a different package; see Upgrade.

Go is in the image because Hugo needs it to download a theme installed as a Hugo Module. A site that uses a submodule, an offline archive or a plain clone can drop Go and get a much smaller image. Nothing in the image needs Node.js, npm or PostCSS, and the build fetches no browser assets, so for a network-isolated environment you only have to mirror the base image and the Hugo and Go packages.

Do not let root write public/

A container runs as root unless told otherwise, and a public/ written by root cannot be deleted from the host without sudo. Map your user ID with --user "$(id -u):$(id -g)", as the production build command above does.

Clearing caches

Hugo keeps intermediate output in three places. Clear the smallest one that explains the symptom:

public/ , HoldsThe previous build’s output
A deleted page is still live. hugo --cleanDestinationDir does this as part of the build
resources/_gen/ , HoldsProcessed images
You changed image processing, fonts or the accent color and the page still looks old
hugo mod clean , HoldsThe Hugo Module cache
You changed the theme version and the old one still resolves. Add --all to clear the whole module cache
Terminal
rm -rf public resources/_gen
hugo mod clean          # only the modules this project uses
hugo mod clean --all    # the whole module cache; the next build downloads again

List both public/ and resources/ in .gitignore. They are regenerated on every build, and committed copies go stale and bloat the repository.

Previewing against a theme checkout

When you change the theme and the site together, point the preview at your local theme checkout for one command with HUGO_MODULE_REPLACEMENTS. go.mod stays untouched, so the substitution cannot be committed by accident:

Terminal
HUGO_MODULE_REPLACEMENTS='github.com/pgsty/oink -> /absolute/path/to/oink' hugo server

From scratch shows the directory layout and the Go workspace alternative.

A replacement hides the version you pinned

While the variable is set or a Go workspace is active, every build uses the local checkout, whatever go.mod says, and a CI job can inherit either. To build the published release, unset HUGO_MODULE_REPLACEMENTS, set GOWORK=off and HUGO_MODULE_WORKSPACE=off, look for permanent replace directives in go.mod and the Hugo configuration and for a _vendor/ copy, then confirm the exact version with hugo mod graph in that same environment. Never commit a workspace file that names a path on your machine.

Verifying an offline build

If the site must work in a network-isolated environment, test both the build and the browser with the network cut off:

  1. Start from a verified theme archive and an empty module cache (hugo mod clean --all).
  2. Block outbound HTTP, HTTPS and the Go module proxy.
  3. Run the production build hugo --gc --minify --printPathWarnings.
  4. Browse pages in every language: a documentation page, a blog page, the home page, the 404.
  5. Use search, the light/dark toggle, diagrams and the content components the site relies on.
  6. Check every subresource origin and confirm that no unexpected remote host appears.

For the last step, run the output checker from a theme checkout of the same release your site pins. It needs only Python 3. Replace both paths and use the base URL you built with:

Terminal
python3 /path/to/oink/bin/check-output-security.py \
  --public /path/to/my-site/public --base-url https://docs.internal.example.com/

The script reads every href, src, srcset, poster and form action in the HTML, print, Markdown and RSS output. Each must be a site-relative path or use http, https, mailto or tel, and inline on* handlers and javascript: URLs are rejected. An <iframe>, <script>, <link>, <img>, <video>, <audio>, <embed>, <object> or <source> that points to another host is an error. If the site embeds third-party content on purpose, pass --third-party; if its languages live on several domains, list the extra first-party hosts with --allow-host.

A pass covers that build only. Run the check again after every theme upgrade.

Verify

Start from empty caches so nothing stale hides a problem:

Terminal
rm -rf public resources/_gen
hugo --gc --minify --printPathWarnings

The build passes when it ends with Total in … and reports no ERROR. Then check:

  • The log shows no npm, PostCSS, Autoprefixer or asset-download step. One that appears comes from leftover Docsy configuration.
  • public/ contains sitemap.xml and robots.txt, and robots.txt reads Allow: /.
  • With local search enabled, public/ holds an index per language, named offline-search-index.<language>.<hash>.json in production (development builds omit the hash). Open search and confirm that the URL in the page’s data-td-index-src attribute returns 200.
  • In hugo server, a documentation page, a blog page, the home page and the 404 render correctly in every language and in both color schemes.

After deployment, repeat the checks on the live site with the deployment checklist. For a build that fails or looks wrong, see Troubleshooting.

6.2 - Deploy

Publish public/ to GitHub Pages, Cloudflare Pages or any static host, with the right baseURL, CI settings, security policy, checks and rollback.

An OINK site builds to a directory of static files, so any host that serves files can serve it, with no Node runtime, server-side rendering or build plugin. Deploying comes down to three things: run the production build, publish public/, and set baseURL to the address readers will use. A site created from the OINK Starter already has GitHub Pages and Cloudflare Pages workflows that do all three.

Getting baseURL right

A wrong baseURL is the most common deployment fault, and a quiet one: pages open, but the search index returns 404, page-action links point elsewhere and some assets fail to load.

At the root of a domain:

hugo.yml
baseURL: https://docs.example.com

Under a subpath such as https://example.com/docs/, include the path:

hugo.yml
baseURL: https://example.com/docs/

You can also override it at build time, which lets one source tree deploy to several addresses:

Terminal
hugo --gc --minify --baseURL "https://example.com/docs/"
Do not fix a subpath with canonifyURLs

Leave canonifyURLs at Hugo’s default, false. OINK’s templates and content links resolve against baseURL, so a wrong path means a wrong baseURL. Turning on canonifyURLs also rewrites relative links that were already correct, which makes the fault harder to find.

With local search enabled, open search on the deployed site and watch the index request in the browser’s Network panel: it must carry the right language and subpath and return 200. Take the URL from the page’s data-td-index-src attribute instead of guessing it, because production filenames include a content hash (offline-search-index.<language>.<hash>.json).

Choosing a host

If the source lives on GitHub, one Actions workflow builds the site and publishes it through the Pages deployment API, with no gh-pages branch to maintain. The OINK Starter ships this file; copy it only when you assemble a site yourself.

.github/workflows/github-pages.yaml
 1name: Deploy to GitHub Pages
 2
 3on:
 4  push:
 5    branches: [main]
 6  workflow_dispatch:
 7
 8permissions:
 9  contents: read
10  pages: write
11  id-token: write
12
13concurrency:
14  group: github-pages
15  cancel-in-progress: false
16
17env:
18  # a workspace from a sibling checkout must never take part in a CI build
19  GOWORK: off
20  HUGO_MODULE_WORKSPACE: off
21  HUGO_CACHEDIR: ${{ github.workspace }}/.hugo_cache
22
23jobs:
24  build:
25    name: Build Pages artifact
26    runs-on: ubuntu-latest
27    steps:
28      - name: Check out source
29        uses: actions/checkout@v7
30        with:
31          fetch-depth: 0
32
33      - name: Set up Go
34        uses: actions/setup-go@v7
35        with:
36          go-version: stable
37          cache-dependency-path: go.sum
38
39      - name: Configure GitHub Pages
40        id: pages
41        uses: actions/configure-pages@v6
42
43      - name: Install Hugo
44        uses: peaceiris/actions-hugo@v3
45        with:
46          hugo-version: latest
47
48      - name: Record build tool versions
49        run: |
50          go version
51          hugo version
52
53      - name: Download OINK
54        run: go mod download github.com/pgsty/oink
55
56      - name: Build
57        run: |
58          hugo --cleanDestinationDir --gc --minify --environment production \
59            --printPathWarnings \
60            --baseURL "${{ steps.pages.outputs.base_url }}/"
61
62      - name: Upload Pages artifact
63        uses: actions/upload-pages-artifact@v5
64        with:
65          path: public
66
67  deploy:
68    name: Deploy
69    environment:
70      name: github-pages
71      url: ${{ steps.deployment.outputs.page_url }}
72    runs-on: ubuntu-latest
73    needs: build
74    steps:
75      - name: Publish
76        id: deployment
77        uses: actions/deploy-pages@v5

Build settings for CI explains each setting; keep them when you edit the file. One is specific to GitHub Pages: --baseURL takes the address that configure-pages computes, https://<OWNER>.github.io/<REPO>/ for a project site, so you never hard-code it.

In the repository, set Settings → Pages → Build and deployment → Source to GitHub Actions, push to main, and watch the first run on the Actions tab.

For a custom domain, enter it under Custom domain on the same settings page, configure DNS as prompted, and set baseURL in hugo.yaml to the new domain. If your publishing process needs a CNAME file, put it at static/CNAME; Hugo copies it unchanged into public/.

The OINK Starter ships .github/workflows/cloudflare-pages.yaml, a Direct Upload workflow: the production build runs in GitHub Actions with the same build settings as the GitHub Pages workflow, and Wrangler uploads the resulting public/ to a Cloudflare Pages project. It is the recommended path for Starter sites.

  1. Create a Direct Upload Pages project. Its name defaults to the repository name; to use another, set the repository variable CLOUDFLARE_PROJECT_NAME.
  2. Add the repository secrets CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN. The token needs Account → Cloudflare Pages → Edit.
  3. Run Deploy to Cloudflare Pages once by hand. To deploy every push to main, set the repository variable CLOUDFLARE_PAGES_ENABLED=true.
  4. The canonical URL defaults to https://<project>.pages.dev/. When a custom domain becomes production, set CLOUDFLARE_SITE_URL to it.

Cloudflare’s Git integration also works, with Cloudflare running the build: set the build command to hugo --gc --minify --printPathWarnings, the output directory to public, and HUGO_VERSION to a current release such as 0.170.1 (OINK is tested on 0.170+, while Cloudflare’s default image ships an older Hugo). Choose one mode per project, Git integration or the Direct Upload workflow, and build preview deployments with their own URL and a non-production environment.

On a custom domain, Cloudflare can mistake module@version in an install command for an email address. This documentation site adds no-transform to the HTML response’s Cache-Control header in static/_headers. After deploying, open an install example on the production domain with JavaScript disabled and copy the command. Cloudflare email obfuscation

Netlify — set the build command to hugo --gc --minify, the publish directory to public, and the HUGO_VERSION environment variable. The same settings can live in the repository:

netlify.toml
[build]
command = "hugo --gc --minify --printPathWarnings"
publish = "public"

[build.environment]
# override the platform's default with a current Hugo release (tested on 0.170+)
HUGO_VERSION = "0.170.1"

A theme installed as a submodule needs recursive submodule checkout enabled; one installed as a Hugo Module needs Git and Go in the build image. Build previews with the same Hugo release as production, unless the preview exists to test an upgrade.

Vercel — set the build command to hugo --gc --minify, the output directory to public, and the HUGO_VERSION environment variable. There is no npm install step.

Any static server (Nginx, Caddy) — serve an unchanged copy of public/. The example serves /var/www/oink/current, a symlink to a release directory that the offline packaging steps below create:

/etc/nginx/conf.d/docs.conf
server {
    listen 80;
    server_name docs.example.com;
    root /var/www/oink/current;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }

    error_page 404 /404.html;
}

The site is purely static, so there is nothing to proxy to an application server.

Object storage — Hugo’s deploy command uploads to S3, Google Cloud Storage or Azure. Name the target in the configuration:

hugo.yml
deployment:
  targets:
    - name: aws
      URL: 's3://www.your-domain.tld'
      cloudFrontDistributionID: E9RZ8T1EXAMPLEID

After a build, hugo deploy compares the bucket with public/, uploads only what changed, and invalidates the CDN cache when cloudFrontDistributionID is set. Without --target it uses the first target; run it with --dryRun first to see what it would change. The Hugo binary must be built withdeploy (check hugo version), and the cloud credentials come from the provider’s standard environment variables or configuration file; on AWS, confirm access with aws s3 ls first.

Offline packaging — for a network-isolated server, build on a connected machine with the target’s baseURL and carry the output over as one archive. Give every archive a new release name:

Terminal
hugo --cleanDestinationDir --gc --minify --baseURL "https://docs.internal.example.com/" &&
  tar -czf oink-site-20260929-01.tar.gz -C public .

On the Linux host you need write access to /var/www/oink and GNU mv; current must be absent or a symlink, and current.next must not exist. Unpack each release into a new directory and switch current to it:

Linux host
release_dir=/var/www/oink/releases/20260929-01
mkdir -p /var/www/oink/releases
mkdir "$release_dir" &&
  tar -xzf oink-site-20260929-01.tar.gz -C "$release_dir" &&
  test -f "$release_dir/index.html" &&
  ln -s "$release_dir" /var/www/oink/current.next &&
  mv -Tf /var/www/oink/current.next /var/www/oink/current

The chain switches current only after the directory was created, the archive extracted and index.html found, and the final mv replaces the link in one step, so readers never see a half-written site. Never unpack over an existing release directory, and keep the previous one: it is your rollback. A different baseURL means a new build, not an edit of the output.

A host without Go — a theme installed as a Hugo Module needs Go in the build environment. Where the platform has none, install the theme as a Git submodule (run git submodule update --init before the build) or commit an offline archive under themes/oink/; see From scratch and other install methods.

Build settings for CI

These settings belong in any CI build of an OINK site, whichever host receives the output. The Starter’s workflows already contain them.

  • fetch-depth: 0 on checkout — with enableGitInfo, last-modified dates and contributor lists come from Git history, and a shallow clone gives every page the same date.
  • Go, then go mod download github.com/pgsty/oink — Hugo needs Go to fetch a theme installed as a Hugo Module. A submodule install checks out with submodules: recursive instead, and an offline archive is committed under themes/oink/; either way, drop both Go steps.
  • GOWORK: off and HUGO_MODULE_WORKSPACE: off — keep a developer’s Go workspace out of the build, so CI builds the release pinned in go.mod and nothing else.
  • Hugo latest — OINK uses plain CSS and is tested on Hugo 0.170+, so CI can follow current releases. A site still pinned to OINK 1.5.1 or older cannot; see Upgrade.
  • --environment production and the real --baseURL — the environment decides indexing and analytics (see below), and baseURL every absolute link.
  • --printPathWarnings, and no --panicOnWarning — OINK’s warnings are deliberate: a mistyped key or an incomplete integration warns and falls back to a safe default so the site still builds. Turning warnings into errors with --panicOnWarning or HUGO_PANICONWARNING would fail builds that are fine. Read the warnings in the build log instead.

Keeping preview deployments unindexed

Hugo’s -e / --environment changes how OINK builds, not what the site contains. Only a production build:

  • emits <meta name="robots" content="index, follow"> (other environments emit noindex, nofollow);
  • writes Allow: / and a Sitemap: line to robots.txt (other environments write Disallow: /);
  • renders the Google Analytics snippet;
  • fingerprints the theme’s scripts and stylesheets and adds SRI integrity attributes.

hugo defaults to production, even on a preview host, so build pull-request previews and staging sites with another environment:

Terminal
hugo --gc --minify --environment staging --baseURL "$PREVIEW_URL"

The output then asks search engines to stay away and sends nothing to an analytics service.

Content Security Policy

The theme’s scripts, fonts and icons are all served from your own origin, but script-src 'self'; style-src 'self' alone still blocks parts of an ordinary OINK page. The theme writes small inline scripts that set the color mode and the page shell’s state before the first paint, inline styles for the initial canvas, theme colors and font roles, and style attributes on some components; Markmap adds inline configuration and styles. OINK ships no ready-made policy, CSP hashes or nonce injection, so derive the policy from your own built output.

Features you enable add their own requirements:

  • Inline HTML and scripts that authors write under renderer.unsafe: true are the site’s to review.
  • ECharts $fn: callbacks and custom themes: the site registers its functions on window.OinkEchartsFunctions and its themes on window.OinkEchartsThemes, so the registering script’s origin belongs in script-src.
  • Analytics scripts: the script you insert, and the host it reports to.
  • Local PlantUML rendering: same-origin scripts, wasm-unsafe-eval in script-src to compile WebAssembly, and blob: in img-src. No rendering-service origin is needed.
  • Remote API specifications and self-hosted diagram services: their origins in connect-src and img-src.
  • giscus: both script-src and frame-src.
  • Interactive maps (params.map): your tile and dark_tiles hosts in img-src.
  • Video platform players (params.video_embeds): the enabled player origins (https://www.youtube-nocookie.com, https://player.bilibili.com, https://player.vimeo.com) in frame-src, plus any remote media, poster, subtitle track or social-avatar hosts in media-src, img-src and connect-src.
  • Duo view and ReDoc API references render in same-origin frames, so frame-src (or child-src) must allow 'self', and responses must allow same-origin framing (no X-Frame-Options: DENY or frame-ancestors 'none'). Duo view also adds an inline bootstrap script to every HTML page, which changes the script hashes.

Hash each inline script and style block you allow from the final deployed bytes, or have the host inject a fresh nonce into both the policy header and the matching tags on every response. A <style> nonce does not cover style="…" attributes, which need style-src-attr of their own. Hashes change with content, configuration, minification and theme upgrades, so recompute them after each.

Start from a minimal policy that covers only the features you have reviewed, and add permissions one at a time: keep ECharts options as pure data when no callback is needed, review author-written inline scripts, and add a remote origin only for an integration the site explicitly enabled. The output checker in Verifying an offline build lists every subresource origin, which is a good starting inventory. Ship the policy as Content-Security-Policy-Report-Only first, and enforce it only after light/dark startup, shell state, menus and every enabled component work in the browser.

Acceptance checklist

Go through this table after each deployment. The first four rows can be checked in the build output; the rest need the real URL.

The build succeeded and you read its warnings
The log of a build with --printPathWarnings ends with Total in …
baseURL is correct
<link rel="canonical"> in the page source points at the real production address, subpath included
Sitemap
<baseURL>/sitemap.xml resolves; on a multilingual site it is an index pointing at /en/sitemap.xml, /zh/sitemap.xml and so on
robots
<baseURL>/robots.txt reads Allow: / with a Sitemap: line; a preview deployment reads Disallow: /
Search index
With local search enabled, the URL in data-td-index-src returns 200, its filename carries a hash, and site search returns results
Markdown output
Where the site enables markdown under outputs.page, appending index.md to a page URL returns plain text
llms.txt
Where the site enables LLMS under outputs.home, the root of every enabled language serves llms.txt
Every language
Documentation, blog and home pages open in each, and the language switcher lands on the matching page rather than the home page
Appearance and interaction
The light/dark toggle, the print view and common components (callouts, tabs, code-block copy) work
404
A path that does not exist shows the site’s own 404 page

The switches for sitemap.xml, robots.txt, .md and llms.txt are in Configuration, and the agent-facing outputs are described in AI-agent support.

Rollback

Roll back a static site by publishing the last known-good build again. Never patch files on the production host, because the next deploy silently undoes the patch and nothing records what changed.

  • GitHub Pages: find the last successful Deploy to GitHub Pages run under Actions and choose Re-run all jobs, or git revert the faulty commit and push.
  • Cloudflare Pages, Netlify, Vercel: pick the last good deployment in the platform’s list and promote it with Rollback or Publish deploy.
  • Your own static server: point current back at the previous release directory kept by offline packaging. Do not extract the old archive over the new files; paths that only the newer release added would stay live.

On the Linux host, with the same symlink and GNU mv prerequisites as above, replace the example with the release you kept:

Terminal
previous_release=/var/www/oink/releases/20260928-01
test -d "$previous_release" &&
  ln -s "$previous_release" /var/www/oink/current.next &&
  mv -Tf /var/www/oink/current.next /var/www/oink/current

Then open an old page at the public URL, and confirm that a path only the rejected release added is gone.

If a theme upgrade caused the problem, roll back the version pin in go.mod instead; see Upgrade.

6.3 - Comments

Add a comment thread to each page with giscus and GitHub Discussions, choose which pages carry one, and match it to the site’s colors.

Comments give every page its own discussion thread at the end, with no comment server to run. OINK uses giscus, which stores each page’s thread as a GitHub Discussion in a repository you choose: readers sign in with GitHub to post, and you moderate in GitHub Discussions like any other discussion. The theme has no comment backend of its own and bundles no other provider.

The repository must be public, because visitors cannot read the Discussions of a private one.

Comments load a third-party service

A page with comments loads a script and an iframe from https://giscus.app, so they cannot work in a network-isolated environment. Comments stay off until you configure them; once on, mention giscus and GitHub in the site’s privacy policy if it has one.

Enabling it site-wide

The whole configuration lives under params.comments. Replace the four placeholders with the values giscus.app generates for your repository, as the next two sections describe:

hugo.yml
params:
  comments:
    enable: true
    type: giscus
    giscus:
      repo: YOUR_OWNER/YOUR_REPO
      repoId: YOUR_REPO_ID
      category: YOUR_CATEGORY
      categoryId: YOUR_CATEGORY_ID
      mapping: pathname
      inputPosition: bottom
      theme: auto
      loading: lazy

repo, repoId, category and categoryId are required and must all describe the same repository and Discussion category. If any of them is missing or blank, the build prints one warning and renders no comments, so read the build log before you publish. type accepts only giscus; any other value also warns and renders nothing. The key names match Hextra’s params.comments, so a configuration moved from Hextra works unchanged.

Every other key has a default, listed in Configuration: mapping (pathname), inputPosition (top), theme (auto), loading (lazy), strict, reactionsEnabled, emitMetadata, term, lang, lightTheme, darkTheme, ariaLabel and errorMessage. The giscus switches accept a YAML boolean or giscus’s own 0 / 1.

Preparing the GitHub repository

  1. Choose a public repository to hold the threads. The site’s own source repository works.

  2. Under the repository’s Settings → General → Features, turn on Discussions.

  3. Install the giscus GitHub App on that repository. Without it, visitors can neither comment nor react.

  4. Pick a Discussion category. giscus recommends one of the Announcements type, where only maintainers and the giscus bot can open a Discussion, so readers cannot start stray threads.

The repository ID and category ID are public identifiers, not credentials. Never put a personal access token, an OAuth secret or a password in the Hugo configuration: it is published with the site’s source.

Generating the configuration

Open giscus.app, enter the repository, the mapping and the category, and the page generates a <script> block. Copy four of its attributes into the OINK configuration:

data-repo
repo
data-repo-id
repoId
data-category
category
data-category-id
categoryId

mapping decides which Discussion belongs to which page. OINK’s default, pathname, suits a site whose published paths are stable, and lets one repository serve several domains or preview environments.

Settle the mapping before launch. If you change it, or move a page, after comments exist, giscus looks for a different Discussion: the old comments are not deleted, but the page no longer finds them. When a URL has to change, keep a redirect or rename the Discussion at the same time.

Per-page control

A page’s comments front matter overrides the site switch in either direction, and the value nearest the page wins.

To allow comments on a few pages only, set enable: false site-wide but keep the rest of the configuration, then turn comments on per page:

content/blog/2026-roadmap.md
---
title: 2026 roadmap
comments: true
---

To keep comments everywhere except a few pages, leave the site switch on and turn them off where discussion does not belong:

content/about/security.md
---
title: Security policy
comments: false
---

For a whole section, use a cascade. This site sets comments: true in the cascade of content/docs/_index.md, which is why a giscus thread appears at the end of this page:

content/docs/_index.md
---
title: OINK Documentation
cascade:
  type: docs
  comments: true
---

If the site also sets services.disqus.shortname, a working giscus configuration takes precedence and Disqus does not load, and comments: false on a page turns off both. When a required giscus key is missing, giscus is skipped with a warning and Disqus loads instead.

Multilingual text

The giscus interface follows the page’s language. Simplified, Traditional and Hong Kong Traditional Chinese each map to their own giscus locale, and languages giscus does not support fall back to English. Set lang only when the automatic choice is wrong.

OINK adds two strings of its own, the comment section’s accessible label and the message shown when loading fails, and translates both in every interface language it ships. To change their wording, set ariaLabel and errorMessage per language; a language layer needs only the values that differ, and the repository keys stay in params.comments:

hugo.yml
languages:
  en:
    params:
      comments:
        giscus:
          ariaLabel: Discussion
          errorMessage: The discussion could not be loaded. Please try again later.
  zh:
    params:
      comments:
        giscus:
          ariaLabel: 讨论
          errorMessage: 讨论区加载失败,请稍后重试。

Following light and dark

With theme: auto, the comment frame follows the reader’s light/dark choice and visual preset, using stylesheets the theme ships to match each preset the site offers.

To use other colors, set lightTheme and darkTheme, each to a giscus built-in theme name or to the URL of a stylesheet on your site, such as /css/giscus-brand-dark.css served from static/. They then apply under every preset. A fixed theme name in theme stops the frame from following the toggle at all.

hugo.yml
params:
  comments:
    giscus:
      theme: auto
      lightTheme: light
      darkTheme: dark_dimmed
Site-hosted giscus stylesheets must be readable cross-origin

The giscus frame runs on giscus.app and reads its stylesheet from your site, the theme’s own or yours, so the response must allow cross-origin reads. Configure Access-Control-Allow-Origin on the production host. For hugo server, this site adds Access-Control-Allow-Origin: '*' under server.headers in hugo.yml.

Privacy and CSP

  • OINK never asks for or stores a reader’s GitHub password or token; signing in and posting happen entirely on giscus and GitHub.
  • The comment loader is a same-origin script that the theme adds only to pages with comments enabled.
  • The giscus script is requested when the reader comes within a scroll of the comment section, or is already past it; with loading: lazy the iframe waits the same way. A visit returning from GitHub sign-in, and a site that sets loading: eager, request it at once.
  • Under a strict Content Security Policy, allow giscus in both script-src and frame-src. Merge these into your existing policy rather than replacing it; the general rules are in Content Security Policy.
CSP fragment
script-src 'self' https://giscus.app;
frame-src 'self' https://giscus.app;

If the script fails to load or never creates its iframe, OINK ends the loading state and shows errorMessage in a live status region, so the page never hangs on “loading”.

Verify

Terminal
hugo --minify # a missing required key prints a warning and disables comments
hugo server --disableFastRender
  1. Open a page that should have comments. giscus appears at the end with “Sign in with GitHub”, in the page’s language.
  2. Switch between light and dark. With theme: auto, the comment section follows.
  3. Open a page with comments: false and confirm that no comment section appears there.
  4. Post a test comment, then check on GitHub that a Discussion appeared in the chosen category and that you can manage it.

Until the first comment or reaction creates a page’s Discussion, a “discussion not found” message in the browser console is expected.

When comments do not appear, check in this order: build warnings about the four required keys; params.comments.enable and type; the page’s comments front matter; whether the repository is public, has Discussions on and has the giscus App installed; and the browser console and response headers for a CSP block on giscus.app. When existing threads go missing, restore the original mapping and page path first.

6.4 - Analytics and SEO

Connect Google Analytics or another service if you want visit counts, and check the canonical, hreflang, social-card, sitemap and robots output search engines read.

An OINK site reports nothing to anyone until you connect an analytics service: Google Analytics through one Hugo setting, anything else through a one-file hook. The theme loads no analytics, form or advertising script of its own, so the decision, and the line in your privacy statement, are yours.

Search-engine metadata, by contrast, needs no setup. Every page gets a canonical link, hreflang links to its translations, a robots meta tag and Open Graph and Twitter cards; your part is a correct baseURL and a description on each page.

Connecting Google Analytics

Put your GA4 measurement ID in Hugo’s service configuration:

hugo.yml
services:
  googleAnalytics:
    id: G-YOUR_MEASUREMENT_ID

The snippet loads only in production builds, so hugo server reports nothing. hugo builds for production by default, even on a preview host, so build pull-request and staging deployments with another environment, as Keeping preview deployments unindexed shows. Without an ID nothing loads, and a Universal Analytics UA- ID is no longer accepted: it produces a build warning instead of a snippet.

Use only this key; the top-level googleAnalytics key is deprecated. If you do not want analytics, delete the block rather than leaving a placeholder, because a placeholder ID still loads Google’s script.

Google Analytics leaves your network

Once configured, page views and events go to Google, which rules it out for a network-isolated site, and a strict Content Security Policy has to allow it; see Content Security Policy.

Connecting another analytics service

Plausible, Umami, Matomo and similar services need only their script on the page. The theme renders two hook partials for exactly this, so you add a file to your site and leave the theme untouched:

layouts/_partials/hooks/head-end.html , InsertedBefore </head>, ahead of the Google Analytics snippet
Analytics scripts, cookie-consent scripts, meta tags the theme does not write
layouts/_partials/hooks/body-end.html , InsertedAfter all the page’s other scripts
Third-party code that affects interaction rather than the first paint

For Plausible, use the domain registered in your own account:

layouts/_partials/hooks/head-end.html
{{ if hugo.IsProduction }}
<script defer data-domain="your-site.example"
        src="https://plausible.io/js/script.js"></script>
{{ end }}

Keep the hugo.IsProduction guard. Without it, every local preview by every author reports visits to your analytics account.

head-end runs before Google Analytics

A cookie-consent script placed in head-end.html therefore runs first and can stop analytics from starting.

The “was this page helpful?” widget is separate and off by default. It makes no request of its own and records answers through your Google Analytics integration when one exists; see Repository links and page info.

Duo view panes

If you enable Duo view (params.ui.compare), opening it loads both pages in same-origin frames. The Google Analytics integration (services.googleAnalytics.id) skips those panes, so opening the reader does not count two extra page views. To do that, OINK renders the snippet from its own pane-aware template instead of Hugo’s built-in one, so an override at layouts/_partials/google_analytics.html has no effect while Duo view is on.

Scripts in head-end.html still run in every pane. Check window.OinkComparePane before recording a page view:

layouts/_partials/hooks/head-end.html
{{ if hugo.IsProduction }}
<script>
  if (!window.OinkComparePane) {
    var script = document.createElement('script');
    script.defer = true;
    script.dataset.domain = 'your-site.example';
    script.src = 'https://plausible.io/js/script.js';
    document.head.appendChild(script);
  }
</script>
{{ end }}

Server and CDN logs see the pane requests too; they carry the query oink_compare_pane=1, which you can filter on.

Page descriptions

<meta name="description"> takes the first non-empty value of:

  1. The page’s description front matter
  2. The page summary Hugo computes (.Summary)
  3. params.description in the site configuration

So one description per page is the only SEO work an author has to do, and it pays three times: as the snippet under the search-engine result, as the card subtitle on its section’s index, and as the preview in site search.

content/docs/install.md
---
title: Install PostgreSQL
description: Install PostgreSQL 18 from the official packages on Debian, Ubuntu or RHEL and start the first cluster.
---

On a multilingual site, write the description in each language instead of copying the English one, and set the site-wide fallback per language too:

hugo.yml
languages:
  en:
    params:
      description: A Hugo theme for engineering docs
  zh:
    params:
      description: 为工程而设计的 Hugo 文档主题

canonical and hreflang

Every page gets one canonical link, plus an hreflang alternate for each translation that actually exists. Nothing needs configuring:

rendered output (this page)
<link rel="canonical" href="https://oink.pgsty.com/docs/admin/analytics/">
<link rel="alternate" hreflang="en-US" href="https://oink.pgsty.com/docs/admin/analytics/">
<link rel="alternate" hreflang="zh-CN" href="https://oink.pgsty.com/zh/docs/admin/analytics/">

The hreflang codes come from each language’s locale (en-US and zh-CN on this site), and the links follow Hugo’s translation pairing. A page without a translation gets no hreflang or og:locale:alternate for the missing language, even though the language switcher still offers that language’s home page.

Each page of a paginated blog index has its own canonical URL. From page 2 on, it carries no hreflang alternates, because the languages can have different numbers of posts and their page boundaries do not line up.

Canonical links are built from baseURL. A wrong baseURL sends search engines to addresses that do not exist, which is harder to notice than a failed build, so go through the deployment checklist before launch. Language configuration itself is covered in Languages.

Social cards

The theme calls Hugo’s built-in Open Graph and Twitter card templates, which fill in the title, description, URL, language and site name:

rendered output (this page)
<meta property="og:title" content="Analytics and SEO">
<meta property="og:type" content="article">
<meta property="og:url" content="https://oink.pgsty.com/docs/admin/analytics/">
<meta property="og:locale" content="en_US">
<meta property="og:locale:alternate" content="zh_CN">
<meta name="twitter:card" content="summary">

To show an image when the link is shared, set images in the page’s front matter:

content/blog/release-3.0.md
---
title: Version 3.0 released
images: [/images/release-3.0.webp]
---

For a site-wide fallback image, set the same key under params:

hugo.yml
params:
  images: [/images/social-card.webp]

With an image, twitter:card becomes summary_large_image and the output gains og:image and twitter:image. This site sets neither key, which is why the output above has no image tags.

Sitemap

Hugo writes the sitemap itself; on a multilingual site it writes an index that points at one sitemap per language:

the structure under public/
sitemap.xml        ← the index, pointing at the two below
en/sitemap.xml
zh/sitemap.xml

The site default and the per-page override are both Hugo’s own keys:

hugo.yml
sitemap:
  changefreq: monthly
  filename: sitemap.xml
  priority: 0.5
content/release/notes.md
---
title: Release notes
sitemap:
  priority: 0.8
---

Search engines treat changefreq and priority as hints and may ignore them. What matters more is checking before launch that drafts, private content and non-canonical copies stay out of the sitemap, and that every language has its own.

robots.txt and staying unindexed

Hugo writes robots.txt only when the site asks for it:

hugo.yml
enableRobotsTXT: true

The theme supplies the content, which depends on the build environment:

a production build
User-agent: *
Allow: /

Sitemap: https://oink.pgsty.com/sitemap.xml
a non-production build
User-agent: *
Disallow: /

The page’s robots meta tag follows the same rule: index, follow in a production build, noindex, nofollow otherwise and always in print output.

The theme has no per-page noindex switch. To keep a page out of search engines reliably, do not publish it: use draft: true or Hugo’s build options. If the page must be published yet unindexed, write your own tag in the head-end.html hook; the page then carries two robots tags, and each search engine decides how to combine them.

Checking indexing

A week or two after launch, confirm that search engines see the site you think you published:

  1. Crawl permission: <baseURL>/robots.txt reads Allow: /, not Disallow: /.
  2. Page inventory: <baseURL>/sitemap.xml opens; follow it to a language sitemap and check the page count.
  3. Indexed pages: a site:yourdomain search returns about the right number. The order of magnitude is enough.
  4. Canonical addresses: results open the canonical URL, not a version with ? parameters or an old domain.
  5. Submission: add the site to Google Search Console and Bing Webmaster Tools and submit the sitemap.xml address, which gets it crawled sooner than waiting.

Verify

Run this from the site root, with PAGE set to a page your site generates (including any language prefix):

Terminal
hugo --gc --minify --printPathWarnings
PAGE=public/docs/getting-started/index.html
test -f "$PAGE"

# Canonical should use the real production address; production robots allow indexing.
grep -o '<link[^>]*canonical[^>]*>' "$PAGE"
grep -o '<meta[^>]*robots[^>]*>' "$PAGE"
cat public/robots.txt
head -5 public/sitemap.xml

# No match is expected when Google Analytics is not configured.
grep -o '<script[^>]*googletagmanager[^>]*>' "$PAGE"

In the browser’s Network panel, confirm that analytics requests carry your measurement ID or registered domain. A deployment built with --environment staging must make no analytics request, and a site with no analytics configured makes none in either environment, though other integrations you enabled still contact their own services.

  • Deploy — baseURL, the checklist and unindexed preview deployments
  • Repository links and page info — the feedback widget, edit links and last-modified dates
  • Languages — language configuration decides hreflang and translation pairing
  • AI-agent support — the .md output and llms.txt written for models
  • Configuration — services, sitemap, enableRobotsTXT and the rest

6.5 - Upgrade

Move a site to a newer OINK release, or migrate it from OINK 0.4 or Docsy, with a rollback path at every step.

Upgrading OINK means changing the release your site pins and checking what the new release renders differently. Most content needs no edits. Where a release retired a syntax or an interface, its section below says whom that affects and what to change, and a migration tool rewrites old shortcodes in bulk, dry run first. Do the work on a branch, so that abandoning an upgrade costs nothing but the branch.

Upgrade Hugo and OINK together

OINK 1.6.0 and newer use plain CSS and are tested on Hugo 0.170+, so the build compiles nothing. OINK 1.5.1 and older need Hugo’s Extended edition, which ended with Hugo 0.169, so a site on an older release cannot follow Hugo past 0.169 until it upgrades; see Staying on 1.5.1 or older.

Read the release notes first

Each release’s notes list its changes, breaking changes and upgrade steps. Before you change the pin, read the notes of every release between yours and the target:

They tell you which content needs editing, which configuration keys are gone and which defaults changed, so a page that looks different after the upgrade comes with an explanation.

Upgrading the Hugo Module

Pin a published release tag, or an immutable commit you chose deliberately, never a branch or @latest, so that building the same site commit always produces the same site. Check that the tag is published and resolves before you pin it:

Terminal
hugo mod get github.com/pgsty/oink@v1.8.0   # the published release tag
hugo mod tidy
hugo mod graph | grep github.com/pgsty/oink

The module graph must show exactly that version; a commit you chose appears in go.mod as a Go pseudo-version. Commit go.mod and go.sum. For the tag above, go.mod reads:

go.mod
module github.com/example/product-docs

require github.com/pgsty/oink v1.8.0

If you also preview against a local theme checkout, that replacement overrides the pin; see Previewing against a theme checkout before you trust a build.

For a Git submodule, confirm that it has no local edits, fetch the tags and check out the exact release rather than following a remote branch:

Terminal
git -C themes/oink fetch origin --tags
git -C themes/oink checkout --detach v1.8.0
git add themes/oink

Commit the new submodule pointer once the site passes. For an offline archive or a clone, replace themes/oink/ with the complete tree of the new release and confirm that theme: still matches the directory name. The trade-offs between install methods are in From scratch and other install methods.

What to do after upgrading

Terminal
rm -rf public resources/_gen
env -u HUGO_MODULE_REPLACEMENTS GOWORK=off HUGO_MODULE_WORKSPACE=off \
  hugo --gc --minify --printPathWarnings --logLevel info

This clears caches that may still hold output of the old release, builds with the pinned release only, with no local replacement or workspace, and prints informational messages along with the warnings. Hugo’s deprecation notices among them say what a future Hugo will remove; resolve them before you upgrade Hugo itself, since how urgent each one is depends on the feature.

Once the build passes, look at the result: the home page, a documentation page, a blog page and the 404, in every language and both color schemes, the print view, and everything the site customizes.

Verify

A passing build does not finish an upgrade. Check each surface the site uses:

Documentation / Book
Sidebar order, paging, headings, page actions, numbering and cross-references
Blog
Chronological paging, RSS ownership, navbar and footer
Home / landing
Content with JavaScript off, the compact menu, print
Release pages
Derived download URLs, checksums, publication state
Components
One page for each component the site uses most
Accessibility
Keyboard-only use, focus order, both color schemes, forced-colors mode
Deployment
Every internal link and asset keeps the base path prefix

Then run the checks a site can run: the production build, the output trust check and, for a book, the anchor check. Deploy a preview and open its pages in a browser at the real URL, watching the network requests. Merge the upgrade only after that review, and smoke-test production once it is live.

Rollback

To roll the theme back, restore the previous pin:

Terminal
hugo mod get github.com/pgsty/oink@v1.6.0   # example: the site's last known-good tag
hugo mod tidy
rm -rf public resources/_gen
hugo --gc --minify
  • Keep the pre-upgrade module pin, site commit and known-good deployment artifact, and restore all three together.
  • Never roll back part of it. Old layout copies over a new theme make a mixture that is harder to diagnose than either complete release.
  • Keep the upgrade branch and what you learned verifying it. A rollback restores production first; it does not throw the upgrade work away.

Republishing the previous deployment itself is covered in Deploy.

Upgrade to 1.8.0

Review the 1.8.0 release notes and check these items before pinning v1.8.0:

  • Six visual presets and distinct dark modes. Paper returns to its classic warm-paper and link-blue look (#f7f6f3, #21201c, #2b5f8c, IBM Plex Sans over Hei). github and news join the preset list, ink is redesigned as a written page (Palatino, Kai, Fangsong/Song and vermilion; silver and gold on indigo-violet in dark mode), and Dark Terminal is calibrated as a restrained phosphor screen. To offer all six styles, set params.ui.preset_menu: [paper, slate, github, ink, news, terminal]. See Brand and appearance.
  • Appearance trigger and menu layout. Three, five or six presets arrange in three columns above the three Color cards, with Style (T) and Color (Y) legends when keyboard navigation is on. When the menu offers Color, the navbar trigger shows the reader’s choice. Light uses a sun, Dark a moon, and System a half-filled circle even when the system switches between light and dark.
  • Unified audio and video controls. Local audio and video files replace native browser controls with the theme’s .td-media__controls row, featuring a single three-color progress bar, playback speed toggle, volume slider, and captions and fullscreen controls for video. Sites with custom CSS targeting the former .td-media__progress element should update to .td-media__controls and .td-media__seek.
  • Quoted posts as > [!SOCIAL] callouts. Quoted social posts use the > [!SOCIAL] Markdown callout form with a trailing block attribute line ({avatar="…" date="…" url="…" platform="…"}), keeping the quote readable as an ordinary blockquote in plain Markdown; see Social. If a site has legacy social shortcode calls, convert them with python3 bin/migrations/oink06.py migrate --site <dir> --only social --write from the theme repository, then run python3 bin/migrations/oink06.py check --site <dir> to list any call it left unchanged.

Upgrade to 1.7.0

Sites already on 1.6.0 need no template or stylesheet migration. Review the 1.7.0 release notes and check these behavior and appearance updates before pinning v1.7.0:

  • Paper accent and preset typography. Paper moves to an ivory canvas (#faf9f5) and a clay UI accent (#9b4a28, dark #de8460) while keeping blue underlined links in prose. To keep Paper’s previous blue accent, set params.ui.theme_color: '#2b5f8c'. Terminal now sets screen prose in IBM Plex Mono (keeping IBM Plex Sans in print), and an explicit params.ui.fonts.ui or fonts.body reaches the headings in every preset unless fonts.heading names its own face. See Brand and appearance. OINK 1.8.0 returns Paper to its 1.6.0 look and adds preset: news, which grew out of this 1.7.0 look and is the closest choice for a site that preferred it; see Upgrade to 1.8.0.
  • Updated single-key shortcuts. The shortcut map reorganized into twenty-nine bindings (10 navigation, 9 actions, 10 view): Zen Mode moves from H to Z (H opens local browsing history), language cycling is X, preset cycling is T, color mode is Y, blog index layout is L, version cycling is V, language home is G, command-only palette stays on \ (with C), and [ and ] trigger ChatGPT and Claude. G no longer opens the focused tree item (Enter and Space still do), and the home page’s N section alias is gone (J remains). Update any site-specific help copy or keyboard tests that mention pre-1.7 keys; see Keyboard shortcuts.
  • Typeset copy. Copying article prose now emits clean print-palette rich text by default so editors such as WeChat no longer keep page canvas backgrounds. Set params.ui.rich_copy: false (or front matter rich_copy: false) if your site needs the browser’s default HTML copy.
  • New opt-in components and CSP. Timeline, Update, Social, and local Video/Audio work without external requests. If you enable params.map or params.video_embeds, allow your tile origin in img-src and enabled video hosts in frame-src; see Deploy.
  • Archived-version banner. Sites with params.archived_version: true now receive a styled role="note" notice and require a non-empty params.version (omitting it warns once and drops the empty banner).

Upgrade to 1.6.0

Every site moving to 1.6.0 needs this section. The release keeps the github.com/pgsty/oink module path but deliberately retires Sass, Bootstrap’s JavaScript and Lunr, which is what lets Hugo 0.170 and newer build the theme. Read the 1.6.0 release notes, then check each item:

  • Toolchain. Use a current Hugo release (tested on 0.170+; no Extended edition or Sass compiler needed). Remove extended: true from CI workflows once every branch you build uses OINK 1.6.0 or newer.
  • Stylesheets. Convert retired assets/scss/_*_project*.scss files to plain CSS in assets/css/project.css, change hard-coded /scss/*.css paths to /css/*.css, and switch custom-shell layouts to partial "css/bundle.html". See Retired SCSS hooks.
  • Bootstrap JavaScript. Remove dependencies on a theme-provided window.bootstrap or on data-bs-toggle hooks, listen for td:tab-shown instead of shown.bs.tab on Landing download tabs, and change .dropdown-menu selectors on version lists to .td-version-menu__list. See Bootstrap’s JavaScript.
  • Local search. Remove site-script dependencies on window.lunr and call OinkSearchEngine.create(documents, maxResults). A content index over 2 MiB now moves page text into offline-search-body.<lang>.json. See Local search without Lunr.
  • Markmap 1.1.0. Migrate the legacy Markmap 0.18 YAML keys to foldLevel, wrapWidth, levelGap, siblingGap and colorDepth; the old names warn and are ignored. See Markmap migration.
  • ReDoc 3.1.0. Each specification now renders in its own same-origin reader frame, so a Content Security Policy that restricts frames must allow frame-src 'self'. ReDoc 2’s hide-hostname, hide-logo, suppress-warnings, lazy-rendering and native-scrollbars defaults are gone with its v2 API; if you override the redoc shortcode or its styles, port those overrides to the ReDoc 3 API. Rename the specification extension x-code-samples to x-codeSamples. Old links to operations still redirect, but ReDoc 2 deep links to schemas and to individual security schemes have no ReDoc 3 equivalent, so update any link that points at one.
  • Components that load on approach. Asciinema, ECharts, Infographic, Markmap and giscus now load as the reader nears them. If your own browser tests assert rendered charts, maps or players, scroll the component into view first.

Retired SCSS hooks

If your site has assets/scss/_variables_project.scss, _variables_project_after_bs.scss or _styles_project.scss, convert them by hand, once. The theme’s stylesheet is plain CSS and the build runs no Sass compiler, so each of these files is ignored with one build warning, and until you convert them the site builds with the theme’s default styles only.

  1. Move the rules in _styles_project.scss, and in the partials it imports, to assets/css/project.css as plain CSS. Native CSS nesting is fine. Write out what only Sass understands: variables, mixins such as Bootstrap’s breakpoints, @extend, and nested selectors that build a class name with &-.
  2. For each Sass variable you assigned in the two variable hooks, set what it used to change. Colors and fonts have their own settings; see Brand and appearance. For anything else, override the custom property or the theme rule the variable fed.
  3. Build the site and compare the pages that matter. project.css loads after the theme’s stylesheet, so a theme rule of equal specificity no longer overrides your rule. Check elements that also carry a theme modifier class, and check each visual preset you offer.
  4. Delete the three SCSS files and the partials only they imported. From then on, edit the project stylesheet.

If your own templates compiled the theme’s SCSS partials, ask for a theme stylesheet by name instead.

Bootstrap’s JavaScript

If your layouts, shortcodes or content use Bootstrap’s dropdowns, tabs, modals or any other Bootstrap script, load Bootstrap yourself: the theme no longer provides window.bootstrap or activates Bootstrap’s script hooks. To find what depends on it, search for bootstrap., data-bs-toggle, data-bs-dismiss, data-bs-target and .bs. event listeners. Replace each with an OINK component, or load your own Bootstrap bundle in layouts/_partials/hooks/body-end.html. The color-mode attributes data-bs-theme and data-bs-theme-value still work.

On OINK Landing download tabs, listen for td:tab-shown instead of shown.bs.tab; the event bubbles from the channel panel that just became visible. The version lists in the footer and drawer use .td-version-menu__list, so update custom .dropdown-menu selectors for them. The version trigger reports its state through aria-expanded; observe that attribute where a script listened for *.bs.dropdown.

Local search without Lunr

If your site uses local search, its configuration, index files and front matter keys are unchanged. After upgrading, check three things:

  1. The theme no longer ships Lunr. If your own layouts or scripts used window.lunr from the theme’s copy, load Lunr yourself.
  2. If you call OinkSearchEngine.create directly, drop the Lunr argument: create(documents, maxResults).
  3. Results rank differently. A short word no longer matches inside another word, so port no longer returns pages that only say “support”, and Chinese, Japanese and Korean queries no longer need spaces between words. Try the searches your readers use most.

A content index larger than 2 MiB is now published as two files: the index keeps titles, headings and keywords, and offline-search-body.<lang>.json holds the page text, which the palette loads after the first results. If you set offline_search_index: summary only to stay within the size budget, you can return to content. A script of your own that read body from a large index must read the second file and join it by ref. An index within 2 MiB is unchanged.

Fields are now search results: a query for a parameter name opens its entry in a fields list or {.fields} table, with no change on your part. To keep an established anchor, give the field an id. To make your own markup searchable the same way, give the element an id and data-td-search-entry="Title". The Shell contract lists the rules.

Staying on 1.5.1 or older

If a site, or a branch you still build, stays on OINK 1.5.1 or older, its build compiles Sass and needs Hugo’s Extended edition, which ended with Hugo 0.169; those releases fail to build on Hugo 0.170. Everywhere that site builds, use the Extended edition at a release no newer than 0.169:

  • Locally, hugo version must print extended.

  • In GitHub Actions, give peaceiris/actions-hugo an exact release and the Extended edition:

    the Install Hugo step of the workflow
    - name: Install Hugo
      uses: peaceiris/actions-hugo@v3
      with:
        hugo-version: 0.169.0
        extended: true
  • In the container image, install hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.deb instead of hugo_${HUGO_VERSION}_linux-${TARGETARCH}.deb, with HUGO_VERSION no newer than 0.169.

  • resources/_gen/ also holds the CSS the build compiled, so clear it when a font or accent-color change does not show up.

Upgrade to 1.5.1

A site that leaves params.ui.compare unset needs no changes: 1.5.1 builds exactly the same pages and outputs. The release stabilizes the opt-in Duo view introduced in 1.5.0 and fixes RSS, print, navigation, validation, search and accessibility behavior; see the 1.5.1 release notes.

If you turn on params.ui.compare: true:

  • Keep explicit {#id} heading anchors aligned across translations, so Sync Scroll can match sections.
  • Set languages.<lang>.params.ui.compare: false for any language that should neither show the reader nor appear as a target language.
  • Guard custom analytics in head-end.html with window.OinkComparePane so pane loads are not counted twice. A local override of Hugo’s google_analytics.html partial is not used while compare is on; see Analytics and SEO.
  • Allow same-origin frames (frame-src 'self') in your Content Security Policy, and make sure the server does not forbid same-origin framing with X-Frame-Options: DENY or frame-ancestors 'none'.
  • Open a translated Docs, Book or blog page and check that Open duo view (renamed from Open bilingual view in 1.5.1) loads the target language, syncs scrolling across shared headings, and switches cleanly on narrow screens.

Upgrade to 1.4.0 and 1.3.1

If your site uses PlantUML, 1.4.0 can render it in the browser with no extra software or rendering service. To switch, keep params.plantuml: true or plantuml.enable: true and remove svg_image_url; the two bundled browser scripts take over. To stay in server mode, keep a non-empty endpoint, because an empty endpoint now selects local mode. To turn rendering off, set params.plantuml: false or plantuml.enable: false. Before switching an existing diagram collection, review the unsupported includes, libraries and CSP requirements.

Beyond that, 1.4.0 keeps the Hugo-only build and adds unified diagram reading, richer local search, the opt-in table reader and the gallery blog layout (1.4.0 release notes). After pinning it, review navigation, image viewing and reader settings. If you install the theme as a source copy, refresh the copied files as well; changing go.mod does not update a vendored copy.

1.3.1 repaired Markmap text contrast and the fixed table of contents' clearance above the footer, and added opt-in layouts for technical tables and long FileTree comments. Existing content keeps its appearance; turn on technical table layout or FileTree wrap=true only where the full technical text has to show. A site that offers all four styles keeps preset: paper with the explicit [paper, slate, ink, terminal] menu. The 1.3.1 notes describe these fixes and credit their contributor.

Upgrade to 1.2.0

Paper became the default appearance

If the site must keep its existing look, set params.ui.preset: slate before adopting 1.2.0. preset_menu: true turns on reader choice and still defaults to false. Ink and Terminal appear only when you name them as the preset or in the menu list, and their buttons carry no experiment badge. Review custom dark brand selectors as described in Brand.

Apart from the appearance change, 1.2.0 needs no content migration. Check:

  • The chosen preset, the light/dark icons, keyboard and mobile menus, saved preferences, and custom font and accent overrides. Sun means light and moon means dark, and switching styles must not change the saved light/dark preference.
  • Explicit navigation, hidden subtrees, page links, Blog pagination canonicals, and SEO alternates for pages without translations.
  • CJK search summaries that match only keywords, and outline links whose headings contain a literal percent sign. Compare the Edit, History and Create-child links for content on Windows or in mounts; mappings must yield repository-relative paths.
  • Landing content with JavaScript disabled or blocked, preserved metric formatting, dialogs and keyboard shortcuts, the copy fallback, Draw.io controls, and numbered equations at narrow widths.
  • Diagram endpoints and resource alt metadata in a production build: malformed values now warn and fall back safely. To disable rendering on purpose, use params.plantuml: false or params.drawio.enable: false.
  • The revised PDF and migration tools, if you publish PDFs or convert content. Review PDF remote-resource opt-ins and migration diffs, including code examples nested in lists.

Upgrade to 1.1.0

If your site is on 1.0.x, no source migration is needed, and the module’s Go 1.27.0 directive is unchanged from 1.0.0; toolchain details are in the 1.1 release notes. What changed is behavior, so review the surfaces the site uses before choosing the new pin:

Languages
All 32 interface catalogs share one native-message schema. Check the site’s language labels, plural counts and RTL direction; authored translations remain the site’s responsibility.
Taxonomies
Root pages become term-card directories with a taxonomy switcher. Review taxonomy-template or CSS overrides, author portraits and localized breadcrumbs.
Sidebars
Cached trees keep each page’s effective settings and work without JavaScript. Test collapse, hover restore, the mobile drawer and keyboard focus; hidden content must leave the focus order.
Groups
sidebar_divider: true keeps a section’s children. Add build.render: never only if you mean to omit the group’s own outputs, then check child navigation, breadcrumbs, paging, Print and Book contents.
Root menus
An explicit sidebar_root_menu: false now applies to self-root sections too. The current linkable root stays visible as a location marker.
Custom scripts
Feature-detect OinkSidebar and OinkCommandPalette.registerSearchTail if an integration must also support 1.0.0. Restore branch state through the API rather than by changing classes or ARIA attributes.
Copying articles
With image zoom on, copying an image and its caption yields plain text and rich HTML. Preview instructions must stay out of the copied article, and zoom and its keyboard controls must still work.
Print and Redoc
Check page and Book aggregate Print, heading and tab links, and local Redoc specifications under the real deployment prefix. Local specification paths are rooted under static/.

params.ui.image_zoom and params.offline_search stay off by default, and the new search hook enables no remote provider and adds no query telemetry. params.ui.scroll_spy and the page-level scroll_spy are still accepted and do nothing in 1.x, so removing an obsolete patch does not disable normal outline tracking.

If the site keeps its own copies of theme code, such as an image-zoom script or a sidebar partial, compare them with the new implementation and update or remove them; otherwise the old copy keeps overriding the upstream fix. The details are in content groups, the sidebar contract, search actions and image zoom.

Upgrade from 0.4

If your site started on OINK 0.4 and a page gained or lost a feature after upgrading, check these changed defaults first:

  • Sequential paging is on. docs, book and blog pages end with previous / next links; documentation follows the sidebar tree and blog posts follow time. Set pager: false on a page that stands outside any sequence.

  • The navbar appears on every layout. Its compact state is one row of icon navigation with no second mobile accordion menu, so remove local scripts and tests that depend on the old mobile menu. To hide the navbar for a section, set navbar_enabled: false in a cascade.

  • The footer defaults to fat across the site and accepts only fat, slim or none. Footer data lives in data/footer/<language>.yaml, or data/footer.yaml on a single-language site; a footer key left in data/home warns and names the new location.

  • Single-key navigation is on: / opens full search and \ opens command-only mode. Update training material that describes the old behavior. Page actions moved to a split button beside the breadcrumbs.

  • The code block DOM changed: a .td-code wrapper now encloses the original .highlight, and both .highlight and .chroma remain. In site CSS, replace a child selector such as .td-content > .highlight with the descendant selector .td-content .highlight.

  • The two ICP footer keys footer_icp and footer_icp_url became one string that accepts inline Markdown:

    hugo.yml
    params:
      footer_center_info: '[京ICP备00000000号](https://beian.miit.gov.cn/)'
  • Mathematics needs Goldmark passthrough in the site’s own configuration, because Hugo does not merge a theme’s markup settings. If the site uses \(…\), \[…\] or $$…$$, enable passthrough in its hugo.yml; see Math.

Every key above is documented in Configuration and Layouts and page types. Convert the 0.4 shortcodes with the migration toolkit below.

The content migration toolkit

If your content still uses 0.4 shortcodes such as alert, tabpane or imgproc, convert them with oink06.py instead of editing hundreds of files by hand. It ships in the theme repository and needs only the Python standard library:

Terminal
git clone https://github.com/pgsty/oink
cd oink

# 1. read-only inventory: what several sites would change, exportable as Markdown / JSON
python3 bin/migrations/oink06.py report --sites ~/sites/product-docs ~/sites/handbook --md report.md

# 2. dry run: prints a diff and counts per file, writing nothing
python3 bin/migrations/oink06.py migrate --site ~/sites/product-docs

# 3. apply: written atomically
python3 bin/migrations/oink06.py migrate --site ~/sites/product-docs --write

# 4. check for residue: exit code 1 while legacy syntax remains
python3 bin/migrations/oink06.py check --site ~/sites/product-docs
  • A dry run is the default and only --write changes files, so run it, read the diff, then write.
  • A second run must change nothing. If a second --write still reports changes, a transformation has not converged; stop and inspect those files.
  • Text inside code fences is left alone, so documentation that shows the old syntax stays intact.
  • A construct the tool cannot express is left unchanged and reported with file:line and a reason, as a list for manual work rather than a failure.

To convert one class at a time, pass --only with keys from the last column of the syntax map:

Terminal
python3 bin/migrations/oink06.py migrate --site ~/sites/handbook --only callout,tabs --write

Afterwards, rebuild, read the warnings and look at the rendered pages. The tool guarantees valid syntax; whether each page still says what you meant is yours to check.

The 0.4 → current syntax map

{{%/* alert color= title= */%}}, {{%/* details */%}}, {{%/* pageinfo */%}}, hand-written <details><summary> , The current form> [!TYPE] Title / > [!DETAILS]-
callout
{{</* tabpane */>}} + {{%/* tab header= */%}}, {{</* code-group */>}} + {{</* code-tab */>}} , The current formAdjacent fences with {tab= group= value=}; tabs in running text use {{</* tabs */>}} + {{</* tab */>}}
tabs
{{</* filetree */>}} with filetree/folder and filetree/file , The current formThe filetree data fence
filetree
{{</* gallery */>}} with gallery/image , The current formThe gallery data fence
gallery
{{</* echarts */>}}, {{</* infographic */>}} , The current formData fences of the same name ($fn: is unchanged; a js subfence moves to window.OinkEchartsFunctions)
datafence
doc-cards / doc-card, nav-cards / nav-card, card / cardpane, doc-carousel , The current form{{</* cards */>}} + {{</* card */>}}, or a link list with {.cards}
cards
{{</* imgproc */>}}, {{</* image */>}} , The current form![alt](src) with the attribute line {command= options= caption=}
image
{{</* readfile file= */>}} , The current form{{</* include file= */>}}
include
The fence attribute {filename="x"} , The current form{title="x"}
fencetitle
{{</* badge outline= */>}} , The current formDrop the outline parameter
badge
{{</* example */>}} + a fence, {{</* book-figures kind="tbl" */>}} , The current form{{</* eg */>}}…{{</* /eg */>}}, {{</* book-tables */>}}
eg
{{%/* _param x */%}}, iframe, conditional-text, blocks/*, netlify, a kindless xref , The current formReported only; handle by hand
reportonly

Each page under Components describes the new form and its parameters.

Migrating from Docsy

If your site runs on Docsy, most of it carries over. OINK is a hard fork of Docsy and keeps its content model, td- naming and most front matter, so the migration is mainly deleting the site’s copies of the shared shell and letting the theme supply it. The prose stays as it is.

  1. Pin the target version. Point go.mod at an OINK release tag, or use a complete versioned archive. While you evaluate, an uncommitted go.work can point at a local checkout.

  2. Inventory the overrides. Sort every site-level file under layouts/, assets/ and static/ into four groups: copies of the shared shell (delete once verified), components OINK already provides (delete or rename mechanically), brand customization (keep, in the smallest suitable hook), and business-specific data and interaction (keep in the site). Delete in reference order rather than emptying layouts/ at once, because the home or download page may still call a partial you plan to remove.

  3. Move the configuration. title, languages.*, github_repo, github_branch, page_width and params.ui.* keep their meaning and position; OINK adds no namespace of its own. Turn on search and the logo with these keys:

    hugo.yml
    params:
      logo: img/product.svg
      offline_search: true

    Rename Docsy’s camelCase search keys yourself: offlineSearch, offlineSearchIndex, offlineSearchMaxResults, offlineSearchOnServe and offlineSearchSummaryLength all become their underscored forms. OINK ignores the old names without a warning, so search stays off silently until you rename them.

  4. Fonts and styles. Docsy’s SCSS hooks in assets/scss/ are no longer compiled, so its Sass variables, including the font variables and the Google Fonts switches, have no effect. Convert the hooks as described in Retired SCSS hooks. OINK bundles IBM Plex Sans, Inter, Chakra Petch and IBM Plex Mono, and no preset requests Google Fonts. To change fonts, use the token layer; see Brand and appearance.

  5. Convert the shortcodes. Docsy’s alert, pageinfo, tabpane and card families all have a current counterpart; convert them in bulk with the migration toolkit, one --only class at a time.

  6. Delete one group at a time and build after each. Rehearse on a scratch copy first, recording the theme commit, Hugo version, removed files and generated HTML file count; once the result is equivalent, repeat the steps on the production branch.

The “delete once verified” group in step two is usually:

  • layouts/baseof.html and the shared docs and blog baseof*.html;
  • the navbar, footer, sidebar, TOC, search and head CSS partials and their hooks;
  • the old brand documentation shell partials;
  • copies of the asciinema, echarts, infographic, doc-carousel, details, tab / tabpane, card and param shortcodes;
  • the JavaScript, Lunr copy, carousel code and SCSS that served only those implementations;
  • PostCSS and Autoprefixer steps that no site asset needs any more.

Two problems tend to surface after the deletions.

A site script reports $ is not defined. Docsy loaded jQuery in every page’s <head>; OINK does not need it and does not bundle it. If your site still needs it, load it from the site:

layouts/_partials/hooks/head-end.html
<script src="{{ (resources.Get "js/jquery.min.js").RelPermalink }}"></script>

A home page built from Docsy’s blocks/* fails with template for shortcode "blocks/cover" not found, because OINK has no such shortcode family. Build the home page from sections in data/home/<language>.yaml, or set layout: landing on the page; see Home and landing pages.

6.6 - Troubleshooting

Find the cause and fix of a build, language, search or hosting problem from its symptom, and check a site before you publish it.

When a build fails or a page looks wrong, start from a clean production build and read the first error, because later errors usually follow from it:

Terminal
rm -rf public resources/_gen
hugo --gc --minify --printPathWarnings --logLevel info

That one Hugo command is the whole build of an OINK site. If the log shows npm, PostCSS, Autoprefixer or a browser-asset download, the site still carries upstream Docsy’s build steps; see Migrating from Docsy.

Build

Symptom Cause Fix
Build fails on an older Hugo release The Hugo that runs is older than the tested 0.170+ releases Check hugo version and update to a current release (0.170+). If several Hugo binaries are installed, check PATH and the version configured in CI before installing another
TOCSS-DART: … You need to install Dart Sass The site pins OINK 1.5.1 or older, which compiles Sass, and Hugo 0.170 or newer no longer has a built-in Sass compiler Upgrade the site to the current OINK release, see Upgrade to 1.6.0, or build it with Hugo Extended 0.169 or older until you do
module "github.com/pgsty/oink" not found The theme did not resolve Hugo Module: check hugo mod graph, go.mod, go.sum, and unexpected workspaces or replacements. Submodule: confirm that CI runs git submodule update --init before Hugo. Archive / clone: theme: must match the directory name under themes/
Module download hangs or times out The Go module proxy is unreachable Hugo downloads modules through Go, so GOPROXY applies. In mainland China, use export GOPROXY=https://goproxy.cn,direct. In an isolated environment, use an offline archive or commit themes/oink/
{.cards}, {.steps}, {caption=…} appear as literal text Goldmark block attributes are off Set markup.goldmark.parser.attribute.block: true in the site’s own hugo.yml; Hugo does not merge a theme’s markup settings. Copy the whole block from the three Goldmark prerequisites
An image with an attribute line is wrapped in <p> and the caption does nothing markup.goldmark.parser.wrapStandAloneImageWithinParagraph: false is missing Add it, from the same block
Inline HTML is escaped into text markup.goldmark.renderer.unsafe: true is missing Add it, from the same block
\(…\) $$…$$ display literally Goldmark passthrough is off See Math. math: true does not turn passthrough on
shortcode "tabs" must be closed or self-closed A {{</* tabs */>}} has no matching {{</* /tabs */>}} Add the closing marker at the file:line:column the error names
template for shortcode "tabs" not found The body calls a shortcode that does not exist, or quotes shortcode syntax without escaping it Correct a misspelled name. To show shortcode syntax as text, put /* and */ inside the opening and closing markers, so Hugo does not treat it as a call
... attributes: unknown attribute "witdh" at ... An attribute-line key is misspelled or not permitted Correct the key; the warning lists the allowed ones. Until then the theme ignores the attribute, and it always drops style and on*
shortcode "field": unsupported parameter "colour" at ... A shortcode parameter name is wrong Correct the parameter the warning names, with its file and line. Until then the theme ignores it, so the preview keeps working
invalid params.ui.page_width "widee" (allowed: normal | wide | full) -- using "normal" A configuration or front matter value is outside its allowed set Correct the value the message names. Until then the theme uses the fallback it names and keeps building; see Configuration principles
A page setting has no effect and nothing is reported The key was written inside a ui: block in front matter Put page keys at the top level of front matter, without the ui. prefix of the site key. A front matter ui: block is ignored silently. See Page parameters
The build passes but production is missing a feature A warning turned the feature off Read the build warnings. An invalid value, a missing required giscus key or an unsupported comments.type switches that feature off instead of failing the build
Site styles disappear after an upgrade, with a stylesheet: assets/scss/… is ignored warning The site still has a retired SCSS hook Move its rules to assets/css/project.css; see Retired SCSS hooks

Both shortcode errors end with the file:line:column to fix:

build output
ERROR error building site: assemble: failed to create page from pageMetaSource /a:
  "…/content/docs/x.md:4:1": failed to extract shortcode:
  shortcode "tabs" must be closed or self-closed

ERROR error building site: assemble: failed to create page from pageMetaSource /a:
  "…/content/docs/x.md:4:5": failed to extract shortcode:
  template for shortcode "tabs" not found

Language

Symptom Cause Fix
A translated page does not appear Four possibilities, in order ① hugo.yml has languages.zh with a weight; ② the filename is page.zh.md, with zh lowercase; ③ the translation’s front matter has no draft: true and no future date; ④ routing metadata matches the source file
Switching language lands on the home page Hugo found no translation The switcher falls back to the target language’s home page when a page has no translation. Add the translation file to link the two pages
An anchor link opens the page but does not scroll The translated heading text differs, so the generated ID does too Set the English ID explicitly on the translated heading: ## 安装 {#installation}. If a heading contains a shortcode or inline HTML, read its ID from the English page’s rendered HTML instead of guessing
Menus or home page sections are untranslated They live in configuration and data files, not pages Menus are in languages.<lang>.menus, home sections in data/home/<lang>.yaml, interface strings in i18n/<lang>.yaml. See Languages
Symptom Cause Fix
A search box that never returns results No index was generated Check params.offline_search, then open search and find the request for the page’s data-td-index-src URL in the network panel. Production uses offline-search-index.<language>.<hash>.json; development omits the hash. If the index is missing only under hugo server, also check offline_search_on_serve
The index file returns 404 A wrong baseURL On a subpath deployment, a wrong baseURL is the most common cause. Check the requested index URL in the browser’s network panel; see Deploy
Search fails under hugo server but works in a build The site turned the preview index off params.offline_search_on_serve defaults to true, so the preview matches production. Remove an explicit false
Chinese queries find nothing Usually the page is missing from the index, or its text sits in the split body file Open the Chinese page’s data-td-index-src URL, and data-td-body-src if the index is split, to confirm the page was indexed, and check the offline_search_index scope. See Chinese, mixed queries, and identifiers
A new page is not found while old ones are The index is build output Rebuild. Under hugo server, wait for the rebuild after editing
params.search.algolia requires explicit appId, apiKey, and indexName values The three Algolia keys are incomplete Give all three explicitly; the theme never falls back to another project’s DocSearch credentials. If you do not want Algolia, delete the block
The command palette finds no content Commands and full-text search are separate Without an index the palette still opens, says the index is unavailable, and runs page actions and commands. See Command palette

Platform

Symptom Cause Fix
A 404 or missing styles on GitHub Pages A project site’s URL carries the repository path and baseURL does not Pass --baseURL "${{ steps.pages.outputs.base_url }}/" from the workflow instead of hard-coding the address. See the complete workflow in Deploy
“Last modified” and contributors are empty on GitHub Pages The checkout is shallow Add fetch-depth: 0 to actions/checkout, because enableGitInfo reads the complete history
A Cloudflare Pages build fails with Hugo template errors The build image’s default Hugo is outdated Set HUGO_VERSION to a current release (for example 0.170.1) in both the Production and Preview environments, and set SKIP_DEPENDENCY_INSTALL=1
The host’s build cannot fetch the theme The build environment has no Go Hugo Modules need Go. If the platform does not provide it, use a submodule or commit themes/oink/
CI output differs from local go.work took part in the CI build Set GOWORK: off and HUGO_MODULE_WORKSPACE: off in CI so it uses only the version pinned in go.mod
A preview deployment got indexed The preview was built in the production environment Drop --environment production from preview builds; a non-production build emits noindex and Disallow: /. See Analytics and SEO
macOS reports too many open files Live preview watches more files than the shell limit allows Exclude generated and irrelevant directories from the watch first, since they are the usual cause; raise ulimit -n only if that is not enough
Slow, or missed changes, under WSL The site sits on a Windows mount point Keep the site inside the Linux filesystem; change notifications and permissions across filesystems break live reload
Bootstrap / Font Awesome / Mermaid assets are missing An incomplete copy of the theme Do not substitute a CDN URL. Confirm that assets/third_party/, static/webfonts/ and VENDOR.json are present, and download the same pinned release again if anything is missing

Checks a site can run

Run the build on every change. The two scripts come from a checkout of the theme repository at the release your site pins, shown as /path/to/oink, and need only Python 3; replace the site path and base URL with your own.

A production build , Commandhugo --printPathWarnings
Duplicate output paths, invalid parameters, incomplete external integrations
Output trust check , Commandpython3 /path/to/oink/bin/check-output-security.py --public /path/to/my-site/public --base-url https://my-site.example/
Every href / src in all four outputs is site-relative or uses http(s) / mailto / tel; no javascript: URLs or inline on* handlers; a cross-site <iframe>, <script> or <img> needs an explicit --third-party. Details in Verifying an offline build
Book anchors , Commandpython3 /path/to/oink/bin/check-book.py --site-public /path/to/my-site/public
For a site with a book: every cross-reference target exists, kind and number agree, and IDs are unique within each page

Read the build’s warnings: each one names the key, the rejected value and the default the theme used instead, and When a value is wrong explains why OINK warns rather than failing the build.

Diagnostic habits

When no row matches:

  • Reproduce the problem with one known Hugo version and record its hugo version output, so the version cannot change between runs.
  • Compare the development and production configuration; a problem that appears only online is often an environment difference.
  • Separate theme behavior from a site override with a minimal page. Put the suspect content on a page of its own, then re-enable site overrides in batches until one batch brings the problem back.
  • Look at the failing page’s browser console and network panel, especially the paths of any 404 resources.

Getting help

When you open an issue, include the complete hugo version output, the theme version from hugo mod graph | grep oink, the first complete error, and a minimal page or site that reproduces it. With those four, nobody has to ask you for more details first.

  • Local preview — clean builds, clearing caches, containers and workspaces
  • Deploy — baseURL, the checklist and rollback
  • Upgrade — problems an upgrade introduces, and the migration toolkit
  • Search — index scope, ranking and Algolia
  • Languages — language configuration and the anchor alignment process

7 - OINK CLI

Learn what the optional OINK command-line tool does and how to build its unreleased local candidate.

oink is an optional command-line tool for OINK sites. It checks the links, anchors and translations in Hugo’s real output, creates a site from the Starter, and previews a theme upgrade before writing it. Hugo still renders the site, and a project you manage with oink remains an ordinary Hugo repository.

Unreleased, and not required

Every OINK site builds and previews with plain hugo and hugo server; you do not need the CLI. It is developed in its own repository, pgsty/oink-cli, with its own version and release cycle, and is currently a local 0.1.0-dev candidate: there is no published binary or installer yet, and its commands may still change.

What it does

Command Purpose
oink init Create a site from a fixed Starter and select its profile and languages.
oink doctor Inspect tools, configuration, and the resolved theme source.
oink check Check rendered links, translation relationships, and source/style rules.
oink dev / oink build Run Hugo’s preview server or production build.
oink new / oink move Preview page creation or moves before applying a saved plan.
oink translations Inspect translation status and diffs, and record human reviews.
oink upgrade Compare a theme upgrade before writing module changes.

Every command can also report in JSON or YAML (--json, --yaml) for scripts and CI, and the CLI can check several explicitly registered sites together and produce checked build artifacts. It has no editor of its own: write in your usual editor, preview with oink dev, and use oink inspect or oink check for structured diagnostics.

Try the local candidate

Build the binary from a checkout of oink-cli with Go and Make:

cd oink-cli
make deps
make build
./bin/oink --help
./bin/oink doctor --site ../my-docs
./bin/oink check --site ../my-docs

Replace ../my-docs with the path to your site. make deps is the only step that downloads anything (the Go build dependencies); the CLI itself runs offline unless you pass --network to a command that needs remote inputs it has not cached.

The candidate’s site commands still expect an older Hugo Extended build, even though OINK itself uses plain CSS and is tested on Hugo 0.170+. oink init copies a Starter snapshot pinned to OINK v1.3.2, so follow the upgrade guide to bring a generated site to the current release.

Previews change nothing: new, move and upgrade leave site sources untouched until you run the explicit apply step (oink plans apply for a saved plan, oink upgrade --write --expect-plan ID for an upgrade). dev and build write Hugo’s normal output and caches.

Further reading

  • CLI contract: every supported command, what it may change, and the maintainer rules.
  • Maintenance roadmap: the historical development stages and which of them were retired.