How to Choose the Right Static Site Generator

How to Choose the Right Static Site Generator

Static site generators (SSGs) are great for creating websites. Static websites have advantages over dynamic websites such as better speed and security. There are many SSGs to choose from, which makes it difficult to pick one. There are popular ones such as JekyllHugo, and Gatsby, but there are other options that are growing in popularity as well. Picking the right SSG requires a lot of research. It took me a while, but here are some tips I have for selecting a static site generator.

What are Static Site Generators (SSGs)?

SSGs are tools used to create websites using HTML, CSS, and JavaScript files and rendering text files. What makes these sites static is that the pages stored in the server are generated in advance so that they are ready to be served if the user visits that page. This differs from dynamic websites where pages are stored in a database and when a user requests a page, a database query is run to retrieve it before loading the page.

As for the structure, the HTML, CSS and JavaScript create the layout and design of the website while the website content is stored in text files, which use markup languages and templating engines. Template engines define the structure of your content and the markup languages format the webpage content. As you can see here, the layout and the content are separate from each other.

This is a basic overview of SSGs. You can read this DigitalOcean article for a more in-depth explanation of them.

Should You Use a Static Site Generator (SSG)?

Before choosing which SSG to build your website with, you would want to figure out if you should use one in the first place. There are several advantages to using an SSG versus creating a website with another solution.

  • Speed: They load much faster since the pages are prerendered. Once the pages have been built, they can be served right away. Meanwhile, dynamic websites need to load the content from a database, which can be a slow process if it is not optimized.
  • Simplicity: SSGs typically have fewer moving parts. This makes the development process easier and fewer things are at risk of breaking.
  • Security: Since SSGs do not use databases, there is no backend to hack.
  • Cost: All you need to run a static website are files, a domain, and a place to host them.

To provide an example of how SSGs provide these advantages, I used to run a website for a student association that used WordPress. Before I took over, however, it was poorly managed. It took an average of 7 seconds to load a page, it had several unused plugins, and it wasn’t properly audited for security issues. This website costed the association about 200 dollars a year to run, and with that, I figured we should use another solution.

I outlined what the student association needed for a website and determined that we really just needed a few pages to provide information. If we needed features such as e-commerce, we had external resources for them. For a website with simple requirements, SSGs satisfied them and so we rebuilt the website with Jekyll. As a result, the association had a faster website that was simple, secure, and cheap. The website was hosted with GitHub pages, which is free to host websites on. The only expense to take care of was the domain name.

Despite the advantages of SSGs, that does not mean they are the best solution for every case. For example, if you need a website with a backend and dynamic features, building your website with a CMS could be a better solution. If you are not knowledgeable about web development and design, you may want to use a service that has a drag-and-drop website builder instead. Figure out what kind of features your website needs and determine if an SSG or another solution is better for you.

If you decide that an SSG is not right for you but you are interested in building a blog of some sort, I recommend checking out my article about the different platforms that you can build a blog with.

Tips for Picking the Right Static Site Generator (SSG)

If you have decided to use an SSG, then the next step is to choose an SSG that suits your needs. Here are some suggestions.

Outline Your Needs and Preferences

First, start by outlining what you need for your website and your background. As SSGs differ in several ways, it would be good to determine which SSGs have the features you are looking for. For example, if you are looking to build a site for documentation, you could consider using an SSG like Docusaurus. Specialized SSGs will have features that cater to your specific needs.

On top of that, consider your experience with building websites and specifically, your experience with SSGs. Some SSGs are ideal for beginners while others involve a steeper learning curve. As well, it would also be beneficial to pick an SSG that uses languages and tools that you are familiar with.

Here are some questions to answer when selecting an SSG:

  • What kind of website do you need? For example, is it an informative website for an organization, or is it for documentation?
  • When the website has been built, who will maintain it? What kind of skills will the website owners have if it needs to be updated?
  • What features do you need? Do you need static pages for displaying information or will you also need to integrate it with other tools?

Research What Themes are Available

If you are not interested in creating a theme from scratch, you may want to consider using an SSG that has premade themes available. Using a premade theme speeds up the development process, which will allow you to start creating content as soon as possible. Depending on the intention of the site, certain SSGs will have more themes with a certain style over others. Furthermore, you will most likely want to consider editing the theme to fit your needs. Some themes will make that easier for you (ie. they will have a config file) while others may have more complex structures that you will need to dive into.

If you would like to build a theme from scratch, take a look at some tutorials and examples to see how themes are built. You may also draw some inspiration from premade themes.

A page containing a collection of Jekyll themes to install.

Discover the Ecosystems of the Static Site Generator (SSG)

While creating your website, you may find that you would like to add plugins or extensions to add extra features. Older and popular SSGs are likely to have a larger selection of plugins and extensions to choose from while newer and unpopular SSGs will not have as large of a collection. It may or may not be an issue if you plan to have a simple site that only needs a few features, but you should determine what features you need in advance before you start building your website. It would be unfortunate if you realized you needed a certain feature, but then find out that no one has built a plugin or extension that provides that feature.

See What Documentation and Support are Available

When encountering a problem, it would be nice to have resources to refer to to resolve them. That’s why it is important to pick an SSG that has a lot of support and an active community around it. You can first check to see if their documentation is well-written. Then, check out any external resources. These can be forums, videos, and blog posts that cover the topics and discuss problems that users encounter. With a lot of support available, you can be sure that you can find a solution for the problems you may encounter in the process.

Try Them Out Before Committing

As you conduct research on which SSG to use, you may find that there are many possible SSGs that suit your needs. To find out which SSG is best, try them out yourself. Create a site using that SSG, and explore the codebases and their features. Create some pages and edit the theme to see how it feels to work with that SSG. Some processes you may want to explore include installing and editing a theme, installing plugins, and the difficulty of loading your website locally.

After trying out the SSGs you are considering using, you will hopefully be able to decide on one.

Conclusion

Once more, SSGs are a great solution for building a website. With its advantages, it is understandable that people choose to build their websites with one. Some people have even turned their dynamic websites into static ones. With a wide selection of SSGs available though, you will have to do some research and see which one is best for you.

If you have created your website with an SSG, feel free to share which one you have picked and explain why!