Static site generator
A static site generator is a tool that builds a complete website as ready-made HTML files ahead of time, from templates and content files, so the server only has to hand out finished pages.
A static site generator does the page-building work once, when the site is built, instead of every time someone visits. The result is a static website: a folder of HTML, CSS, JavaScript and images that any simple host or CDN can serve. Hugo, Jekyll, Eleventy and Astro are well-known examples, and frameworks such as Next.js can work the same way.
Static does not mean the site cannot change or cannot be interactive. Content is updated by rebuilding, and interactive parts such as forms, search or booking widgets are handled by JavaScript or outside services. What is static is the delivery: there is no database query or page assembly when a visitor arrives.
How it works
Content is kept as files, often written in Markdown, a simple text format, or pulled from a headless CMS at build time. Templates define the layout of each kind of page. When the build runs, the generator reads every piece of content, places it in the right template, creates the navigation and listing pages and writes out one HTML file per address.
The finished files are then deployed, usually automatically through CI/CD, to a host that serves them as they are. Because there is no code running per request, pages can be served from caches around the world and arrive quickly, and there is very little on the server for an attacker to exploit.
The trade-off is that every content change needs a rebuild. A small site rebuilds in seconds; a site with thousands of pages can take minutes, and some generators rebuild only what changed. Anything that must differ per visitor, such as a logged-in account page or live stock levels, needs a separate service or a different approach for those pages.
Example
A law firm's website has about forty pages: practice areas, team profiles, a contact page and a news section updated a few times a month. It is built with a static site generator, with content edited through a headless CMS so staff never touch code. When an editor publishes, the CMS triggers a build, and the updated site is live within a few minutes.
The contact form sends submissions to a form-handling service rather than to the firm's own server. Hosting costs are low because only static files are served, and there are no plugins or server software to patch. When the firm later wants a client portal with logins, that is built as a separate application, because a static site cannot provide private, per-user pages on its own.
Why it matters for your business
For content sites that change occasionally, a static site generator gives fast pages, low hosting costs and a small security surface, with fewer of the plugin and update chores that come with a traditional CMS. The costs are elsewhere: editing usually needs a headless CMS or a developer, forms and search rely on extra services, and features that need a database are harder. If your team publishes every day, needs non-technical editing with previews or runs a shop with many products, a traditional CMS or ecommerce platform may be the simpler choice.
Common mistakes
- Choosing a static site with no editing interface and leaving staff dependent on a developer for every typo.
- Forgetting that forms need a backend service, so submissions go nowhere after launch.
- Adding so much client-side JavaScript that the speed advantage of static pages is lost.
- Not automating builds, so content changes sit unpublished until someone remembers to rebuild.
Questions people ask
What is the difference between a static site generator and a CMS?
A traditional CMS builds pages when visitors request them, from a database, and includes an editing interface. A static site generator builds all pages in advance as files and usually has no editor of its own. Many static sites pair a generator with a headless CMS for editing.
Can a static website have a contact form?
Yes. The form is part of the page, and submissions are sent to a form-handling service, a serverless function or an email service rather than to a database on the same server. Spam protection and data handling need to be set up as with any form.
Are static sites better for SEO?
They are well suited to it, because pages are complete HTML that loads quickly and is easy for search engines and AI crawlers to read. Rankings still depend on content, titles, links and structure. A slow or poorly built static site has no automatic advantage.