Skip to content

Hugo

Hugo is a fast static site generator written in Go. It outputs a fully static site to public/ by default. Since Hugo has no build plugin system, pageflare integrates as a post-build step — chain it after hugo in your build command or CI pipeline.

pageflare auto-detects Hugo projects when it finds hugo.toml, hugo.yaml, or config.toml in the project root.

Terminal window
npm install -D @pageflare/cli

Or install globally:

Terminal window
# Shell (Linux/macOS)
curl -fsSL https://get.appz.dev/pageflare/install.sh | sh
# Homebrew
brew tap getappz/tap && brew install pageflare

Run pageflare after Hugo builds:

Terminal window
hugo && pageflare public/ --in-place

Or add it to your npm scripts if you use a package.json:

package.json
{
"scripts": {
"build": "hugo && pageflare public/ --in-place"
}
}

Create a pageflare.jsonc in your project root to customize behavior:

pageflare.jsonc
{
"minify_html": true,
"minify_css": true,
"minify_js": true,
"js_defer": true,
"lazy_images": true,
"img_dimensions": true,
"font_swap": true,
"preconnect_hints": true
}

pageflare respects Hugo’s output directory automatically. If you use a custom output dir (hugo -d build/), pass the same path to pageflare:

Terminal window
hugo -d build && pageflare build/ --in-place
.github/workflows/build.yml
- name: Build Hugo
run: hugo --minify
- name: Optimize with pageflare
uses: getappz/pageflare-cli@v1
with:
args: "public/ --in-place"
netlify.toml
[build]
command = "hugo && pageflare public/ --in-place --no-progress"
publish = "public"

Or use the Netlify build plugin for automatic optimization.

vercel.json
{
"buildCommand": "hugo && pageflare public/ --in-place --no-progress"
}

See the Vercel platform guide for image CDN integration.

Hugo has its own --minify flag. You can use both — Hugo’s minifier runs first, then pageflare applies additional optimizations that Hugo doesn’t cover:

  • Lazy loading and image dimension inference
  • JavaScript defer and loader injection
  • Font display swap and self-hosting
  • Preconnect hints for third-party origins
  • Critical CSS extraction (Pro)
  • Responsive image srcset generation (Pro)
Terminal window
hugo --minify && pageflare public/ --in-place

Hugo has built-in minification (--minify), but pageflare goes further. If you’re using Hugo Pipes for asset processing, note the overlap:

Hugo featurepageflare equivalent
--minifyHTML, CSS, JS minification (more aggressive)
resources.FingerprintContent-hashed filenames
resources.PostCSSKeep — pageflare doesn’t run PostCSS, it optimizes the output
Hugo image processing (Resize, Fit)Keep for content images; pageflare adds lazy loading, dimensions, and responsive srcset

Set the PAGEFLARE_LICENSE environment variable to unlock Pro optimizations:

Terminal window
PAGEFLARE_LICENSE=your-key hugo && pageflare public/ --in-place

Hugo static output works with any hosting provider:

pageflare processes 0 files Make sure Hugo has finished building before pageflare runs. Use && (not &) to chain commands sequentially. Verify the output directory matches — Hugo defaults to public/ but this can be changed in hugo.toml.

HTML looks different after optimization If Hugo’s --minify and pageflare’s HTML minification conflict, disable one. You can turn off pageflare’s HTML minification in pageflare.jsonc:

{ "minify_html": false }

Slow builds on large sites Hugo builds are fast, but pageflare’s image processing can add time for sites with thousands of images. Use --force to skip incremental caching in CI, or run with log: 'info' to identify which phase takes the most time.