Serving your site locally
Preview content locally with Hugo’s development server.
OINK deployment has two separate stages: Hugo builds a complete public/
directory, then a static host publishes that directory. Keep build verification
and hosted verification distinct so a successful local command is not mistaken
for a completed production release.
Run the pinned Hugo Extended version from the site root:
hugo --gc --minify --cleanDestinationDir--gc removes unused cached resources, --minify produces production assets,
and --cleanDestinationDir removes files left by an earlier build. Review the
command before using the last option when publishDir points anywhere other
than the site’s dedicated output directory.
The build must finish without warnings that hide missing content, endpoints, or
resources. Inspect public/ locally before uploading it.
For editing:
hugo server --disableFastRenderHugo’s development server proves that the source can render. It is not a production host and its live-reload behavior is not part of the generated site. Always run a clean production build before release.
The plain hugo command uses the production environment. Oink marks HTML from
production builds as indexable and uses optimized, fingerprinted assets. For a
public preview that search engines must not index, build with another
environment:
hugo --environment preview --baseURL "https://preview.example.com/"Oink emits noindex, nofollow outside production. A hosting-level
X-Robots-Tag header is useful defense in depth, especially for non-HTML files.
Rebuild the reviewed source in production before publishing it at the
canonical URL; a preview artifact is not a production artifact.
Any host that can serve directories and files can publish OINK:
Set baseURL to the canonical production URL. If the site is published below a
path such as https://example.com/manual/, include that path and test it;
OINK’s local assets and component URLs are designed to preserve subpath
deployments.
Connect Pages directly to the source branch. OINK does not require a GitHub Actions workflow that prebuilds and pushes an orphan Pages branch.
Use these settings for an Oink site:
| Setting | Value |
|---|---|
| Production branch | main, or the reviewed source branch |
| Root directory | the standalone site directory |
| Build command | hugo --gc --minify |
| Build output directory | public |
HUGO_VERSION |
0.164.0 |
SKIP_DEPENDENCY_INSTALL |
1 |
As of 2026-08-08, Cloudflare Pages’ v3 build image documents Hugo 0.147.7 as
its default, below OINK’s minimum 0.160.1. Set HUGO_VERSION explicitly for
both Production and Preview rather than relying on the moving platform default.
SKIP_DEPENDENCY_INSTALL=1 prevents the platform’s generic dependency installer
from adding a frontend installation step that the site does not need.
For previews that need the generated Pages URL as their canonical build URL:
hugo --gc --minify --baseURL "$CF_PAGES_URL"Cloudflare documents public as Hugo’s standard output directory, the
HUGO_VERSION override, and the CF_PAGES_URL base-URL pattern. Recheck the
platform documentation when changing the build image or pinned Hugo version.
See the Cloudflare Hugo guide and Cloudflare build image reference.
For a disconnected environment, transfer both the site source and a verified theme archive rather than depending on an initial Hugo Module download:
themes/oink/ directory;theme: oink and run hugo --gc --minify in the site;public/ to the internal static server.Keep PlantUML and Diagrams.net disabled unless a reachable internal endpoint is configured. External links and embeds remain the content author’s responsibility.
Fingerprint-bearing CSS and JavaScript can use long-lived immutable caching. HTML, search indexes, feeds, and sitemaps should use shorter caching or revalidation so a new deployment becomes visible promptly.
Hosts that recognize the _headers convention can use a site-owned
static/_headers file. This is not a portable standard; review security headers
against the site’s actual inline content and integrations.
Canonical, hreflang, Open Graph, feeds, and absolute links depend on
baseURL. A production build should use the production URL; a preview may use
its temporary URL when link validation or social metadata needs to be accurate.
Do not publish a preview build to production without rebuilding against the canonical URL. Conversely, do not reject a preview merely because it contains the intentionally supplied preview host.
Verify each layer independently:
baseURL, languages, menus, repository metadata, and optional endpoints are
correct;404.html are present;404 handling behave as
configured;A green build log completes only the artifact stage. Deployment is complete after the hosted checks pass.
Keep the previous known-good static artifact or hosting deployment identifier. If a new release fails hosted validation, restore that artifact first, then diagnose source or platform behavior. Rebuilding an old source commit with a new unpinned toolchain is not equivalent to restoring the original artifact.
Preview content locally with Hugo’s development server.
Build and publish an Oink site with GitHub Actions and Pages.
Build and publish an Oink site with Cloudflare Pages.
Deploying your OINK site on Netlify with Hugo alone.
Publish Oink output with Amazon S3 and CloudFront.