CDN for Hugo

Serve the generated public directory through Cloud CDN. Retain versioned assets across releases and invalidate pages and feeds when a new build goes live.

Example release policy
Versioned resource
/css/main.047f.css
Refresh on publication
/index.xml

Refresh changed pages after a Hugo build

Use the Hugo public/ directory as a Cloud CDN origin. Cache pages and assets globally and purge on each rebuild.

Docs and blogs at the edge

Fresh cached pages can answer repeat requests without reading from the Hugo publishing origin.

Media next to the article

Images and downloads are cached; optional transforms avoid extra Hugo pipelines.

Rebuild, then purge

CI can invalidate HTML so editorial updates are not stuck behind TTL.

Configuration

Cloud CDN overview
  1. Publish public/ to an origin

    Any HTTPS static origin is enough for Cloud CDN to pull.

  2. Cache HTML and assets

    Long TTL for fingerprinted files, purgeable TTL for HTML.

  3. Add purge to the Hugo pipeline

    After hugo, purge changed sections or the whole HTML tree.

  4. Map the documentation or blog domain

    Attach TLS and cut over DNS.

Operational outcomes

  • Hugo sites are cached worldwide
  • Rebuilds can purge immediately
  • Images are delivered from the edge
  • The origin only answers misses

Frequently asked questions

Can I host Hugo on a files origin?

Yes, if Cloud CDN can pull it over HTTPS. The CDN hostname becomes the public site.

How should multilingual Hugo sites be cached?

Cache each language path separately and purge the language prefix on rebuild.

Does this help a documentation site?

Yes. Hugo docs sites are a common static origin for Cloud CDN. See also CDN for documentation.

Is compression included?

Cloud CDN supports Brotli and Gzip for eligible text assets.