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
Advantages of static site generators
Static site generators reduce site complexity. That, in turn, improves speed and reliability, and smooths 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.