Proper websites, done properly

What is the best static site generator to use right now?

6 minute read time / 772 words

Static Site Generators are brilliant. Let's just put that out there right away. If you're still tethered to an antiquated Content Management System (CMS) setup like Drupal or Wordpress, it might be time for a change.

What is a Static Site Generator?

The clue is in the name, and, like Ronseal, it does exactly what it says on the tin. An SSG is a tool or framework enabling the generation of all necessary files to run your site. Once these files are deployed to your web hosting, your site functions seamlessly.

Out-of-the-box, most SSGs allow you to create 'content-only' sites, but they offer flexibility to integrate various extras. Due to generating primarily HTML pages, SSGs are perceived as more secure. Since they don't rely on database connections like a traditional CMS, SSG websites not only boast enhanced security but are also significantly faster.

This doesn't mean you can't have a CMS working behind the scenes for your content. Instead, it provides the option to use a Headless CMS in your build, separating it from the frontend. During site builds, it can fetch CMS content as needed.

Contrary to their name, Static Site Generators can do much more, including content management, e-commerce, signup/login functionality, and more.

Factors to consider when choosing an SSG

There's a lot of choice. What you choose depends on many factors:

  • What does your hosting support? Consider your hosting environment, as deployment routes vary based on your hosting platform.
  • What languages are you comfortable writing in? Your proficiency in languages matters; React is popular, but there's ample choice beyond it.
  • What templating languages/styles do you prefer? React-based SSGs expect JSX, while others like Eleventy provide more language flexibility.
  • How much handholding do you need? Some SSGs offer guided installations, while others like Eleventy provide basic setups with more flexibility.
  • How much does it need to do out of the box for you? Assess if you need extensive features from the start or prefer a more straightforward setup.
  • What sort of additional functionality do you think you'll need? Anticipate future requirements, such as sitemaps, RSS feeds, headless CMS, etc.
  • How will you be developing the site? Ensure compatibility across different operating systems, especially if developers use varied systems.

The shortlist

Over the years, I've tried a few Static Site Generators, and the top four for me are:

Sure, I've tried others too, but these are the four I've had the best experience with based on my requirements at the time.

Pros and cons

Eleventy

Pros:

  • Offers flexibility with a vast choice of templating languages.
  • Enables mixing and matching of templating languages.
  • Quick and easy to start with.
  • Lightning-fast performance.
  • Doesn't output anything that you don't ask for.
  • Allows easy plugin integration and custom functionality.

Cons:

  • Minimal out-of-the-box features.
  • Comprehensive documentation, but finding specific answers can be challenging.
  • Limited ready-to-use plugins.
  • When you Google, do you write 'Eleventy' or '11ty' because it's hard to be sure!

Astro

Pros:

  • Simple guided setup.
  • Basic usage is straightforward for React users.
  • Fast performance.
  • Doesn't output anything that you don't ask for
  • Reasonable selection of plugins

Cons:

  • Basic setup includes a skeleton site with test content.
  • Not ideal for non-React users.
  • Inconsistencies between production and local development.

Next.js

Pros:

  • Straightforward installation.
  • Abundance of setup options.
  • Suitable for React users.
  • Good plugin selection.
  • Outputs extra stuff for performance, setup, offline acces, etc.
  • Owned by Vercel, ensuring compatibility with excellent hosting.

Cons:

Gatsby

Pros:

  • Simple guided setup.
  • Various setup options.
  • Suitable for React users.
  • Reasonable plugin selection.
  • Outputs extra stuff for performance, setup, offline acces, etc.

Cons:

Conclusion

The majority of the top Static Site Generators are React-based. If React is not your preference, alternatives like Eleventy provide language flexibility. It is also possible to React templates with Eleventy, should you wish. For heavier lifting and more automated tools, Gatsby or Next.js might be preferable. Next.js excels with APIs and complex rendering/server/client setups.

Choosing an SSG depends on your specific needs. For speedy builds, Eleventy stands out, followed closely by Astro. If you prioritize flexibility, templating language choice, and autonomy, Eleventy is the recommended choice. The author's personal favorite, based on extensive experience, is Eleventy, followed closely by Astro. While Next.js and Gatsby also perform well, the author finds Eleventy to be the most effective in recent use cases, reinforcing the principle of eating your own dog food.