The story of static sites
Static sites (websites) are not new. In fact they’ve been around since the era of Web 1.0. Back in those dim and distant days the internet only had a few contributors, so managing and maintaining a static website was fairly hassle-free, they use to have a couple of static html files.
However, the needs of creators and consumers have changed dramatically since then. So we need a new technology to generate static sites, befitting the resources and innovative spirit of the digital revolution.
This is where static site generators come in.
In this article we’ll talk about best static site generators that have been ruling the Jamstack world for a while now. It was a tough job to pick five – more than 300 generators exist today, and most of them are superb. But we’ve identified five that deserve special mention, due to their massive popularity in the Jamstack and web developer community.
First of all, let’s consider why static site generators are so crucial…
The evolution of websites has been a gradual, but relentless process.
Since the dawn of the internet (at least in popular consciousness) in the mid-90s, websites have developed not just from a technological perspective, but from a cultural one. Their role, and use cases, in our society have continued to expand. And with that growth, consumers have shown increase in contributing and creating digital content.
However, this has created problems in the traditional client-server architecture. As developers, we’ve needed to take on the role of managing servers and databases ourselves, whether it be upgrading, patching a security fix, or performing general maintenance issues.
What’s more, the traditional client-server workflow for a dynamic website is slow – and with each new innovation, it’s getting slower. Under the original model, developers would write code, test, build the app and ship it to a server. Users would request a page (resource) from the server, and the server would perform the computation, produce the required markups and send them to the user as a response. That’s far, far too many steps.
In late 2016,
Jamstack arrived as an architectural concept. The architecture is based on three key features:
- Reusable APIs
- Prebuilt Markup.
Let’s zoom into the
prebuilt markup part first. The word ‘prebuilt’ means that all templated markups are created at the time of application deployment. We don’t compute and create them on the server side and then send them to the client with a request; instead, we host the prebuilt version of the static HTML markup on a
CDN (Content Delivery Network) and serve it from there when a client requests it.
CDNs are faster and more secure in nature than regular servers, hence they serve pages much faster. Also, the prebuilt nature of the pages means they perform like static pages, wherever possible.
This, in turn, has created the need for
Static Site Generators(SSGs). These are the libraries, tools and frameworks (mostly Open Source) that help developers to create prebuilt markups.
Ok, enough history
Let’s get into it. Here are our top static website generators.
Next.js by Vercel is the most popular open-source
ReactJS framework right now. In fact it’s much more than just a Static Site Generator; it’s got options for server rendering, API supports, route pre-fetching, smart building and many more functions.
Next.js allows you to fetch data into your pages based on your use cases. The data fetching possibilities include:
- Prebuilding and Prerendering. This includes Static-Site Generation(SSG) and Server-Side Rendering (SSR).
- Updating content dynamically at run time. This relies on Client-Side Rendering(CSR) and Incremental Static Regression(ISR).
As a framework,
Next.js bundles many features by default so you don’t have to spend any time setting things up. These features include:
- React basis.
- In-built TypeScript configuration and support.
- Built-in CSS Support.
- API routes to create endpoints organically.
- Optimized bundling with code splitting.
- Image optimizations out of the box.
- Built-in internationalization support.
- In-built analytics support.
And that’s just the start.
The Next.js project is MIT licensed, with more than 2.5 million weekly downloads and over 80,000 stars on GitHub. What’s more, deploying a Next.js app on services like
Netlify is extremely straightforward.
You can learn more about Next.js here.
Gatsby (also known as GatsbyJS) is another open-source ReactJS framework designed to build fast, secure static sites with data from various platforms. Gatsby’s biggest strength is its unified data layer, which pulls data from various sources and renders it in the markup.
Gatsby empowers developers with myriad features out of the box:
- You can use static-site generation (SSG) to prebuild the content that matters most when the app/site launches.
- You can combine the static-site generation with deferred static generation and intelligent page rendering to update data at run time.
- Gatsby is based on ReactJS and uses GraphQL technology to transform and fetch data. These cutting-edge technologies provide a great developer experience.
- Gatsby has got a massive plugin ecosystem, be it for images, styling, data transformation, analytics and… well, a whole bunch of other stuff.
- The variety of plugin ecosystems allow developers to integrate Gatsby with all popular CMS and databases.
- There are plenty of themes and starter kits available for developers to get up to speed.
Again, the Gatsby project is licenced under the auspices of MIT. Furthermore, the 500,000 weekly downloads and 50,00 stars on GitHub make it one of the popular SSGs to try out.
You can learn more about Gatsby here. Like Next.js, it is easy to deploy a Gatsby site on cloud hosting services like
Gatsby Cloud or
If you want to learn how to integrate Bugfender on your Gatsby site, you can check our blog post on how both work together.
Hugo is another popular open-source static site generator built with the Go language. It’s simple, with a shallow learning curve to get started.
Hugo uses the markdown format for content, templates for layouts, i18n bundles and a plethora of configuration and data files to build the static sites.
Some of the key features of
- It offers the quickest start-to-completion build time of all the technologies in this list.
- The markdown style for creating content provides developers with flexibility, as many other content platforms support this format.
- i18n support allows devs to build multi-language sites quickly.
- The theming system is easy to implement and provides more than 300 themes to choose from.
- Aside from HTML output, Hugo supports other formats like JSON, AMP and various custom types.
eslint.org and [
netlify.com](<http://netlify.com/>) are built using this technology.
Eleventy has some incredible features that make it an ideal SSG choice for those just getting started with web development.
- It has a flexible configuration, and you need zero configuration to start with.
- You don’t have to change your project’s directory structure to use Eleventy in your project. It works with your project directory structure just as it is.
Eleventy is another MIT-licensed project and one of the fastest-growing, with close to 12,000 GitHub stars. You can find the starter project here for a quick introduction. If you want to go deeper, all details about deploying and hosting an Eleventy app can be found here.
Jekyll is a static site generator written in Ruby, known for making the creation of static blogs and websites extremely simple. It is widely popular with GitHub Pages, where you can host your site with a few simple steps.
- Jekyll is a Ruby Gem that requires the Ruby version 2.5.0 or higher.
- It requires only three simple commands to get your blog/site up and running.
- It supports Markdown, Liquid, HTML & CSS as the template language for site content.
- Jekyll is blog-aware, which means it has all batteries included to support features like pages, categories, permalinks and layouts.
Jekyll is open-sourced under… yep, you guessed it… MIT. It has 44,000 stars on GitHub.
Ok, so how do I select a Static Site Generator(SSG)?
With so many options available, this is a critical question. Actually, the answer depends on a few factors.
- Primary skill set. This may heavily influence your choice. It is very unlikely that you would select a Python-based SSG when you are a ReactJS developer, for example.
- End goal. What are you building? If it’s something simple like a blog or portfolio, your focus is content and so Jekyll, Hugo, Hexo, and Eleventy would be a great choice. If it’s a more complex project that requires good templating, a hybrid data-fetching mechanism is more appropriate. In this case you might be better off with Next.js, Gatsby, Grindsome or Sapper.
- Characteristics. There are some additional factors to bear in mind. How active is the community? How many GitHub stars does it have? How many times has it been downloaded? Is it open-sourced?
By thinking about these questions, you’ll be able to identify the SSG most suited to your particular needs and circumstances.
Before We Go…
Here are a few more great options for Static Site Generators, categorized by the programming languages they are built on.
- Reactjs: Gatsby, Next.js, React Static.
- Vue: Gridsome, Nuxt, VuePress.
- Vanilla JS: Eleventy.
- Angular: Scully.
- Golang: Hugo.
- Python: Pelican, Cactus, MkDocs.
- Java: JBake.
- Ruby: Jekyll, Slate and Middleman.
- Svelte: Sapper.js.
If you need more suggestions, head over to this page. It lists all Static Site Generators for Jamstack sites.
We hope you found this article insightful. If you’re using a Static Site Generator for your site or app, feel free to share your experience in the comment below.