From scratch
When you want a clean standalone OINK site and want to understand every file in it—rather than letting an agent scaffold it or cloning a large template—a working project takes only a handful of files. This guide walks from an empty folder to a live site, shows how to switch an existing Hugo site to OINK, and covers offline and non-Go install methods.
If you want to add documentation inside an existing code repository’s docs/
directory instead of creating a separate repository, read
Add docs to a project. If you prefer a pre-built
three-language Docs, Blog and Book template with GitHub Pages and Cloudflare
Pages workflows ready to edit, you can also start from the
OINK Starter. For Docsy sites, follow
Migrating from Docsy.
What a minimal OINK project looks like
An OINK site is an ordinary Hugo repository. The theme itself does not live in
your Git tree: go.mod pins the exact OINK tag, and Hugo downloads it into the
module cache on the first build.
my-docs/
my-docs/
- hugo.ymlsingle site config: title, baseURL, languages, Goldmark, params, theme import
- go.modpins github.com/pgsty/oink@vX.Y.Z
- go.sumchecksums that verify the pinned release
- .gitignorekeeps public/, resources/ and Hugo caches out of Git
content/
- _index.mdhome page entry (optional when data/home/ drives the home page)
docs/
- _index.mdDocs section root: title, weight, sidebar root
- install.mdyour first documentation page
data/
home/
- en.yamloptional data-driven landing page (one file per language)
assets/
- icons/logo.svgoptional navbar logo, processed by Hugo
- css/project.cssoptional plain-CSS overrides (no Sass needed)
static/
- favicon.svgoptional browser icon, copied unchanged
Everything else—stylesheets, scripts, fonts, Font Awesome icons, search,
diagrams, and layouts—comes from the theme module. Commit source files plus
go.mod and go.sum; keep public/, resources/, .hugo_build.lock and
.hugo_cache/ ignored.
From an empty directory to the first page
Make sure Git, Go and Hugo are installed per Prerequisites, then run these four steps.
-
Create the skeleton and fetch the theme
TerminalReplace
github.com/example/my-docswith your repository’s module path.hugo mod getcreatesgo.modandgo.sum; commit both so every machine and CI run builds against the exact same verified theme release. Pin a tag rather thanmainso the site changes only when you deliberately upgrade; GitHub Releases lists every tag.Create
.gitignorebefore your first build so generated artifacts never enter Git:.gitignore -
Write
hugo.ymlRename the generated
hugo.yamltohugo.yml(Hugo accepts either name; keep only one configuration file at the root) and replace its contents with the baseline below:hugo.ymlEach block has one job:
Block Controls Without it Top level + languagesSite name, canonical baseURL, languages and navbarA wrong baseURLbreaks absolute links and search in productionmarkup.goldmarkThe three parser settings OINK components need Attribute lines render as literal {.steps}textparamsLocal search, repository links, presets and shell switches Optional features stay off by design outputsPer-page .mdcopies,llms.txtand print viewsNo “Copy as Markdown” or print view moduleTheme import Hugo cannot locate OINK For math equations, also add Goldmark’s passthrough extension from Math. Every site parameter and its default lives in Configuration.
-
Write the first section and page
Each top-level directory under
content/becomes a section, and nested folders build the sidebar ordered byweight. Give the section an_index.mdand add your first page:content/docs/_index.mdcontent/docs/install.mdAdd explicit
{#id}anchors to headings from day one: if you add a second language later, both languages share identical section links. See Writing pages and Organizing content for the full authoring model. -
Preview locally
TerminalOpen http://localhost:1313/docs/. You should see the Docs sidebar listing Install, working search, and the appearance switcher. The site root stays minimal until you add a landing page in
data/home/; see Home and landing pages.
Add OINK to an existing Hugo site
If you already have a Hugo site with content, work on a Git branch and keep
your existing content/ tree intact; you do not need hugo new site:
- If the site lacks
go.mod, runhugo mod initwith your repository’s module path; if it already has one, keep it. - Run
hugo mod get github.com/pgsty/oink@v1.8.0. - Replace the old theme selection in your configuration with
module.importspointing togithub.com/pgsty/oink(keeping unrelated module imports), and merge the threemarkup.goldmarksettings plusmarkup.highlight.noClasses: falsefrom Writehugo.yml. - Review custom templates under
layouts/, stylesheets underassets/, old-theme shortcodes, and front-mattertypeorlayoutvalues that depended on the previous theme. - Run
hugo serve, check representative pages across light and dark modes, then turn on optional OINK features one by one and finish with Verify.
Other install methods
A Hugo Module is the default because Hugo resolves the version and verifies its
checksum in go.sum. The other three methods serve specific constraints: an
isolated network without Go proxy access, a host without Go installed, or an
organization that audits a vendored copy inside its repository. Apart from
hugo mod vendor, they replace module.imports with theme: oink, making
version tracking and integrity checks your responsibility.
The four methods compared
| Method | Needs Go | Version auditable | Theme source in your repo | Use when |
|---|---|---|---|---|
| Hugo Module | Yes | go.sum verifies automatically |
No | The default |
| Git submodule | No | Repository records the commit | By reference | Theme must be referenced inside Git without Go |
| Offline archive | No | Checksums verified by hand | Yes | Air-gapped or offline build environments |
| Pinned source copy | No | Record the tag and checksum | Yes | Host requires a complete committed tree |
Hugo Module (recommended)
Run hugo mod graph to verify the resolved version and hugo mod get -u to
upgrade. Every machine that builds the site needs Go.
Git submodule
The site repository pins an exact theme commit:
CI must initialize submodules before running Hugo, otherwise themes/oink is
empty:
Offline archive
For an isolated network without internet access, prepare the theme on a connected machine and move the complete package across. There are two routes.
hugo mod vendor freezes the resolved module into _vendor/, so later
builds need neither network access nor Go:
Whenever _vendor/ exists, Hugo reads it automatically (hugo mod graph shows
+vendor) and module.imports stays unchanged. Only the vendoring step needs
Go; to upgrade, re-run hugo mod get and hugo mod vendor on a connected
machine. Because _vendor/ omits LICENSE, NOTICE and VENDOR.json, copy
those three files from the theme repository if you redistribute the archive.
A release tag archive avoids Go modules completely. Download a tagged
archive and unpack it into themes/oink/:
Because the repository root is the theme root, layouts/, assets/, i18n/
and static/ unpack straight under themes/oink/. To transfer the archive
with a checksum, create both on the connected machine:
Verify and unpack on the isolated machine:
Confirm these eleven top-level entries exist before your first offline build,
and keep LICENSE, NOTICE and VENDOR.json when redistributing:
themes/oink/
oink/
- go.modmodule path declaration
- hugo.yamltheme default parameters and mounts
- theme.tomltheme metadata required by theme: oink
- LICENSEApache-2.0
- NOTICEupstream attribution
- VENDOR.jsonthird-party runtime manifest: version, source, license, SHA-256
- assets/stylesheets, JS and bundled third-party runtimes
- layouts/templates, partials, shortcodes, render hooks
- static/bundled font files
- i18n/32 interface language catalogs
- data/SPDX license table for page-end attribution
Bootstrap, Font Awesome, fonts, search, and diagram runtimes all ship inside
the theme, so an offline deployment needs no node_modules, PostCSS or CDN.
Pinned source copy
If your host requires theme source files inside the site repository, unpack a
verified tag archive into themes/oink/ as above, set
theme: oink, and commit the files alongside a note of the tag and SHA-256
checksum.
Do not run git clone into themes/oink and commit that folder: the nested
.git directory makes Git record an uninitialized gitlink instead of the files.
To track by reference, use a Git submodule.
Developing against a local theme checkout
Only needed when editing the OINK theme and a site together. Place both checkouts side by side:
Point Hugo at the sibling checkout for a single command without touching
go.mod:
A Go workspace (go work init with HUGO_MODULE_WORKSPACE=go.work) works the
same way. Neither should ever enter Git; CI must build the release pinned in
go.mod. See Previewing against a theme checkout
for verifying which theme release actually resolved.
Verify
The build succeeds when it finishes with Total in … and prints no unexpected
warnings. Check that /docs/ opens with your sidebar, search finds a heading
from your page, dark mode changes code-block colors (noClasses: false), and
git status --short lists only source files (hugo.yml, go.mod, go.sum,
content/).
Related
- Get started — run the docs site locally and try the AI agent prompt
- Browse locally — daily reading, live editing, and watching AI agent reports
- Add docs to a project — embed an OINK site inside a repo’s
docs/directory - Configuration — every
hugo.ymlkey and default - Deploy — publishing
public/to GitHub Pages, Cloudflare Pages, or your own host - Upgrade — upgrading OINK releases and migrating from Docsy