Skip to main content

Static Site Generator

Learn what a static site generator is and why you might choose a static site generator, such as Gatsby, over other publishing tools.

What is a Static Site Generator?

A static site generator is a software application that creates HTML pages from templates or components and a given content source. Most static site generators, including Gatsby, accept Markdown-formatted text files as a source, although Gatsby is not limited to Markdown.

Static site generators are an alternative to database-driven content management systems, such as WordPress and Drupal. In such systems, content is managed and stored in a database. When the server receives a request for a particular URL, a software layer retrieves data from the database, merges it with template files, and generates an HTML page as its response.

Static site generators, on the other hand, generate HTML pages during a build process. Gatsby, for example, loads JSON from GraphQL, and merges that data with components to create HTML pages. These generated pages are then deployed to a web server. When the server receives a request, it responds with rendered HTML. Static pages eliminate the latency that databases introduce.

Note: It’s also possible to use Gatsby without GraphQL, using the createPages API.

You can also use static site generators to create JAMStack sites. JAMStack is a modern web site architecture that uses JavaScript, content APIs, and markup. Gatsby, for example, can use the WordPress REST API as a data source.

Advantages of static site generators

Static site generators reduce site complexity. That, in turn, improves speed and reliability, and smoothes the developer experience.

  • You don’t have to worry about database-toppling traffic spikes.
  • There’s no need to manage database server software or backups.
  • You can use version control software to manage and track changes to your content.
  • Because your site is static, you can even forgo web servers and load balancers altogether. Instead, you can host your site with a content delivery network that scales with your site’s traffic.

There are dozens of static site generators available, created with a range of programming languages. Gatsby is JavaScript at its core, and is built with React, GraphQL, and Node.js. See how Gatsby compares to WordPress and Drupal or to popular static site generators.

Learn more


Edit this page on GitHub
Docs
Tutorials
Plugins
Blog
Showcase