This is the multi-page printable view of this section.
Authoring
- 1: Writing pages
- 2: Organizing content
- 3: Page parameters
- 4: Blog posts
- 5: Books
- 6: Image albums with Expo
- 7: Releases and downloads
- 8: API reference pages
Everything a reader sees comes from Markdown files under content/, and this
section shows how to write them: a documentation page, the folder tree that
becomes the sidebar, and the content types that bring their own layout, such
as blog posts, books, image albums, release pages and API references. They all
share one Markdown dialect and one set of front matter keys, so what you learn
in Writing pages carries over to every other type.
Find it by task
| I want to… | Read |
|---|---|
| Write a documentation page: front matter, heading anchors, links, images, drafts | Writing pages |
| Add callouts, tabs, steps, cards or field tables with plain Markdown | OINK’s Markdown extensions |
Shape the tree and the sidebar: _index.md, weight, icons, folding, several sidebar roots |
Organizing content |
| Look up what a front matter key does | Page parameters |
| Publish a blog post or a release announcement, with RSS | Blog posts |
| Publish a book: chapter numbers, figures and tables, cross-references, whole-book print | Books |
| Publish an image album: folder structure, metadata, layouts, the image viewer | Expo albums |
| Build a release and download page: version cards, asset tables, checksums | Releases and downloads |
| Publish an OpenAPI reference | API reference pages |
| Write in two languages: paired files, aligned anchors, untranslated pages | Languages |
| Look up a component’s syntax and parameters | Components |
1 - Writing pages
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:
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
- docs/
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:
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:
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/#prerequisitesand/zh/docs/install/#prerequisitesreach 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
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:
- Install PostgreSQL 18:
- Start the server and connect to it:
Tip
brew services listshows whether the server is running.
Writing links
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/),  |
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
aliasesso 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
refand 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  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:
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:
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:
- The page sits in the sidebar where its
weightputs it. - The right-hand outline lists your
##headings, and clicking one puts an English anchor in the URL. - A heading has the same anchor on the English page and on its translation.
Related
- Organizing content — how the directory structure decides the sidebar
- Page parameters — the full front matter table
- Components — each component’s syntax and parameters
- Languages — paired bilingual files and fallback for untranslated pages
- Local preview — the
hugo serverswitches worth knowing
2 - Organizing content
_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
- docs/
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.
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:
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:
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:
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:
An icon on every leaf page makes a long sidebar hard to scan, so a site-wide policy decides which entries show theirs:
| 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:
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:
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).
Documentation can therefore live at any path, with a cascade assigning
type: docs. To put a handbook at content/handbook/, its section root reads:
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:
| 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
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:
- The sidebar order matches the
weightvalues you wrote, and a new section appears where you expect it. - Each section index lists all of its children; a missing one has
hide_summaryset or lacks an_index.md. - Breadcrumbs and the pager follow the sidebar’s order, because they read the same tree.
- 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:
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.
Related
- Writing pages — how to write a single page
- Page parameters — the full definition of every front matter key used here
- Layouts and page types — site-level shell, sidebar and table-of-contents settings
- Navigation and menus — the navbar menu, breadcrumbs and pager
- Languages — keeping a bilingual tree consistent
3 - Page parameters
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.
A section’s cascade uses the same names one level deeper and applies them to
every page beneath it:
When several places set the same key, the most specific wins:
- the page’s own front matter;
- the nearest
cascadeabove it; - 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, ,- Page heading, browser title and search result title. Required on every page
linkTitle, ,- Short name in the sidebar, breadcrumbs, pager and cards
description, ,- One-sentence summary for section cards, search snippets and
meta description. Blog pages also show it as an introduction above the body weight, ,- Order among siblings; use multiples of 10.
0(unset) sorts after every page with a weight. See Organizing content draft, ,- A draft never reaches the build output; preview it with
hugo server -D. See Writing pages date, ,- Blog date and release-page sort key. A future date keeps the page out of the build by default
lastmod, ,- The page-end “last modified” time. With
enableGitInfoon, Git supplies it and you need not write it aliases, ,- Old paths that redirect to this page, for when a page moves
type, ,- Picks the template and the shell:
docs,book,blog,swagger,expo. See Organizing content layout, ,- Picks a layout for one page:
landingorreleases cascade, ,- 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, ,- Icon in the sidebar, section cards and search results, such as
fa-solid fa-rocket toc_hide, ,- Removes this page and its subtree from the sidebar and the pager sequence, in content-derived and explicit trees alike
hide_summary, ,- Leaves the page out of its section index
sidebar_divider, ,- 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: neverinstead (group without a page) sidebar_expanded, ,- Opens this section in the sidebar by default
sidebar_root_for, ,- Makes this section the root of the sidebar tree.
selfincludes the section index;childrencovers only its descendants. Any other value warns and is ignored sidebar_root_link_self, ,- The root row links to the section itself;
falselinks it to the parent section instead sidebar_root_menu, ,- 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, ,- When the sidebar root is the site home, removes this whole top-level section from the tree and the pager sequence
manual_link, ,- Points this row in the sidebar and section index somewhere else
manual_link_relref, ,- The same link, resolved with
relref. A missing target fails the build manual_link_title, ,- Hover title for the manual link
manual_link_target, ,- Link target such as
_blank; the theme addsnoopener no_list, ,- The section index lists no children
simple_list, ,- The section index lists children as a compact bulleted list
section_index, ,- Style of the section index
section_index_columns, ,- Column count of the card style
notoc, ,- Hides the outline in the right rail
pager, ,falseremoves previous / next from this page. A non-boolean warns and the page keeps its type’s settingnavbar_enabled, ,- Whether this page renders the navbar
navbar_autohide, ,- 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, ,- Whether this page renders breadcrumbs. Docs and Book pages default on, Blog pages off
theme_color, ,#rgbor#rrggbbaccent for this page. In a section root’scascade, it gives the whole section its own color. See Brand and appearancetheme_color_dark, ,- The dark-mode accent. A page that overrides only
theme_colorunder a cascade that sets this key inherits the cascade’s dark value, so override both.theme_color: falseopts the page out of an inherited section color page_context_menu, ,- The page action menu on the title row: copy Markdown, edit this page, print and so on
page_context_menu.assistant_links, ,- 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, ,- Width of the content column
reading_width, ,- Line length on Book pages. Applies only to
type: book footer_style, ,- Footer shape
body_class, ,- A class added to
<body>for the site’s own CSS reading_time, ,- Whether this page shows a reading time
sidebar_enabled, ,falsehides the left sidebar on this pagescroll_spy, ,- Accepted and ignored: the outline always highlights the heading you are reading
keyboard_nav, ,- Single-key keyboard navigation. See Keyboard navigation
lastmod_commit, ,- What follows “last modified”: the commit subject, its hash, or nothing
sidebar_expand_levels,sidebar_menu_compact,sidebar_menu_foldable,sidebar_item_overflow, ,- Per-page sidebar behavior; the values are in Configuration
sidebar_width_min,sidebar_width_max, ,- Limits for resizing the desktop sidebar on this page. A minimum above its maximum warns and restores the site pair
code_copy, ,- Default copy button on this page’s code blocks. A fence’s own
copy=wins rich_copy, ,- Typeset HTML copy for prose selections pasted into rich-text editors
toc_style, ,- A fixed right-rail panel, or a wider rail that starts in the content flow
toc_taxonomies, ,- Whether taxonomy clouds join the outline in the right rail
taxonomy_icons, ,- Per-taxonomy icon overrides for this page, or for a section through
cascade
Search
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, ,- Extra search terms: synonyms, abbreviations, other languages
search_boost, ,- 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, ,- 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, ,- The output formats this page generates.
[HTML]drops its.mdversion no_print, ,- 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, ,- Whether this page shows the giscus comment section. See Comments
feedback, ,- The “was this page helpful?” widget. The map form takes
enableandreasons annotation, ,- The “last modified” and provenance block at the page end
backlinks, ,- Lists the pages that link here in a “Backlinks” group beside the outline. A section can cascade it. See Navigation and menus
translation_notice, ,- The language of the authoritative version, so a translation can say so and link back. Write
falseon 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, ,- Address of the material this page is derived from. An empty string opts out of a value inherited through
cascade upstream_name, ,- Name of the upstream work, as the credit shows it. Required once
upstream_linkis set upstream_copyright, ,- Copyright notice, kept exactly as upstream wrote it. Required
upstream_license, ,- Must appear in
data/licenses. Required upstream_notice, ,- Page carrying the full notice: license text, warranty disclaimer, upstream NOTICE, snapshot pin. Required
upstream_ref, ,- Tag or commit of the snapshot, shown in parentheses after the work
upstream_source, ,- Entry in
data/upstreamsthat holds upstream facts shared by many pages upstream_modified, ,- 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, ,- 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, ,- Post byline; inline Markdown is allowed. Ignored on a page that has
authors authors, ,- Terms of the
authorstaxonomy, in byline order. Needsauthor: authorsundertaxonomies:. See Authors and bylines series, ,- Terms of the
seriestaxonomy; the strip above the body uses the first one. See Series series_weight, ,- Place in the series. Weighted members come first in ascending order, the rest follow by ascending date
tags, ,- Tags. See Taxonomies
categories, ,- Categories, likewise
images, ,- 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 asfeatured,coverorthumbnail byline, ,- Credit shown with the featured image wherever that image is rendered
featured_image, ,- How the post shows its featured image on the article itself;
heromakes a full-width image header blog_index, ,- Layout of the blog section’s post index.
tablealways lists the whole section without pagination blog_index_columns, ,- Card columns at wide breakpoints; medium and narrow screens keep their own limits
blog_index_size, ,- Posts per page for
list,cardsandgallery, and for all four views when switching is on. A standalonetableignores it blog_index_toggle, ,- 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, ,- 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, ,- Justified rows with 6px gaps, masonry with visible captions, or rows without gaps. Independent of
blog_index blog_gallery.size, ,- Target tile size in CSS pixels; independent of posts per page
share, ,- Share targets at the page end. Replaces any inherited list;
falseopts the page out; an unknown target warns and is dropped. See Share summary, ,- Excerpt for gallery entries and for post rows on tag and category pages when
descriptionis 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, ,- Chapter number, shown before the page title and the sidebar entry
book_status, ,- Marks an unfinished chapter: flagged in the sidebar and contents;
book-tocwithdrafts=falseleaves it out sidebar_headings, ,- Lists the current page’s headings under its sidebar entry, down to the given level;
truemeans h2 book_draft_banner, ,- 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, ,- Replaces the site block; absent fields use the defaults below
expo.images, ,- Pattern matching the image resources in the page bundle
expo.mode, ,- Arrangement shown until the reader picks one
expo.size, ,- 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, ,- Reads the sections from
data/landing/<key>/<language>.yaml sections, ,- 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, ,- 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’sdate; download assets come from achecksumsblock in the body. Any other value warns and the release block is skipped
Related
- Writing pages — the handful of keys every page needs
- Organizing content — what the sidebar and navigation keys do together
- Configuration — every site parameter in
hugo.yml
4 - Blog posts
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:
Four keys matter more on a post than on a documentation page:
-
dateis 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 withhugo server -F. -
descriptionappears 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. -
authoraccepts inline Markdown, so[Alice Chen](https://example.com/alice)works. For several authors, portraits or profile pages, useauthorsinstead; a post that hasauthorsignoresauthor. -
The date is shown in the format of
params.time_format_blog, ISO2006-01-02by default. Set it per language for a localized form:hugo.yml
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.
Featured image
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:
- the first entry of
imagesin the post’s front matter; - an image in the post’s page bundle whose filename contains
featuredorfeature, thencoverorthumbnail; it is cropped to fit, and the resource’s ownbylinebecomes its caption; imagesinherited from an ancestor section’scascade, nearest first.
The third source gives a whole section a default image, so posts without art of their own still get a thumbnail:
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 |
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.
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:
A post then names its authors in byline order:
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:
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:
A post names its series and may give itself a position:
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
- blog/
The section root sets the type for the whole subtree, along with anything every post should share:
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’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:
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:
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 form
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.
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:
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:
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:
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:
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
The build should end with Total in … and no ERROR. Then check that:
- the post appears at
/blog/in the right date order, with the date in the format you expect; public/blog/index.xmlexists, contains the post, and uses complete absolute links;- the post has a thumbnail in the index (if not, none of the three featured-image sources matched);
- each tag chip leads to its tag page.
Related
- Writing pages — how to write the body
- Page parameters — every blog key with its type and default
- Organizing content — directories and the sidebar
- Taxonomies — tags and categories
- Releases and downloads — version cards and asset tables
5 - Books
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:
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:
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:
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>.

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.
| 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 |
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.
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.
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:
tbl wraps the label, the table, the caption and the anchor in one figure:
| Output | Label | Anchor |
|---|---|---|
| HTML | Visible | Stable |
| Visible | Stable |
eq renders its content with KaTeX during the build, so it works without
passthrough:
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:
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.
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:
See Figure 2-2 and Example 2-1; with an explicit anchor: Figure 2-1.
- Give at most one kind key:
fig,tbl,eqoreg. 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:
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-toclists chapters atdepth=1, adds nested sections at2(the default), and adds each page’s headings at3.drafts=falseleavesbook_status: draftchapters out of this list without unpublishing them.book-figures,book-tables,book-equationsandbook-examplestake 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:
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:
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:
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/...#fragmentlinks ddia-v2- The site’s own
figureshortcode, 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:
The second report should show files_changed: 0, empty counts and
idempotent: true, and the script exits with code 0.
Verify
- Build with
hugo --printPathWarningsand read every warning: a malformed number, a duplicate ID and an example without a caption each produce one. - On a page, check for localized labels such as “Figure 2-1” and for
xreflinks that land on their targets. - Compare the chapter order in the sidebar, the pager,
book-tocand the whole-book print. - Check the Markdown output with
curl -s http://localhost:1313/handbook/ch02/index.md. A shortcode figure becomes**Figure 2-2.** captionfollowed by its body; a native figure keeps its source block and attribute line. - 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.
Book shortcode parameters
num, ,- Required (except for the bare
eqform). Matches[0-9A-Za-z.-]+and must be quoted id, ,- Matches
[A-Za-z][A-Za-z0-9_.:-]*and is preserved byte for byte caption, ,- Required for
eg. Optional forfig,tbl, andeq. Not Markdown class, ,- Appended to the
<figure>. Requiresnum src, ,figonly. Mutually exclusive with inner content, and follows the shared image resolution orderlinkaltwidthheight, ,figonly. Width and height are positive integerstitle, ,figonly. A migration alias forcaption, mutually exclusive with it
xref:
figtbleqeg, ,- At most one. Supplies the localized label and derives the anchor
anchor, ,- Required when no kind is given, together with inner link text
page, ,- Resolved through page lookup in the current language. A missing page warns and renders text without a link
book-toc:
depth, ,- 1 chapters / 2 with nested sections / 3 with the heading tree
drafts, ,falsefilters 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_kindandbook_partare accepted as metadata but change nothing on the page; onlybook_numberandbook_statushave a visible effect.- The index shortcodes render every page below the root, which lengthens the build of a very large book. Whole-book
printis 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.
Related
- Organizing content — how the tree becomes the sidebar and the reading order
- Images — captions, sizing, zoom and image processing
- Tables — table attribute lines and full-width tables
- Math — KaTeX and passthrough configuration
- Print — per-chapter and whole-book print
6 - Image albums with Expo
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.
-
Create the section entry, which makes everything below it an Expo page:
content/photos/_index.md -
Create a topic entry for each group of albums:
content/photos/nature/_index.md -
Create the album page:
content/photos/nature/field-notes/index.md -
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.
| 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:
| 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:
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
- Run
hugo --printPathWarningsand read the warnings. - Open each album and confirm the image order, titles and descriptions.
- Open a small image, a wide image, a tall image and, if the album has one, a GIF.
- Try Reset, Expand to fit, zoom, dragging, the keyboard shortcuts and Locate in album.
- Check both languages, a narrow screen, each preset you offer, and light and dark mode.
An empty album usually means a wrong type, a folder that is not a page bundle
(no index.md), or an expo.images pattern that matches nothing. A default
that seems to have no effect is usually overridden by a choice saved in your
browser, or by a page expo block that replaced the whole site block.
7 - Releases and downloads
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.
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:
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:
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:
| File | Checksum |
|---|---|
| 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:
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.
.rpm
| File | Checksum |
|---|---|
| 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:
Install script
The rolling channel deliberately contains no version interpolation.
Source archive
Release assets
| File | Checksum |
|---|---|
| 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:
- In
data/download/<key>.yaml, setversionto the new version andpublished: 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. - Write the release note, for example
content/blog/release/0.4.0.md, with itsrelease_url. - 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:
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:
A record takes the five top-level fields below; any other key warns and the whole block is skipped.
version, ,- The current version. Missing from both the record and the site, it warns and the block is skipped
repo, ,- GitHub repository; required once a pinned channel has a link or assets
tag, ,- Release tag. URL-safe characters only
published, ,falsewhile the tagged release and its assets do not exist yetchannels, ,- The channels, in display order. Must not be empty
Each channel:
id, ,- Unique within the record; also the channel’s anchor
kind, ,- Whether the channel follows the latest release or one exact version, which decides whether version facts may be interpolated
title, ,- Channel name. Must resolve to a non-empty value
note, ,- One line of explanation under the channel name
icon, ,- For example
fa-solid fa-bolt url, ,- Download link. Interpolated on
pinnedchannels only steps[], ,- Code steps, rendered by OINK’s enhanced code block
checksums, ,- Assets for this channel.
pinnedonly; use this orchecksums_src, not both checksums_src, ,- 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>. Azh-cnpage triestitle_zh_cn, thentitle_zh, thentitle. camelCase variants are not accepted. - Only a pinned channel’s
urlandsteps[].codeinterpolate${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
-
Build with diagnostics visible:
hugo --printPathWarnings. A malformed hash line, mixed algorithms, a missingbaseand 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. -
On the page, check that the card’s tag and date match the repository and that every asset row opens a real download.
-
Check each hash against the real artifact yourself. The table only displays the hashes you paste; it verifies nothing.
-
Confirm the Markdown output carries the full hashes:
-
Try the page with
published: falsefirst, and switch totrueonly once the tag and assets exist. Check every language, and a subpath deployment if you use one.
Related
- Blog posts — where release notes live and how they are ordered
- Code Blocks — code rendering and copying inside download steps
- Home and landing pages — the landing
downloadsection - Configuration —
params.versionand the related site parameters - Upgrade — how a site keeps up with new OINK versions
8 - API reference pages
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
- openapi/
- content/
- docs/
- write/
- openapi.mdthis page
- write/
- docs/
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:
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.
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:
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
- Build with
hugo --printPathWarningsand read the warnings. - Confirm the specification was published:
ls public/openapi/docs-demo.yaml, or openhttp://localhost:1313/openapi/docs-demo.yaml. - 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.
- 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.
Related
- Writing pages — page front matter and body basics
- Layouts and page types —
shell_types, page width and the sidebar - AI-agent support — why a component that is interactive only in HTML needs prose beside it
- Code Blocks — the lighter alternative of request / response examples instead of a whole UI