This is the multi-page printable view of this section. Click here to print.
Use the Oink theme
Oink separates the consuming site from the maintained theme. A site owns its content, brand assets, configuration, and business components; the theme owns the common shell, styles, browser runtimes, and reusable shortcodes.
Recommended setup
Import github.com/pgsty/oink as a pinned Hugo Module. The independent
pgsty/oink.pgsty.com repository
demonstrates the full production contract with English and Chinese content,
local search, dark mode, diagrams, API documentation, and component examples.
Experienced Hugo users can start from scratch. Existing Docsy sites should use the migration guide instead of recreating the shell by hand.
Theme source options
The preferred source is a released github.com/pgsty/oink module tag. A
complete release archive, pinned Git submodule, or pinned clone also works. Read
Other setup options for the trade-offs;
production must never follow an unversioned branch.
Build contract
Whichever source option is selected, this command must build the site:
hugo --gc --minify
Node-based commands in the project-site repository are maintainers’ regression tooling, not prerequisites for a consuming site.
1 - Before you begin
The consumer prerequisite is Hugo Extended. Git and Go are conditional on how the theme source is obtained.
Install Hugo Extended
Install version 0.160.1 or newer. The current validation
baseline is 0.164.0. A release’s support matrix takes precedence when these
values change.
Verify the selected binary:
hugo version
The output must contain extended. Standard Hugo cannot compile the theme’s
SCSS. Use Hugo’s official installation guides for the platform and pin the
same version in local development and CI.
Install Git when needed
Git is required to clone the site, use submodules, preserve .GitInfo, or fetch
a theme checkout. Verify it with:
git --version
A site built from an already extracted offline archive can run Hugo without network access, but keeping the source in version control remains recommended.
Install Go only for Hugo Modules
Hugo’s module commands use Go. Install Go when the site imports the theme as a Hugo Module, then verify:
go version
hugo mod graph
A versioned archive, adjacent theme directory, or Git submodule does not require Go at site build time.
Do not install a frontend toolchain
OINK ships Bootstrap, Font Awesome, LTR and RTL CSS, fonts, search, and browser runtimes as local versioned assets. Consumer sites do not install Node.js, npm, PostCSS, Autoprefixer, or RTLCSS for the theme.
Node-based commands in the project-site repository are maintainer-only tools. The production consumer command is:
hugo --gc --minify
Check the complete distribution
For offline or air-gapped use, confirm that the theme archive contains go.mod,
hugo.yaml, assets/, layouts/, static/, i18n/, LICENSE, NOTICE, and
VENDOR.json. Install Hugo Extended before entering the isolated environment,
then run the same build command with network access disabled.
What’s next?
2 - Inspect the bilingual project site
The independent
pgsty/oink.pgsty.com repository is
the complete bilingual example and regression site. It is intentionally more
comprehensive than a starter: use it as a reference, then keep only the content
and configuration your product needs.
Clone the project site
After the Oink theme has a public release, clone and build the site directly:
git clone https://github.com/pgsty/oink.pgsty.com.git product-docs
cd product-docs
hugo --gc --minify
The committed go.mod pins github.com/pgsty/oink. For local theme
development, clone the theme as a sibling and use the workspace commands
documented in the
Oink quick start.
Run the site checks
Hugo alone builds the site. Node.js is used only for the project site’s formatting, link, translation, and regression checks:
npm install
npm test
Open the generated site and check both English and Chinese pages. Use the language switcher from a translated detail page, not only from the home page.
Replace the example identity
Edit hugo.yaml and the files under config/, then replace:
- site and per-language titles and descriptions;
baseURL;- repository and branch URLs;
- copyright holder and starting year;
- logo and brand assets;
- English and Chinese menu labels.
Do not create an oink.* parameter namespace. Use Hugo’s language, menu,
module, output, and markup settings plus the documented theme parameters.
Replace the example content
Keep each translation pair together:
content/docs/getting-started.md
content/docs/getting-started.zh.md
Delete historical and regression content that the product does not need. Remove an example asset only after no page references it.
For translated headings, use the English rendered ID explicitly:
## Configure search
## 配置搜索 {#configure-search}
Put the new site in version control
Change the module path, repository metadata, and remote before publishing a
derived site. Keep the Oink version pinned in go.mod. Do not commit generated
public/ output unless the hosting workflow explicitly requires it.
What’s next?
- Review basic configuration.
- Learn the content components.
- Configure deployment.
- Use the release checklist.
3 - Create a new site: start from scratch
The independent bilingual project site is a useful reference. Use this procedure to create a smaller site with its own content structure.
Create the site skeleton
Run:
hugo new site --format yaml my-new-site
cd my-new-site
Initialize the site module and pin Oink:
hugo mod init github.com/example/my-new-site
hugo mod get github.com/pgsty/oink@THEME_REF
Add minimum configuration
Use this as hugo.yaml:
title: Product Docs
baseURL: https://docs.example.com/
defaultContentLanguage: en
languages:
en:
label: English
locale: en-US
weight: 1
menus:
main:
- { name: Docs, pageRef: /docs, weight: 10 }
- { name: Blog, pageRef: /blog, weight: 20 }
zh:
label: 简体中文
locale: zh-CN
weight: 2
menus:
main:
- { name: 文档, pageRef: /docs, weight: 10 }
- { name: 博客, pageRef: /blog, weight: 20 }
markup:
goldmark:
renderer:
unsafe: true
highlight:
noClasses: false
params:
offlineSearch: true
ui:
showLightDarkModeMenu: true
sidebar_menu_foldable: true
module:
imports:
- path: github.com/pgsty/oink
hugoVersion:
extended: true
min: 0.160.1
Commit go.mod and go.sum. Do not add npm mounts or a PostCSS pipeline.
Add bilingual content
Create these files:
content/
├── _index.md
├── _index.zh.md
├── docs/
│ ├── _index.md
│ ├── _index.zh.md
│ ├── getting-started.md
│ └── getting-started.zh.md
└── blog/
├── _index.md
└── _index.zh.md
Every page needs front matter. For example, content/docs/getting-started.md:
---
title: Getting started
weight: 10
---
## Install {#install}
Install the product.
Its getting-started.zh.md translation keeps the explicit heading ID:
---
title: 开始使用
weight: 10
---
## 安装 {#install}
安装产品。
Using the same explicit ID in both examples is harmless and makes the intended cross-language contract visible. In a translated existing page, copy the ID from the English rendered HTML.
Preview and build
Run the development server:
hugo server --disableFastRender
Then verify the production build separately:
hugo --gc --minify
Check /docs/, /zh/docs/, the language selector, local search indexes, and
the browser console before adding custom layouts.
Add features incrementally
Copy logo and brand assets first, then add repository links and menus. Add diagrams, API documentation, and content components only on pages that need them; OINK will publish their local runtimes on demand.
If a site needs a business-specific shortcode, keep it under the site’s own
layouts/_shortcodes/. Move it into the theme only after its interface is free
of site assumptions and multiple sites can reuse it.
What’s next?
- Expand the basic configuration.
- Learn how to add content.
- Review the OINK architecture.
- Select a deployment target.