More guides

Setup guide · Hugo

Turn a Hugo site into an installable PWA (2026)

Static Hugo PWA setup — place the manifest and service worker in static/, then add the install prompt via a partial.

By InstantPWA engineering·Web platform engineers, shipping PWAs since 2019·Last updated July 22, 2026

Key takeaways

  • Hugo copies `static/` verbatim — no build step for PWA files.
  • Register the service worker from a small inline script in `head.html`.
  • Add the InstantPWA popup for iOS install instructions.

Before you start

  • Hugo 0.100+
  • HTTPS origin
  • Two icon sizes (192 + 512)

manifest.webmanifest

{
  "name": "Your product",
  "short_name": "Product",
  "start_url": "/",
  "display": "standalone",
  "background_color": "#ffffff",
  "theme_color": "#111827",
  "icons": [
    { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
    { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
  ]
}

Step-by-step for Hugo

  1. Step 1
    Drop files in /static

    Create `static/manifest.webmanifest` and `static/sw.js`.

  2. Step 2
    Link from your head partial

    Edit `layouts/partials/head.html`.

    <link rel="manifest" href="/manifest.webmanifest" />
    <script>if ('serviceWorker' in navigator) navigator.serviceWorker.register('/sw.js');</script>
  3. Step 3
    Add the install popup

    Append the InstantPWA snippet to the same partial.

Minimal sw.js

// public/sw.js
self.addEventListener('install', (e) => self.skipWaiting());
self.addEventListener('activate', (e) => self.clients.claim());
self.addEventListener('fetch', () => {});

Common Hugo gotchas

  • Hugo aggressively caches partials — restart `hugo server` after editing head.html.
  • If you host on Netlify or Cloudflare Pages, set a `Cache-Control: no-cache` header on `/sw.js` in `_headers`.

FAQ

Do I need a native app if my Hugo site is a PWA?

No. Once your Hugo site meets the three PWA criteria (HTTPS, a manifest, a service worker), Chromium browsers offer to install it and iOS Safari 16.4+ supports the full standalone experience — including web push.

Will a service worker slow my Hugo site down?

Not measurably on first load. The worker installs asynchronously after the page becomes interactive. On repeat visits it typically improves LCP and TTFB because assets are served from cache.

Can I still deploy my Hugo site to Vercel, Netlify or Cloudflare?

Yes. Any static or edge host works — the manifest and service worker are plain files served from the origin. No build-time integration is required.

Skip the setup — drop in one line

InstantPWA handles the install prompt across iOS, Android and desktop. Free forever for one popup.

Get started free