This is the multi-page printable view of this section.
Operations
- 1: Local preview
- 2: Deploy
- 3: Comments
- 4: Analytics and SEO
- 5: Upgrade
- 6: Troubleshooting
Once the content is written, this section gets it online and keeps it there: previewing changes on your machine, building and hosting the output, adding comments and analytics, upgrading the theme, and finding out why a build or a page went wrong.
Find it by task
| I want to… | Read |
|---|---|
| See my changes as I write | Local preview |
Build the public/ directory I deploy |
Local preview |
| Publish to GitHub Pages, Cloudflare Pages, Netlify or my own server | Deploy |
Serve the site under a subpath such as example.com/docs/ |
Deploy |
| Keep preview deployments out of search engines | Deploy |
| Let readers comment at the end of a page | Comments |
| Count visits with Google Analytics, Plausible or another service | Analytics and SEO |
| Check that search engines index the site correctly | Analytics and SEO |
| Upgrade OINK, or migrate from Docsy or OINK 0.4 | Upgrade |
| Fix a build error, empty search results or a 404 | Troubleshooting |
1 - Local preview
Two commands cover daily work. hugo server rebuilds the site every time you
save and reloads the browser for you; hugo writes the finished site to
public/, the directory you deploy:
Neither needs Node.js, npm or a CDN. The tools they do need, Git, Go and Hugo, are listed in Get started.
The preview server
Run hugo server from the site root, the directory that holds hugo.yml, and
open http://localhost:1313/. Each save, and each switch of Git branch,
triggers a rebuild and a browser refresh. The first start is slower because
Hugo downloads the theme module into its cache; later starts read the cache.
The switches worth knowing
-D/--buildDrafts,- Also builds pages with
draft: true -F/--buildFuture,- Also builds pages whose
date/publishDateis in the future -E/--buildExpired,- Also builds pages whose
expiryDatehas passed --disableFastRender,- Re-renders the whole site on every change instead of only the pages Hugo thinks changed
-M/--renderToMemory,- Serves from memory and writes nothing to
public/ -N/--navigateToChanged,- Sends the browser to the page you just saved
--bind,- The listen address; use
0.0.0.0to reach the server from your LAN or from outside a container -p/--port,- The listen port
--minify,- Minifies the preview as well, to reproduce production rendering
--printPathWarnings,- Warns when two pages write to the same output path
A good combination while writing:
-DFE is short for -D -F -E, so drafts, future-dated and expired pages all
appear while you work on them. --renderToMemory keeps those pages out of
public/, so a later deploy cannot pick them up by accident.
A change that did not take effect
By default Hugo re-renders only what it judges affected by a change, and edits
to layouts, configuration, data/ or an included file sometimes slip past
that judgment. When a page looks unchanged:
- Restart with
--disableFastRender. - Force a browser reload (
Cmd/Ctrl+Shift+R) to rule out the browser cache. - If the page is still stale, clear the caches and restart.
Reaching it from another device
The server listens on 127.0.0.1 only, so a phone or another computer cannot
reach it. Bind to every interface and give the address the other device will
use:
Without --baseURL, the page opens but its absolute links, the stylesheet and
the search index among them, still point at localhost.
Production build
Build what you deploy with hugo, never with hugo server:
The output in public/ is self-contained, so you can copy it anywhere
without the source tree. Each switch earns its place:
--cleanDestinationDir- Deletes files the current build did not write, so a page you removed does not stay live
--gc- Removes processed resources in
resources/_genthat nothing references any more --minify- Minifies the HTML, CSS, JS and XML output
--printPathWarnings- Warns when two pages claim the same output path, the most common silent error on a multilingual site
A successful build ends with a Total in … line. Read any warnings before you
deploy: each one names a setting the theme ignored, and the build kept going
with a safe default.
Two settings matter as soon as the output leaves your machine. baseURL
decides every absolute link, including a subpath such as /docs/; see
Getting baseURL right. The build environment,
production for hugo and development for hugo server, decides whether
pages ask to be indexed and whether analytics load; see
Keeping preview deployments unindexed.
Previewing in a container
A container is optional. It helps when a team wants everyone on the same toolchain, or does not want Hugo installed on every machine.
Set HUGO_VERSION to the release your team builds with (OINK is tested on
0.170+). A site still pinned to OINK 1.5.1 or older needs a different
package; see Upgrade.
Go is in the image because Hugo needs it to download a theme installed as a Hugo Module. A site that uses a submodule, an offline archive or a plain clone can drop Go and get a much smaller image. Nothing in the image needs Node.js, npm or PostCSS, and the build fetches no browser assets, so for a network-isolated environment you only have to mirror the base image and the Hugo and Go packages.
public/A container runs as root unless told otherwise, and a public/ written by
root cannot be deleted from the host without sudo. Map your user ID with
--user "$(id -u):$(id -g)", as the production build command above does.
Clearing caches
Hugo keeps intermediate output in three places. Clear the smallest one that explains the symptom:
public/,- A deleted page is still live.
hugo --cleanDestinationDirdoes this as part of the build resources/_gen/,- You changed image processing, fonts or the accent color and the page still looks old
hugo mod clean,- You changed the theme version and the old one still resolves. Add
--allto clear the whole module cache
List both public/ and resources/ in .gitignore. They are regenerated on
every build, and committed copies go stale and bloat the repository.
Previewing against a theme checkout
When you change the theme and the site together, point the preview at your
local theme checkout for one command with HUGO_MODULE_REPLACEMENTS. go.mod
stays untouched, so the substitution cannot be committed by accident:
From scratch shows the directory layout and the Go workspace alternative.
While the variable is set or a Go workspace is active, every build uses the
local checkout, whatever go.mod says, and a CI job can inherit either. To
build the published release, unset HUGO_MODULE_REPLACEMENTS, set
GOWORK=off and HUGO_MODULE_WORKSPACE=off, look for permanent replace
directives in go.mod and the Hugo configuration and for a _vendor/ copy,
then confirm the exact version with hugo mod graph in that same
environment. Never commit a workspace file that names a path on your
machine.
Verifying an offline build
If the site must work in a network-isolated environment, test both the build and the browser with the network cut off:
- Start from a verified theme archive and an empty module cache (
hugo mod clean --all). - Block outbound HTTP, HTTPS and the Go module proxy.
- Run the production build
hugo --gc --minify --printPathWarnings. - Browse pages in every language: a documentation page, a blog page, the home page, the 404.
- Use search, the light/dark toggle, diagrams and the content components the site relies on.
- Check every subresource origin and confirm that no unexpected remote host appears.
For the last step, run the output checker from a theme checkout of the same release your site pins. It needs only Python 3. Replace both paths and use the base URL you built with:
The script reads every href, src, srcset, poster and form action in
the HTML, print, Markdown and RSS output. Each must be a site-relative path or
use http, https, mailto or tel, and inline on* handlers and
javascript: URLs are rejected. An <iframe>, <script>, <link>, <img>,
<video>, <audio>, <embed>, <object> or <source> that points to
another host is an error. If the site embeds third-party content on purpose,
pass --third-party; if its languages live on several domains, list the extra
first-party hosts with --allow-host.
A pass covers that build only. Run the check again after every theme upgrade.
Verify
Start from empty caches so nothing stale hides a problem:
The build passes when it ends with Total in … and reports no ERROR. Then
check:
- The log shows no npm, PostCSS, Autoprefixer or asset-download step. One that appears comes from leftover Docsy configuration.
public/containssitemap.xmlandrobots.txt, androbots.txtreadsAllow: /.- With local search enabled,
public/holds an index per language, namedoffline-search-index.<language>.<hash>.jsonin production (development builds omit the hash). Open search and confirm that the URL in the page’sdata-td-index-srcattribute returns 200. - In
hugo server, a documentation page, a blog page, the home page and the 404 render correctly in every language and in both color schemes.
After deployment, repeat the checks on the live site with the deployment checklist. For a build that fails or looks wrong, see Troubleshooting.
Related
- Deploy — getting
public/to GitHub Pages, Cloudflare or elsewhere - Troubleshooting — build, language, search and platform faults
- From scratch and other install methods — Hugo Module, submodule or offline archive
- Configuration — every key in
hugo.yml
2 - Deploy
An OINK site builds to a directory of static files, so any host that serves
files can serve it, with no Node runtime, server-side rendering or build
plugin. Deploying comes down to three things: run the
production build, publish public/,
and set baseURL to the address readers will use. A site created from the
OINK Starter already has GitHub Pages and Cloudflare Pages workflows that do
all three.
Getting baseURL right
A wrong baseURL is the most common deployment fault, and a quiet one: pages
open, but the search index returns 404, page-action links point elsewhere and
some assets fail to load.
At the root of a domain:
Under a subpath such as https://example.com/docs/, include the path:
You can also override it at build time, which lets one source tree deploy to several addresses:
canonifyURLsLeave canonifyURLs at Hugo’s default, false. OINK’s templates and
content links resolve against baseURL, so a wrong path means a wrong
baseURL. Turning on canonifyURLs also rewrites relative links that were
already correct, which makes the fault harder to find.
With local search enabled, open search on the deployed site and watch the
index request in the browser’s Network panel: it must carry the right language
and subpath and return 200. Take the URL from the page’s data-td-index-src
attribute instead of guessing it, because production filenames include a
content hash (offline-search-index.<language>.<hash>.json).
Choosing a host
If the source lives on GitHub, one Actions workflow builds the site and
publishes it through the Pages deployment API, with no gh-pages branch to
maintain. The OINK Starter ships this file; copy it only when you assemble a
site yourself.
Build settings for CI explains each setting; keep them when you edit
the file. One is specific to GitHub Pages: --baseURL takes the address that
configure-pages computes, https://<OWNER>.github.io/<REPO>/ for a project
site, so you never hard-code it.
In the repository, set Settings → Pages → Build and deployment → Source to
GitHub Actions, push to main, and watch the first run on the Actions tab.
For a custom domain, enter it under Custom domain on the same settings page,
configure DNS as prompted, and set baseURL in hugo.yaml to the new domain.
If your publishing process needs a CNAME file, put it at static/CNAME;
Hugo copies it unchanged into public/.
The OINK Starter ships .github/workflows/cloudflare-pages.yaml, a Direct
Upload workflow: the production build runs in GitHub Actions with the same
build settings as the GitHub Pages workflow, and Wrangler uploads the
resulting public/ to a Cloudflare Pages project. It is the recommended path
for Starter sites.
- Create a Direct Upload Pages project. Its name defaults to the
repository name; to use another, set the repository variable
CLOUDFLARE_PROJECT_NAME. - Add the repository secrets
CLOUDFLARE_ACCOUNT_IDandCLOUDFLARE_API_TOKEN. The token needs Account → Cloudflare Pages → Edit. - Run Deploy to Cloudflare Pages once by hand. To deploy every push to
main, set the repository variableCLOUDFLARE_PAGES_ENABLED=true. - The canonical URL defaults to
https://<project>.pages.dev/. When a custom domain becomes production, setCLOUDFLARE_SITE_URLto it.
Cloudflare’s Git integration also works, with Cloudflare running the build:
set the build command to hugo --gc --minify --printPathWarnings, the output
directory to public, and HUGO_VERSION to a current release such as
0.170.1 (OINK is tested on 0.170+, while Cloudflare’s default image ships
an older Hugo). Choose one mode per project, Git integration or the
Direct Upload workflow, and build preview deployments with their own URL and a
non-production environment.
On a custom domain, Cloudflare can mistake module@version in an install command for an email address. This documentation site adds no-transform to the HTML response’s Cache-Control header in static/_headers. After deploying, open an install example on the production domain with JavaScript disabled and copy the command. Cloudflare email obfuscation
Netlify — set the build command to hugo --gc --minify, the publish
directory to public, and the HUGO_VERSION environment variable. The same
settings can live in the repository:
A theme installed as a submodule needs recursive submodule checkout enabled; one installed as a Hugo Module needs Git and Go in the build image. Build previews with the same Hugo release as production, unless the preview exists to test an upgrade.
Vercel — set the build command to hugo --gc --minify, the output
directory to public, and the HUGO_VERSION environment variable. There is
no npm install step.
Any static server (Nginx, Caddy) — serve an unchanged copy of public/.
The example serves /var/www/oink/current, a symlink to a release directory
that the offline packaging steps below create:
The site is purely static, so there is nothing to proxy to an application server.
Object storage — Hugo’s deploy command uploads to S3, Google Cloud
Storage or Azure. Name the target in the configuration:
After a build, hugo deploy compares the bucket with public/, uploads only
what changed, and invalidates the CDN cache when cloudFrontDistributionID is
set. Without --target it uses the first target; run it with --dryRun first
to see what it would change. The Hugo binary must be built withdeploy (check
hugo version), and the cloud credentials come from the provider’s standard
environment variables or configuration file; on AWS, confirm access with
aws s3 ls first.
Offline packaging — for a network-isolated server, build on a connected
machine with the target’s baseURL and carry the output over as one archive.
Give every archive a new release name:
On the Linux host you need write access to /var/www/oink and GNU mv;
current must be absent or a symlink, and current.next must not exist.
Unpack each release into a new directory and switch current to it:
The chain switches current only after the directory was created, the
archive extracted and index.html found, and the final mv replaces the link
in one step, so readers never see a half-written site. Never unpack over an
existing release directory, and keep the previous one: it is your
rollback. A different baseURL means a new build, not an edit
of the output.
A host without Go — a theme installed as a Hugo Module needs Go in the
build environment. Where the platform has none, install the theme as a Git
submodule (run git submodule update --init before the build) or commit an
offline archive under themes/oink/; see
From scratch and other install methods.
Build settings for CI
These settings belong in any CI build of an OINK site, whichever host receives the output. The Starter’s workflows already contain them.
fetch-depth: 0on checkout — withenableGitInfo, last-modified dates and contributor lists come from Git history, and a shallow clone gives every page the same date.- Go, then
go mod download github.com/pgsty/oink— Hugo needs Go to fetch a theme installed as a Hugo Module. A submodule install checks out withsubmodules: recursiveinstead, and an offline archive is committed underthemes/oink/; either way, drop both Go steps. GOWORK: offandHUGO_MODULE_WORKSPACE: off— keep a developer’s Go workspace out of the build, so CI builds the release pinned ingo.modand nothing else.- Hugo
latest— OINK uses plain CSS and is tested on Hugo0.170+, so CI can follow current releases. A site still pinned to OINK 1.5.1 or older cannot; see Upgrade. --environment productionand the real--baseURL— the environment decides indexing and analytics (see below), andbaseURLevery absolute link.--printPathWarnings, and no--panicOnWarning— OINK’s warnings are deliberate: a mistyped key or an incomplete integration warns and falls back to a safe default so the site still builds. Turning warnings into errors with--panicOnWarningorHUGO_PANICONWARNINGwould fail builds that are fine. Read the warnings in the build log instead.
Keeping preview deployments unindexed
Hugo’s -e / --environment changes how OINK builds, not what the site
contains. Only a production build:
- emits
<meta name="robots" content="index, follow">(other environments emitnoindex, nofollow); - writes
Allow: /and aSitemap:line torobots.txt(other environments writeDisallow: /); - renders the Google Analytics snippet;
- fingerprints the theme’s scripts and stylesheets and adds SRI
integrityattributes.
hugo defaults to production, even on a preview host, so build pull-request
previews and staging sites with another environment:
The output then asks search engines to stay away and sends nothing to an analytics service.
Content Security Policy
The theme’s scripts, fonts and icons are all served from your own origin, but
script-src 'self'; style-src 'self' alone still blocks parts of an ordinary
OINK page. The theme writes small inline scripts that set the color mode and
the page shell’s state before the first paint, inline styles for the
initial canvas, theme colors and font roles, and style attributes on some
components; Markmap adds inline configuration and styles. OINK ships no
ready-made policy, CSP hashes or nonce injection, so derive the policy from
your own built output.
Features you enable add their own requirements:
- Inline HTML and scripts that authors write under
renderer.unsafe: trueare the site’s to review. - ECharts
$fn:callbacks and custom themes: the site registers its functions onwindow.OinkEchartsFunctionsand its themes onwindow.OinkEchartsThemes, so the registering script’s origin belongs inscript-src. - Analytics scripts: the script you insert, and the host it reports to.
- Local PlantUML rendering: same-origin scripts,
wasm-unsafe-evalinscript-srcto compile WebAssembly, andblob:inimg-src. No rendering-service origin is needed. - Remote API specifications and self-hosted diagram services: their origins in
connect-srcandimg-src. - giscus: both
script-srcandframe-src. - Interactive maps (
params.map): your tile anddark_tileshosts inimg-src. - Video platform players (
params.video_embeds): the enabled player origins (https://www.youtube-nocookie.com,https://player.bilibili.com,https://player.vimeo.com) inframe-src, plus any remote media, poster, subtitle track or social-avatar hosts inmedia-src,img-srcandconnect-src. - Duo view and ReDoc API references render in same-origin frames, so
frame-src(orchild-src) must allow'self', and responses must allow same-origin framing (noX-Frame-Options: DENYorframe-ancestors 'none'). Duo view also adds an inline bootstrap script to every HTML page, which changes the script hashes.
Hash each inline script and style block you allow from the final deployed
bytes, or have the host inject a fresh nonce into both the policy header and
the matching tags on every response. A <style> nonce does not cover
style="…" attributes, which need style-src-attr of their own. Hashes
change with content, configuration, minification and theme upgrades, so
recompute them after each.
Start from a minimal policy that covers only the features you have reviewed,
and add permissions one at a time: keep ECharts options as pure data when no
callback is needed, review author-written inline scripts, and add a remote
origin only for an integration the site explicitly enabled. The output
checker in Verifying an offline build lists
every subresource origin, which is a good starting inventory. Ship the policy
as Content-Security-Policy-Report-Only first, and enforce it only after
light/dark startup, shell state, menus and every enabled component work in
the browser.
Acceptance checklist
Go through this table after each deployment. The first four rows can be checked in the build output; the rest need the real URL.
The build succeeded and you read its warnings- The log of a build with
--printPathWarningsends withTotal in … baseURLis correct<link rel="canonical">in the page source points at the real production address, subpath includedSitemap<baseURL>/sitemap.xmlresolves; on a multilingual site it is an index pointing at/en/sitemap.xml,/zh/sitemap.xmland so onrobots<baseURL>/robots.txtreadsAllow: /with aSitemap:line; a preview deployment readsDisallow: /Search index- With local search enabled, the URL in
data-td-index-srcreturns 200, its filename carries a hash, and site search returns results Markdown output- Where the site enables
markdownunderoutputs.page, appendingindex.mdto a page URL returns plain text llms.txt- Where the site enables
LLMSunderoutputs.home, the root of every enabled language servesllms.txt Every language- Documentation, blog and home pages open in each, and the language switcher lands on the matching page rather than the home page
Appearance and interaction- The light/dark toggle, the print view and common components (callouts, tabs, code-block copy) work
404- A path that does not exist shows the site’s own 404 page
The switches for sitemap.xml, robots.txt, .md and llms.txt are in
Configuration, and the agent-facing outputs are
described in AI-agent support.
Rollback
Roll back a static site by publishing the last known-good build again. Never patch files on the production host, because the next deploy silently undoes the patch and nothing records what changed.
- GitHub Pages: find the last successful
Deploy to GitHub Pagesrun under Actions and choose Re-run all jobs, orgit revertthe faulty commit and push. - Cloudflare Pages, Netlify, Vercel: pick the last good deployment in the platform’s list and promote it with Rollback or Publish deploy.
- Your own static server: point
currentback at the previous release directory kept by offline packaging. Do not extract the old archive over the new files; paths that only the newer release added would stay live.
On the Linux host, with the same symlink and GNU mv prerequisites as above,
replace the example with the release you kept:
Then open an old page at the public URL, and confirm that a path only the rejected release added is gone.
If a theme upgrade caused the problem, roll back the version pin in go.mod
instead; see Upgrade.
Related
- Local preview — the production build, clearing caches and offline verification
- Troubleshooting — 404s, empty search and platform-specific faults
- Analytics and SEO — being indexed correctly after launch
- Upgrade — upgrading the theme and rolling it back
- Configuration —
baseURL,outputsand the other site keys
3 - Comments
Comments give every page its own discussion thread at the end, with no comment server to run. OINK uses giscus, which stores each page’s thread as a GitHub Discussion in a repository you choose: readers sign in with GitHub to post, and you moderate in GitHub Discussions like any other discussion. The theme has no comment backend of its own and bundles no other provider.
The repository must be public, because visitors cannot read the Discussions of a private one.
A page with comments loads a script and an iframe from https://giscus.app,
so they cannot work in a network-isolated environment. Comments stay off
until you configure them; once on, mention giscus and GitHub in the site’s
privacy policy if it has one.
Enabling it site-wide
The whole configuration lives under params.comments. Replace the four
placeholders with the values giscus.app generates for your repository, as the
next two sections describe:
repo, repoId, category and categoryId are required and must all
describe the same repository and Discussion category. If any of them is
missing or blank, the build prints one warning and renders no comments, so
read the build log before you publish. type accepts only giscus; any other
value also warns and renders nothing. The key names match Hextra’s
params.comments, so a configuration moved from Hextra works unchanged.
Every other key has a default, listed in
Configuration: mapping
(pathname), inputPosition (top), theme (auto), loading (lazy),
strict, reactionsEnabled, emitMetadata, term, lang, lightTheme,
darkTheme, ariaLabel and errorMessage. The giscus switches accept a YAML
boolean or giscus’s own 0 / 1.
Preparing the GitHub repository
-
Choose a public repository to hold the threads. The site’s own source repository works.
-
Under the repository’s Settings → General → Features, turn on Discussions.
-
Install the giscus GitHub App on that repository. Without it, visitors can neither comment nor react.
-
Pick a Discussion category. giscus recommends one of the Announcements type, where only maintainers and the giscus bot can open a Discussion, so readers cannot start stray threads.
The repository ID and category ID are public identifiers, not credentials. Never put a personal access token, an OAuth secret or a password in the Hugo configuration: it is published with the site’s source.
Generating the configuration
Open giscus.app, enter the repository, the mapping and
the category, and the page generates a <script> block. Copy four of its
attributes into the OINK configuration:
data-reporepodata-repo-idrepoIddata-categorycategorydata-category-idcategoryId
mapping decides which Discussion belongs to which page. OINK’s default,
pathname, suits a site whose published paths are stable, and lets one
repository serve several domains or preview environments.
Settle the mapping before launch. If you change it, or move a page, after comments exist, giscus looks for a different Discussion: the old comments are not deleted, but the page no longer finds them. When a URL has to change, keep a redirect or rename the Discussion at the same time.
Per-page control
A page’s comments front matter overrides the site switch in either
direction, and the value nearest the page wins.
To allow comments on a few pages only, set enable: false site-wide but keep
the rest of the configuration, then turn comments on per page:
To keep comments everywhere except a few pages, leave the site switch on and turn them off where discussion does not belong:
For a whole section, use a cascade. This site sets comments: true in the
cascade of content/docs/_index.md, which is why a giscus thread appears at
the end of this page:
If the site also sets services.disqus.shortname, a working giscus
configuration takes precedence and Disqus does not load, and comments: false
on a page turns off both. When a required giscus key is missing, giscus is
skipped with a warning and Disqus loads instead.
Multilingual text
The giscus interface follows the page’s language. Simplified, Traditional and
Hong Kong Traditional Chinese each map to their own giscus locale, and
languages giscus does not support fall back to English. Set lang only when
the automatic choice is wrong.
OINK adds two strings of its own, the comment section’s accessible label and
the message shown when loading fails, and translates both in every interface
language it ships. To change their wording, set ariaLabel and
errorMessage per language; a language layer needs only the values that
differ, and the repository keys stay in params.comments:
Following light and dark
With theme: auto, the comment frame follows the reader’s light/dark choice
and visual preset, using stylesheets the theme ships to match each preset the
site offers.
To use other colors, set lightTheme and darkTheme, each to a giscus
built-in theme name or to the URL of a stylesheet on your site, such as
/css/giscus-brand-dark.css served from static/. They then apply under
every preset. A fixed theme name in theme stops the frame from following
the toggle at all.
The giscus frame runs on giscus.app and reads its stylesheet from your
site, the theme’s own or yours, so the response must allow cross-origin
reads. Configure Access-Control-Allow-Origin on the production host. For
hugo server, this site adds Access-Control-Allow-Origin: '*' under
server.headers in hugo.yml.
Privacy and CSP
- OINK never asks for or stores a reader’s GitHub password or token; signing in and posting happen entirely on giscus and GitHub.
- The comment loader is a same-origin script that the theme adds only to pages with comments enabled.
- The giscus script is requested when the reader comes within a scroll of the comment section, or is already past it; with
loading: lazythe iframe waits the same way. A visit returning from GitHub sign-in, and a site that setsloading: eager, request it at once. - Under a strict Content Security Policy, allow giscus in both
script-srcandframe-src. Merge these into your existing policy rather than replacing it; the general rules are in Content Security Policy.
If the script fails to load or never creates its iframe, OINK ends the
loading state and shows errorMessage in a live status region, so the page
never hangs on “loading”.
Verify
- Open a page that should have comments. giscus appears at the end with “Sign in with GitHub”, in the page’s language.
- Switch between light and dark. With
theme: auto, the comment section follows. - Open a page with
comments: falseand confirm that no comment section appears there. - Post a test comment, then check on GitHub that a Discussion appeared in the chosen category and that you can manage it.
Until the first comment or reaction creates a page’s Discussion, a “discussion not found” message in the browser console is expected.
When comments do not appear, check in this order: build warnings about the
four required keys; params.comments.enable and type; the page’s comments
front matter; whether the repository is public, has Discussions on and has
the giscus App installed; and the browser console and response headers for a
CSP block on giscus.app. When existing threads go missing, restore the
original mapping and page path first.
Related
- Repository links and page info — edit links, issue links, contributors and the “was this helpful?” widget
- Analytics and SEO — the other integration that calls an external service
- Deploy — Content Security Policy and preview deployments
- Configuration — every
params.comments.*key - Page parameters —
commentsin front matter
4 - Analytics and SEO
An OINK site reports nothing to anyone until you connect an analytics service: Google Analytics through one Hugo setting, anything else through a one-file hook. The theme loads no analytics, form or advertising script of its own, so the decision, and the line in your privacy statement, are yours.
Search-engine metadata, by contrast, needs no setup. Every page gets a
canonical link, hreflang links to its translations, a robots meta tag and
Open Graph and Twitter cards; your part is a correct baseURL and a
description on each page.
Connecting Google Analytics
Put your GA4 measurement ID in Hugo’s service configuration:
The snippet loads only in production builds, so hugo server reports
nothing. hugo builds for production by default, even on a preview host, so
build pull-request and staging deployments with another environment, as
Keeping preview deployments unindexed
shows. Without an ID nothing loads, and a Universal Analytics UA- ID is no
longer accepted: it produces a build warning instead of a snippet.
Use only this key; the top-level googleAnalytics key is deprecated. If you
do not want analytics, delete the block rather than leaving a placeholder,
because a placeholder ID still loads Google’s script.
Once configured, page views and events go to Google, which rules it out for a network-isolated site, and a strict Content Security Policy has to allow it; see Content Security Policy.
Connecting another analytics service
Plausible, Umami, Matomo and similar services need only their script on the page. The theme renders two hook partials for exactly this, so you add a file to your site and leave the theme untouched:
layouts/_partials/hooks/head-end.html,- Analytics scripts, cookie-consent scripts, meta tags the theme does not write
layouts/_partials/hooks/body-end.html,- Third-party code that affects interaction rather than the first paint
For Plausible, use the domain registered in your own account:
Keep the hugo.IsProduction guard. Without it, every local preview by every
author reports visits to your analytics account.
A cookie-consent script placed in head-end.html therefore runs first and
can stop analytics from starting.
The “was this page helpful?” widget is separate and off by default. It makes no request of its own and records answers through your Google Analytics integration when one exists; see Repository links and page info.
Duo view panes
If you enable Duo view
(params.ui.compare), opening it loads both pages in same-origin frames. The
Google Analytics integration (services.googleAnalytics.id) skips those
panes, so opening the reader does not count two extra page views. To do that,
OINK renders the snippet from its own pane-aware template instead of Hugo’s
built-in one, so an override at layouts/_partials/google_analytics.html has
no effect while Duo view is on.
Scripts in head-end.html still run in every pane. Check
window.OinkComparePane before recording a page view:
Server and CDN logs see the pane requests too; they carry the query
oink_compare_pane=1, which you can filter on.
Page descriptions
<meta name="description"> takes the first non-empty value of:
- The page’s
descriptionfront matter - The page summary Hugo computes (
.Summary) params.descriptionin the site configuration
So one description per page is the only SEO work an author has to do, and
it pays three times: as the snippet under the search-engine result, as the
card subtitle on its section’s index, and as the preview in site search.
On a multilingual site, write the description in each language instead of copying the English one, and set the site-wide fallback per language too:
canonical and hreflang
Every page gets one canonical link, plus an hreflang alternate for each
translation that actually exists. Nothing needs configuring:
The hreflang codes come from each language’s locale (en-US and zh-CN
on this site), and the links follow Hugo’s translation pairing. A page
without a translation gets no hreflang or og:locale:alternate for the
missing language, even though the language switcher still offers that
language’s home page.
Each page of a paginated blog index has its own canonical URL. From page 2
on, it carries no hreflang alternates, because the languages can have
different numbers of posts and their page boundaries do not line up.
Canonical links are built from baseURL. A wrong baseURL sends search
engines to addresses that do not exist, which is harder to notice than a
failed build, so go through the
deployment checklist before launch. Language
configuration itself is covered in Languages.
Social cards
The theme calls Hugo’s built-in Open Graph and Twitter card templates, which fill in the title, description, URL, language and site name:
To show an image when the link is shared, set images in the page’s front
matter:
For a site-wide fallback image, set the same key under params:
With an image, twitter:card becomes summary_large_image and the output
gains og:image and twitter:image. This site sets neither key, which is why
the output above has no image tags.
Sitemap
Hugo writes the sitemap itself; on a multilingual site it writes an index that points at one sitemap per language:
The site default and the per-page override are both Hugo’s own keys:
Search engines treat changefreq and priority as hints and may ignore
them. What matters more is checking before launch that drafts, private
content and non-canonical copies stay out of the sitemap, and that every
language has its own.
robots.txt and staying unindexed
Hugo writes robots.txt only when the site asks for it:
The theme supplies the content, which depends on the build environment:
The page’s robots meta tag follows the same rule: index, follow in a
production build, noindex, nofollow otherwise and always in print output.
The theme has no per-page noindex switch. To keep a page out of search
engines reliably, do not publish it: use draft: true or Hugo’s build
options. If the page must be published yet unindexed, write your own tag in
the head-end.html hook; the page then carries two robots tags, and each
search engine decides how to combine them.
Checking indexing
A week or two after launch, confirm that search engines see the site you think you published:
- Crawl permission:
<baseURL>/robots.txtreadsAllow: /, notDisallow: /. - Page inventory:
<baseURL>/sitemap.xmlopens; follow it to a language sitemap and check the page count. - Indexed pages: a
site:yourdomainsearch returns about the right number. The order of magnitude is enough. - Canonical addresses: results open the canonical URL, not a version with
?parameters or an old domain. - Submission: add the site to Google Search Console and Bing Webmaster Tools and submit the
sitemap.xmladdress, which gets it crawled sooner than waiting.
Verify
Run this from the site root, with PAGE set to a page your site generates
(including any language prefix):
In the browser’s Network panel, confirm that analytics requests carry your
measurement ID or registered domain. A deployment built with
--environment staging must make no analytics request, and a site with no
analytics configured makes none in either environment, though other
integrations you enabled still contact their own services.
Related
- Deploy —
baseURL, the checklist and unindexed preview deployments - Repository links and page info — the feedback widget, edit links and last-modified dates
- Languages — language configuration decides
hreflangand translation pairing - AI-agent support — the
.mdoutput andllms.txtwritten for models - Configuration —
services,sitemap,enableRobotsTXTand the rest
5 - Upgrade
Upgrading OINK means changing the release your site pins and checking what the new release renders differently. Most content needs no edits. Where a release retired a syntax or an interface, its section below says whom that affects and what to change, and a migration tool rewrites old shortcodes in bulk, dry run first. Do the work on a branch, so that abandoning an upgrade costs nothing but the branch.
OINK 1.6.0 and newer use plain CSS and are tested on Hugo 0.170+, so the build compiles nothing. OINK 1.5.1 and older need Hugo’s Extended edition, which ended with Hugo 0.169, so a site on an older release cannot follow Hugo past 0.169 until it upgrades; see Staying on 1.5.1 or older.
Read the release notes first
Each release’s notes list its changes, breaking changes and upgrade steps. Before you change the pin, read the notes of every release between yours and the target:
- Release notes on this site
- Releases on GitHub
They tell you which content needs editing, which configuration keys are gone and which defaults changed, so a page that looks different after the upgrade comes with an explanation.
Upgrading the Hugo Module
Pin a published release tag, or an immutable commit you chose deliberately,
never a branch or @latest, so that building the same site commit always
produces the same site. Check that the tag is published and resolves before
you pin it:
The module graph must show exactly that version; a commit you chose appears in
go.mod as a Go pseudo-version. Commit go.mod and go.sum. For the tag
above, go.mod reads:
If you also preview against a local theme checkout, that replacement overrides the pin; see Previewing against a theme checkout before you trust a build.
For a Git submodule, confirm that it has no local edits, fetch the tags and check out the exact release rather than following a remote branch:
Commit the new submodule pointer once the site passes. For an offline archive
or a clone, replace themes/oink/ with the complete tree of the new release
and confirm that theme: still matches the directory name. The trade-offs
between install methods are in
From scratch and other install methods.
What to do after upgrading
This clears caches that may still hold output of the old release, builds with the pinned release only, with no local replacement or workspace, and prints informational messages along with the warnings. Hugo’s deprecation notices among them say what a future Hugo will remove; resolve them before you upgrade Hugo itself, since how urgent each one is depends on the feature.
Once the build passes, look at the result: the home page, a documentation page, a blog page and the 404, in every language and both color schemes, the print view, and everything the site customizes.
Verify
A passing build does not finish an upgrade. Check each surface the site uses:
Documentation / Book- Sidebar order, paging, headings, page actions, numbering and cross-references
Blog- Chronological paging, RSS ownership, navbar and footer
Home / landing- Content with JavaScript off, the compact menu, print
Release pages- Derived download URLs, checksums, publication state
Components- One page for each component the site uses most
Accessibility- Keyboard-only use, focus order, both color schemes, forced-colors mode
Deployment- Every internal link and asset keeps the base path prefix
Then run the checks a site can run: the production build, the output trust check and, for a book, the anchor check. Deploy a preview and open its pages in a browser at the real URL, watching the network requests. Merge the upgrade only after that review, and smoke-test production once it is live.
Rollback
To roll the theme back, restore the previous pin:
- Keep the pre-upgrade module pin, site commit and known-good deployment artifact, and restore all three together.
- Never roll back part of it. Old layout copies over a new theme make a mixture that is harder to diagnose than either complete release.
- Keep the upgrade branch and what you learned verifying it. A rollback restores production first; it does not throw the upgrade work away.
Republishing the previous deployment itself is covered in Deploy.
Upgrade to 1.8.0
Review the 1.8.0 release notes and check these items before
pinning v1.8.0:
- Six visual presets and distinct dark modes. Paper returns to its classic
warm-paper and link-blue look (
#f7f6f3,#21201c,#2b5f8c, IBM Plex Sans over Hei).githubandnewsjoin the preset list,inkis redesigned as a written page (Palatino, Kai, Fangsong/Song and vermilion; silver and gold on indigo-violet in dark mode), and Dark Terminal is calibrated as a restrained phosphor screen. To offer all six styles, setparams.ui.preset_menu: [paper, slate, github, ink, news, terminal]. See Brand and appearance. - Appearance trigger and menu layout. Three, five or six presets arrange in
three columns above the three Color cards, with
Style (T)andColor (Y)legends when keyboard navigation is on. When the menu offers Color, the navbar trigger shows the reader’s choice. Light uses a sun, Dark a moon, and System a half-filled circle even when the system switches between light and dark. - Unified audio and video controls. Local audio and video files replace
native browser controls with the theme’s
.td-media__controlsrow, featuring a single three-color progress bar, playback speed toggle, volume slider, and captions and fullscreen controls for video. Sites with custom CSS targeting the former.td-media__progresselement should update to.td-media__controlsand.td-media__seek. - Quoted posts as
> [!SOCIAL]callouts. Quoted social posts use the> [!SOCIAL]Markdown callout form with a trailing block attribute line ({avatar="…" date="…" url="…" platform="…"}), keeping the quote readable as an ordinary blockquote in plain Markdown; see Social. If a site has legacysocialshortcode calls, convert them withpython3 bin/migrations/oink06.py migrate --site <dir> --only social --writefrom the theme repository, then runpython3 bin/migrations/oink06.py check --site <dir>to list any call it left unchanged.
Upgrade to 1.7.0
Sites already on 1.6.0 need no template or stylesheet migration. Review the
1.7.0 release notes and check these behavior and appearance
updates before pinning v1.7.0:
- Paper accent and preset typography. Paper moves to an ivory canvas (
#faf9f5) and a clay UI accent (#9b4a28, dark#de8460) while keeping blue underlined links in prose. To keep Paper’s previous blue accent, setparams.ui.theme_color: '#2b5f8c'. Terminal now sets screen prose in IBM Plex Mono (keeping IBM Plex Sans in print), and an explicitparams.ui.fonts.uiorfonts.bodyreaches the headings in every preset unlessfonts.headingnames its own face. See Brand and appearance. OINK 1.8.0 returns Paper to its 1.6.0 look and addspreset: news, which grew out of this 1.7.0 look and is the closest choice for a site that preferred it; see Upgrade to 1.8.0. - Updated single-key shortcuts. The shortcut map reorganized into twenty-nine bindings (10 navigation, 9 actions, 10 view): Zen Mode moves from
HtoZ(Hopens local browsing history), language cycling isX, preset cycling isT, color mode isY, blog index layout isL, version cycling isV, language home isG, command-only palette stays on\(withC), and[and]trigger ChatGPT and Claude.Gno longer opens the focused tree item (EnterandSpacestill do), and the home page’sNsection alias is gone (Jremains). Update any site-specific help copy or keyboard tests that mention pre-1.7 keys; see Keyboard shortcuts. - Typeset copy. Copying article prose now emits clean print-palette rich text by default so editors such as WeChat no longer keep page canvas backgrounds. Set
params.ui.rich_copy: false(or front matterrich_copy: false) if your site needs the browser’s default HTML copy. - New opt-in components and CSP. Timeline, Update, Social, and local Video/Audio work without external requests. If you enable
params.maporparams.video_embeds, allow your tile origin inimg-srcand enabled video hosts inframe-src; see Deploy. - Archived-version banner. Sites with
params.archived_version: truenow receive a styledrole="note"notice and require a non-emptyparams.version(omitting it warns once and drops the empty banner).
Upgrade to 1.6.0
Every site moving to 1.6.0 needs this section. The release keeps the
github.com/pgsty/oink module path but deliberately retires Sass,
Bootstrap’s JavaScript and Lunr, which is what lets Hugo 0.170 and newer
build the theme. Read the 1.6.0 release notes, then check
each item:
- Toolchain. Use a current Hugo release (tested on
0.170+; no Extended edition or Sass compiler needed). Removeextended: truefrom CI workflows once every branch you build uses OINK 1.6.0 or newer. - Stylesheets. Convert retired
assets/scss/_*_project*.scssfiles to plain CSS inassets/css/project.css, change hard-coded/scss/*.csspaths to/css/*.css, and switch custom-shell layouts topartial "css/bundle.html". See Retired SCSS hooks. - Bootstrap JavaScript. Remove dependencies on a theme-provided
window.bootstrapor ondata-bs-togglehooks, listen fortd:tab-showninstead ofshown.bs.tabon Landing download tabs, and change.dropdown-menuselectors on version lists to.td-version-menu__list. See Bootstrap’s JavaScript. - Local search. Remove site-script dependencies on
window.lunrand callOinkSearchEngine.create(documents, maxResults). Acontentindex over 2 MiB now moves page text intooffline-search-body.<lang>.json. See Local search without Lunr. - Markmap 1.1.0. Migrate the legacy Markmap 0.18 YAML keys to
foldLevel,wrapWidth,levelGap,siblingGapandcolorDepth; the old names warn and are ignored. See Markmap migration. - ReDoc 3.1.0. Each specification now renders in its own same-origin reader frame, so a Content Security Policy that restricts frames must allow
frame-src 'self'. ReDoc 2’shide-hostname,hide-logo,suppress-warnings,lazy-renderingandnative-scrollbarsdefaults are gone with its v2 API; if you override theredocshortcode or its styles, port those overrides to the ReDoc 3 API. Rename the specification extensionx-code-samplestox-codeSamples. Old links to operations still redirect, but ReDoc 2 deep links to schemas and to individual security schemes have no ReDoc 3 equivalent, so update any link that points at one. - Components that load on approach. Asciinema, ECharts, Infographic, Markmap and giscus now load as the reader nears them. If your own browser tests assert rendered charts, maps or players, scroll the component into view first.
Retired SCSS hooks
If your site has assets/scss/_variables_project.scss,
_variables_project_after_bs.scss or _styles_project.scss, convert them
by hand, once. The theme’s stylesheet is plain CSS and the build runs no Sass
compiler, so each of these files is ignored with one build warning, and until
you convert them the site builds with the theme’s default styles only.
- Move the rules in
_styles_project.scss, and in the partials it imports, toassets/css/project.cssas plain CSS. Native CSS nesting is fine. Write out what only Sass understands: variables, mixins such as Bootstrap’s breakpoints,@extend, and nested selectors that build a class name with&-. - For each Sass variable you assigned in the two variable hooks, set what it used to change. Colors and fonts have their own settings; see Brand and appearance. For anything else, override the custom property or the theme rule the variable fed.
- Build the site and compare the pages that matter.
project.cssloads after the theme’s stylesheet, so a theme rule of equal specificity no longer overrides your rule. Check elements that also carry a theme modifier class, and check each visual preset you offer. - Delete the three SCSS files and the partials only they imported. From then on, edit the project stylesheet.
If your own templates compiled the theme’s SCSS partials, ask for a theme stylesheet by name instead.
Bootstrap’s JavaScript
If your layouts, shortcodes or content use Bootstrap’s dropdowns, tabs,
modals or any other Bootstrap script, load Bootstrap yourself: the theme no
longer provides window.bootstrap or activates Bootstrap’s script hooks. To
find what depends on it, search for bootstrap., data-bs-toggle,
data-bs-dismiss, data-bs-target and .bs. event listeners. Replace each
with an OINK component, or load your own Bootstrap bundle in
layouts/_partials/hooks/body-end.html. The color-mode attributes
data-bs-theme and data-bs-theme-value still work.
On OINK Landing download tabs, listen for td:tab-shown instead of
shown.bs.tab; the event bubbles from the channel panel that just became
visible. The version lists in the footer and drawer use
.td-version-menu__list, so update custom .dropdown-menu selectors for
them. The version trigger reports its state through aria-expanded; observe
that attribute where a script listened for *.bs.dropdown.
Local search without Lunr
If your site uses local search, its configuration, index files and front matter keys are unchanged. After upgrading, check three things:
- The theme no longer ships Lunr. If your own layouts or scripts used
window.lunrfrom the theme’s copy, load Lunr yourself. - If you call
OinkSearchEngine.createdirectly, drop the Lunr argument:create(documents, maxResults). - Results rank differently. A short word no longer matches inside another
word, so
portno longer returns pages that only say “support”, and Chinese, Japanese and Korean queries no longer need spaces between words. Try the searches your readers use most.
A content index larger than 2 MiB is now published as two files: the index
keeps titles, headings and keywords, and offline-search-body.<lang>.json
holds the page text, which the palette loads after the first results. If you
set offline_search_index: summary only to stay within the size budget, you
can return to content. A script of your own that read body from a large
index must read the second file and join it by ref. An index within 2 MiB
is unchanged.
Fields are now search results: a query for a parameter name opens its entry
in a fields list or {.fields} table, with no change on your part. To keep
an established anchor, give the field an id. To make your own markup
searchable the same way, give the element an id and
data-td-search-entry="Title". The Shell contract
lists the rules.
Staying on 1.5.1 or older
If a site, or a branch you still build, stays on OINK 1.5.1 or older, its build compiles Sass and needs Hugo’s Extended edition, which ended with Hugo 0.169; those releases fail to build on Hugo 0.170. Everywhere that site builds, use the Extended edition at a release no newer than 0.169:
-
Locally,
hugo versionmust printextended. -
In GitHub Actions, give
peaceiris/actions-hugoan exact release and the Extended edition:the Install Hugo step of the workflow -
In the container image, install
hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.debinstead ofhugo_${HUGO_VERSION}_linux-${TARGETARCH}.deb, withHUGO_VERSIONno newer than 0.169. -
resources/_gen/also holds the CSS the build compiled, so clear it when a font or accent-color change does not show up.
Upgrade to 1.5.1
A site that leaves params.ui.compare unset needs no changes: 1.5.1 builds
exactly the same pages and outputs. The release stabilizes the opt-in
Duo view introduced in 1.5.0 and
fixes RSS, print, navigation, validation, search and accessibility behavior;
see the 1.5.1 release notes.
If you turn on params.ui.compare: true:
- Keep explicit
{#id}heading anchors aligned across translations, so Sync Scroll can match sections. - Set
languages.<lang>.params.ui.compare: falsefor any language that should neither show the reader nor appear as a target language. - Guard custom analytics in
head-end.htmlwithwindow.OinkComparePaneso pane loads are not counted twice. A local override of Hugo’sgoogle_analytics.htmlpartial is not used whilecompareis on; see Analytics and SEO. - Allow same-origin frames (
frame-src 'self') in your Content Security Policy, and make sure the server does not forbid same-origin framing withX-Frame-Options: DENYorframe-ancestors 'none'. - Open a translated Docs, Book or blog page and check that Open duo view (renamed from Open bilingual view in 1.5.1) loads the target language, syncs scrolling across shared headings, and switches cleanly on narrow screens.
Upgrade to 1.4.0 and 1.3.1
If your site uses PlantUML, 1.4.0 can render it in the browser with no extra
software or rendering service. To switch, keep params.plantuml: true or
plantuml.enable: true and remove svg_image_url; the two bundled browser
scripts take over. To stay in server mode, keep a non-empty endpoint, because
an empty endpoint now selects local mode. To turn rendering off, set
params.plantuml: false or plantuml.enable: false. Before switching an
existing diagram collection, review the
unsupported includes, libraries and CSP requirements.
Beyond that, 1.4.0 keeps the Hugo-only build and adds unified diagram
reading, richer local search, the opt-in table reader and the gallery blog
layout (1.4.0 release notes). After pinning it, review
navigation, image viewing and reader settings. If you install the theme as a
source copy, refresh the copied files as well; changing go.mod does not
update a vendored copy.
1.3.1 repaired Markmap text contrast and the fixed table of contents'
clearance above the footer, and added opt-in layouts for technical tables and
long FileTree comments. Existing content keeps its appearance; turn on
technical table layout or FileTree
wrap=true only where the full technical text has to show. A site that offers
all four styles keeps preset: paper with the explicit
[paper, slate, ink, terminal] menu. The 1.3.1 notes
describe these fixes and credit their contributor.
Upgrade to 1.2.0
If the site must keep its existing look, set params.ui.preset: slate
before adopting 1.2.0. preset_menu: true turns on reader choice and still
defaults to false. Ink and Terminal appear only when you name them as the
preset or in the menu list, and their buttons carry no experiment badge.
Review custom dark brand selectors as described in
Brand.
Apart from the appearance change, 1.2.0 needs no content migration. Check:
- The chosen preset, the light/dark icons, keyboard and mobile menus, saved preferences, and custom font and accent overrides. Sun means light and moon means dark, and switching styles must not change the saved light/dark preference.
- Explicit navigation, hidden subtrees, page links, Blog pagination canonicals, and SEO alternates for pages without translations.
- CJK search summaries that match only keywords, and outline links whose headings contain a literal percent sign. Compare the Edit, History and Create-child links for content on Windows or in mounts; mappings must yield repository-relative paths.
- Landing content with JavaScript disabled or blocked, preserved metric formatting, dialogs and keyboard shortcuts, the copy fallback, Draw.io controls, and numbered equations at narrow widths.
- Diagram endpoints and resource alt metadata in a production build: malformed values now warn and fall back safely. To disable rendering on purpose, use
params.plantuml: falseorparams.drawio.enable: false. - The revised PDF and migration tools, if you publish PDFs or convert content. Review PDF remote-resource opt-ins and migration diffs, including code examples nested in lists.
Upgrade to 1.1.0
If your site is on 1.0.x, no source migration is needed, and the module’s Go 1.27.0 directive is unchanged from 1.0.0; toolchain details are in the 1.1 release notes. What changed is behavior, so review the surfaces the site uses before choosing the new pin:
Languages- All 32 interface catalogs share one native-message schema. Check the site’s language labels, plural counts and RTL direction; authored translations remain the site’s responsibility.
Taxonomies- Root pages become term-card directories with a taxonomy switcher. Review taxonomy-template or CSS overrides, author portraits and localized breadcrumbs.
Sidebars- Cached trees keep each page’s effective settings and work without JavaScript. Test collapse, hover restore, the mobile drawer and keyboard focus; hidden content must leave the focus order.
Groupssidebar_divider: truekeeps a section’s children. Addbuild.render: neveronly if you mean to omit the group’s own outputs, then check child navigation, breadcrumbs, paging, Print and Book contents.Root menus- An explicit
sidebar_root_menu: falsenow applies to self-root sections too. The current linkable root stays visible as a location marker. Custom scripts- Feature-detect
OinkSidebarandOinkCommandPalette.registerSearchTailif an integration must also support 1.0.0. Restore branch state through the API rather than by changing classes or ARIA attributes. Copying articles- With image zoom on, copying an image and its caption yields plain text and rich HTML. Preview instructions must stay out of the copied article, and zoom and its keyboard controls must still work.
Print and Redoc- Check page and Book aggregate Print, heading and tab links, and local Redoc specifications under the real deployment prefix. Local specification paths are rooted under
static/.
params.ui.image_zoom and params.offline_search stay off by default, and
the new search hook enables no remote provider and adds no query telemetry.
params.ui.scroll_spy and the page-level scroll_spy are still accepted and
do nothing in 1.x, so removing an obsolete patch does not disable normal
outline tracking.
If the site keeps its own copies of theme code, such as an image-zoom script or a sidebar partial, compare them with the new implementation and update or remove them; otherwise the old copy keeps overriding the upstream fix. The details are in content groups, the sidebar contract, search actions and image zoom.
Upgrade from 0.4
If your site started on OINK 0.4 and a page gained or lost a feature after upgrading, check these changed defaults first:
-
Sequential paging is on.
docs,bookandblogpages end with previous / next links; documentation follows the sidebar tree and blog posts follow time. Setpager: falseon a page that stands outside any sequence. -
The navbar appears on every layout. Its compact state is one row of icon navigation with no second mobile accordion menu, so remove local scripts and tests that depend on the old mobile menu. To hide the navbar for a section, set
navbar_enabled: falsein a cascade. -
The footer defaults to
fatacross the site and accepts onlyfat,slimornone. Footer data lives indata/footer/<language>.yaml, ordata/footer.yamlon a single-language site; afooterkey left indata/homewarns and names the new location. -
Single-key navigation is on:
/opens full search and\opens command-only mode. Update training material that describes the old behavior. Page actions moved to a split button beside the breadcrumbs. -
The code block DOM changed: a
.td-codewrapper now encloses the original.highlight, and both.highlightand.chromaremain. In site CSS, replace a child selector such as.td-content > .highlightwith the descendant selector.td-content .highlight. -
The two ICP footer keys
footer_icpandfooter_icp_urlbecame one string that accepts inline Markdown:hugo.yml -
Mathematics needs Goldmark passthrough in the site’s own configuration, because Hugo does not merge a theme’s
markupsettings. If the site uses\(…\),\[…\]or$$…$$, enable passthrough in itshugo.yml; see Math.
Every key above is documented in Configuration and Layouts and page types. Convert the 0.4 shortcodes with the migration toolkit below.
The content migration toolkit
If your content still uses 0.4 shortcodes such as alert, tabpane or
imgproc, convert them with oink06.py instead of editing hundreds of files
by hand. It ships in the theme repository and needs only the Python standard
library:
- A dry run is the default and only
--writechanges files, so run it, read the diff, then write. - A second run must change nothing. If a second
--writestill reports changes, a transformation has not converged; stop and inspect those files. - Text inside code fences is left alone, so documentation that shows the old syntax stays intact.
- A construct the tool cannot express is left unchanged and reported with
file:lineand a reason, as a list for manual work rather than a failure.
To convert one class at a time, pass --only with keys from the last column
of the syntax map:
Afterwards, rebuild, read the warnings and look at the rendered pages. The tool guarantees valid syntax; whether each page still says what you meant is yours to check.
The 0.4 → current syntax map
{{%/* alert color= title= */%}},{{%/* details */%}},{{%/* pageinfo */%}}, hand-written<details><summary>,callout{{</* tabpane */>}}+{{%/* tab header= */%}},{{</* code-group */>}}+{{</* code-tab */>}},tabs{{</* filetree */>}}withfiletree/folderandfiletree/file,filetree{{</* gallery */>}}withgallery/image,gallery{{</* echarts */>}},{{</* infographic */>}},datafencedoc-cards/doc-card,nav-cards/nav-card,card/cardpane,doc-carousel,cards{{</* imgproc */>}},{{</* image */>}},image{{</* readfile file= */>}},includeThe fence attribute,{filename="x"}fencetitle{{</* badge outline= */>}},badge{{</* example */>}}+ a fence,{{</* book-figures kind="tbl" */>}},eg{{%/* _param x */%}},iframe,conditional-text,blocks/*,netlify, a kindlessxref,reportonly
Each page under Components describes the new form and its parameters.
Migrating from Docsy
If your site runs on Docsy, most of it carries over. OINK is a hard fork of
Docsy and keeps its content model, td- naming and most front matter, so the
migration is mainly deleting the site’s copies of the shared shell and letting
the theme supply it. The prose stays as it is.
-
Pin the target version. Point
go.modat an OINK release tag, or use a complete versioned archive. While you evaluate, an uncommittedgo.workcan point at a local checkout. -
Inventory the overrides. Sort every site-level file under
layouts/,assets/andstatic/into four groups: copies of the shared shell (delete once verified), components OINK already provides (delete or rename mechanically), brand customization (keep, in the smallest suitable hook), and business-specific data and interaction (keep in the site). Delete in reference order rather than emptyinglayouts/at once, because the home or download page may still call a partial you plan to remove. -
Move the configuration.
title,languages.*,github_repo,github_branch,page_widthandparams.ui.*keep their meaning and position; OINK adds no namespace of its own. Turn on search and the logo with these keys:hugo.ymlRename Docsy’s camelCase search keys yourself:
offlineSearch,offlineSearchIndex,offlineSearchMaxResults,offlineSearchOnServeandofflineSearchSummaryLengthall become their underscored forms. OINK ignores the old names without a warning, so search stays off silently until you rename them. -
Fonts and styles. Docsy’s SCSS hooks in
assets/scss/are no longer compiled, so its Sass variables, including the font variables and the Google Fonts switches, have no effect. Convert the hooks as described in Retired SCSS hooks. OINK bundles IBM Plex Sans, Inter, Chakra Petch and IBM Plex Mono, and no preset requests Google Fonts. To change fonts, use the token layer; see Brand and appearance. -
Convert the shortcodes. Docsy’s
alert,pageinfo,tabpaneandcardfamilies all have a current counterpart; convert them in bulk with the migration toolkit, one--onlyclass at a time. -
Delete one group at a time and build after each. Rehearse on a scratch copy first, recording the theme commit, Hugo version, removed files and generated HTML file count; once the result is equivalent, repeat the steps on the production branch.
The “delete once verified” group in step two is usually:
layouts/baseof.htmland the shared docs and blogbaseof*.html;- the navbar, footer, sidebar, TOC, search and head CSS partials and their hooks;
- the old brand documentation shell partials;
- copies of the
asciinema,echarts,infographic,doc-carousel,details,tab/tabpane, card andparamshortcodes; - the JavaScript, Lunr copy, carousel code and SCSS that served only those implementations;
- PostCSS and Autoprefixer steps that no site asset needs any more.
Two problems tend to surface after the deletions.
A site script reports $ is not defined. Docsy loaded jQuery in every page’s
<head>; OINK does not need it and does not bundle it. If your site still
needs it, load it from the site:
A home page built from Docsy’s blocks/* fails with
template for shortcode "blocks/cover" not found, because OINK has no such
shortcode family. Build the home page from sections in
data/home/<language>.yaml, or set layout: landing on the page; see
Home and landing pages.
Related
- Deploy — rolling back a deployment
- Troubleshooting — reading a build error after an upgrade
- Local preview — clearing caches and previewing against a theme checkout
- From scratch and other install methods — choosing between the four install methods
- Components — each component’s current form
6 - Troubleshooting
When a build fails or a page looks wrong, start from a clean production build and read the first error, because later errors usually follow from it:
That one Hugo command is the whole build of an OINK site. If the log shows npm, PostCSS, Autoprefixer or a browser-asset download, the site still carries upstream Docsy’s build steps; see Migrating from Docsy.
Build
| Symptom | Cause | Fix |
|---|---|---|
| Build fails on an older Hugo release | The Hugo that runs is older than the tested 0.170+ releases |
Check hugo version and update to a current release (0.170+). If several Hugo binaries are installed, check PATH and the version configured in CI before installing another |
TOCSS-DART: … You need to install Dart Sass |
The site pins OINK 1.5.1 or older, which compiles Sass, and Hugo 0.170 or newer no longer has a built-in Sass compiler | Upgrade the site to the current OINK release, see Upgrade to 1.6.0, or build it with Hugo Extended 0.169 or older until you do |
module "github.com/pgsty/oink" not found |
The theme did not resolve | Hugo Module: check hugo mod graph, go.mod, go.sum, and unexpected workspaces or replacements. Submodule: confirm that CI runs git submodule update --init before Hugo. Archive / clone: theme: must match the directory name under themes/ |
| Module download hangs or times out | The Go module proxy is unreachable | Hugo downloads modules through Go, so GOPROXY applies. In mainland China, use export GOPROXY=https://goproxy.cn,direct. In an isolated environment, use an offline archive or commit themes/oink/ |
{.cards}, {.steps}, {caption=…} appear as literal text |
Goldmark block attributes are off | Set markup.goldmark.parser.attribute.block: true in the site’s own hugo.yml; Hugo does not merge a theme’s markup settings. Copy the whole block from the three Goldmark prerequisites |
An image with an attribute line is wrapped in <p> and the caption does nothing |
markup.goldmark.parser.wrapStandAloneImageWithinParagraph: false is missing |
Add it, from the same block |
| Inline HTML is escaped into text | markup.goldmark.renderer.unsafe: true is missing |
Add it, from the same block |
\(…\) $$…$$ display literally |
Goldmark passthrough is off | See Math. math: true does not turn passthrough on |
shortcode "tabs" must be closed or self-closed |
A {{</* tabs */>}} has no matching {{</* /tabs */>}} |
Add the closing marker at the file:line:column the error names |
template for shortcode "tabs" not found |
The body calls a shortcode that does not exist, or quotes shortcode syntax without escaping it | Correct a misspelled name. To show shortcode syntax as text, put /* and */ inside the opening and closing markers, so Hugo does not treat it as a call |
... attributes: unknown attribute "witdh" at ... |
An attribute-line key is misspelled or not permitted | Correct the key; the warning lists the allowed ones. Until then the theme ignores the attribute, and it always drops style and on* |
shortcode "field": unsupported parameter "colour" at ... |
A shortcode parameter name is wrong | Correct the parameter the warning names, with its file and line. Until then the theme ignores it, so the preview keeps working |
invalid params.ui.page_width "widee" (allowed: normal | wide | full) -- using "normal" |
A configuration or front matter value is outside its allowed set | Correct the value the message names. Until then the theme uses the fallback it names and keeps building; see Configuration principles |
| A page setting has no effect and nothing is reported | The key was written inside a ui: block in front matter |
Put page keys at the top level of front matter, without the ui. prefix of the site key. A front matter ui: block is ignored silently. See Page parameters |
| The build passes but production is missing a feature | A warning turned the feature off | Read the build warnings. An invalid value, a missing required giscus key or an unsupported comments.type switches that feature off instead of failing the build |
Site styles disappear after an upgrade, with a stylesheet: assets/scss/… is ignored warning |
The site still has a retired SCSS hook | Move its rules to assets/css/project.css; see Retired SCSS hooks |
Both shortcode errors end with the file:line:column to fix:
Language
| Symptom | Cause | Fix |
|---|---|---|
| A translated page does not appear | Four possibilities, in order | ① hugo.yml has languages.zh with a weight; ② the filename is page.zh.md, with zh lowercase; ③ the translation’s front matter has no draft: true and no future date; ④ routing metadata matches the source file |
| Switching language lands on the home page | Hugo found no translation | The switcher falls back to the target language’s home page when a page has no translation. Add the translation file to link the two pages |
| An anchor link opens the page but does not scroll | The translated heading text differs, so the generated ID does too | Set the English ID explicitly on the translated heading: ## 安装 {#installation}. If a heading contains a shortcode or inline HTML, read its ID from the English page’s rendered HTML instead of guessing |
| Menus or home page sections are untranslated | They live in configuration and data files, not pages | Menus are in languages.<lang>.menus, home sections in data/home/<lang>.yaml, interface strings in i18n/<lang>.yaml. See Languages |
Search
| Symptom | Cause | Fix |
|---|---|---|
| A search box that never returns results | No index was generated | Check params.offline_search, then open search and find the request for the page’s data-td-index-src URL in the network panel. Production uses offline-search-index.<language>.<hash>.json; development omits the hash. If the index is missing only under hugo server, also check offline_search_on_serve |
| The index file returns 404 | A wrong baseURL |
On a subpath deployment, a wrong baseURL is the most common cause. Check the requested index URL in the browser’s network panel; see Deploy |
Search fails under hugo server but works in a build |
The site turned the preview index off | params.offline_search_on_serve defaults to true, so the preview matches production. Remove an explicit false |
| Chinese queries find nothing | Usually the page is missing from the index, or its text sits in the split body file | Open the Chinese page’s data-td-index-src URL, and data-td-body-src if the index is split, to confirm the page was indexed, and check the offline_search_index scope. See Chinese, mixed queries, and identifiers |
| A new page is not found while old ones are | The index is build output | Rebuild. Under hugo server, wait for the rebuild after editing |
params.search.algolia requires explicit appId, apiKey, and indexName values |
The three Algolia keys are incomplete | Give all three explicitly; the theme never falls back to another project’s DocSearch credentials. If you do not want Algolia, delete the block |
| The command palette finds no content | Commands and full-text search are separate | Without an index the palette still opens, says the index is unavailable, and runs page actions and commands. See Command palette |
Platform
| Symptom | Cause | Fix |
|---|---|---|
| A 404 or missing styles on GitHub Pages | A project site’s URL carries the repository path and baseURL does not |
Pass --baseURL "${{ steps.pages.outputs.base_url }}/" from the workflow instead of hard-coding the address. See the complete workflow in Deploy |
| “Last modified” and contributors are empty on GitHub Pages | The checkout is shallow | Add fetch-depth: 0 to actions/checkout, because enableGitInfo reads the complete history |
| A Cloudflare Pages build fails with Hugo template errors | The build image’s default Hugo is outdated | Set HUGO_VERSION to a current release (for example 0.170.1) in both the Production and Preview environments, and set SKIP_DEPENDENCY_INSTALL=1 |
| The host’s build cannot fetch the theme | The build environment has no Go | Hugo Modules need Go. If the platform does not provide it, use a submodule or commit themes/oink/ |
| CI output differs from local | go.work took part in the CI build |
Set GOWORK: off and HUGO_MODULE_WORKSPACE: off in CI so it uses only the version pinned in go.mod |
| A preview deployment got indexed | The preview was built in the production environment | Drop --environment production from preview builds; a non-production build emits noindex and Disallow: /. See Analytics and SEO |
| macOS reports too many open files | Live preview watches more files than the shell limit allows | Exclude generated and irrelevant directories from the watch first, since they are the usual cause; raise ulimit -n only if that is not enough |
| Slow, or missed changes, under WSL | The site sits on a Windows mount point | Keep the site inside the Linux filesystem; change notifications and permissions across filesystems break live reload |
| Bootstrap / Font Awesome / Mermaid assets are missing | An incomplete copy of the theme | Do not substitute a CDN URL. Confirm that assets/third_party/, static/webfonts/ and VENDOR.json are present, and download the same pinned release again if anything is missing |
Checks a site can run
Run the build on every change. The two scripts come from a checkout of the
theme repository at the release your site pins, shown as /path/to/oink, and
need only Python 3; replace the site path and base URL with your own.
A production build,- Duplicate output paths, invalid parameters, incomplete external integrations
Output trust check,- Every
href/srcin all four outputs is site-relative or useshttp(s)/mailto/tel; nojavascript:URLs or inlineon*handlers; a cross-site<iframe>,<script>or<img>needs an explicit--third-party. Details in Verifying an offline build Book anchors,- For a site with a book: every cross-reference target exists, kind and number agree, and IDs are unique within each page
Read the build’s warnings: each one names the key, the rejected value and the default the theme used instead, and When a value is wrong explains why OINK warns rather than failing the build.
Diagnostic habits
When no row matches:
- Reproduce the problem with one known Hugo version and record its
hugo versionoutput, so the version cannot change between runs. - Compare the development and production configuration; a problem that appears only online is often an environment difference.
- Separate theme behavior from a site override with a minimal page. Put the suspect content on a page of its own, then re-enable site overrides in batches until one batch brings the problem back.
- Look at the failing page’s browser console and network panel, especially the paths of any 404 resources.
Getting help
When you open an issue, include the complete hugo version output, the theme
version from hugo mod graph | grep oink, the first complete error, and a
minimal page or site that reproduces it. With those four, nobody has to ask
you for more details first.
- Theme and documentation issues: https://github.com/pgsty/oink/issues
- Issues with this site’s content: https://github.com/pgsty/oink.pgsty.com/issues
- Upstream Docsy compatibility discussion: https://github.com/google/docsy/discussions
Related
- Local preview — clean builds, clearing caches, containers and workspaces
- Deploy —
baseURL, the checklist and rollback - Upgrade — problems an upgrade introduces, and the migration toolkit
- Search — index scope, ranking and Algolia
- Languages — language configuration and the anchor alignment process