Static Site Generator vs. CMS: Which is Right for You?
Posted by Arek Nawo on September 18, 2019
In recent times, web development has evolved rapidly—from bare-bones, text-heavy websites to full-blown immersive web applications. And yet despite this whole progress, “regular” content-driven websites are still in very high demand. In fact, you might even have to create one on your own at some point!
Because content-heavy websites don’t usually deal with the "immersive part,” they're much easier to create. Nowadays, the process comes down to a choice between two of the most popular solutions—Static Site Generators (SSGs) vs. Content Management Systems (CMSs). What do these solutions entail, and which is the best choice for you? That's what we'll be exploring today.
What’s a static website?
To understand what an SSG is and how it works, we first need to know what the "generated" part means. A static website refers to a website that is served to the client in the form of static HTML files—already-stored files that are just waiting to be served to the user. When the user navigates to a certain page, the corresponding HTML file is then matched and sent back, ready to be displayed by the browser.
In comparison, a dynamic website is generated dynamically, as the name suggests—or "on the fly," as some people say. The result is still the same HTML code, but the work required by the server is much more demanding. It includes gathering and processing the data, generating HTML, and more—every time a client visits the website. Static websites, on the other hand, are just ready to be sent files, which doesn't require a lot of computing power.
But unless you want to write the required HTML all by yourself, creating a static website requires what’s called a Static Site Generator—SSG for short. It’s a piece of software that, when provided a template and a data source, can generate the static website’s HTML code all by itself. Popular examples of such tools include Gatsby and Jekyll.
The rise of JAMStack
What’s a CMS?
The second way of creating a content-heavy website is with a Content Management System—CMS for short. As the name implies, CMS is a piece of software that helps you manage the content of your website. It’s a tightly-integrated system that couples the front-end (website) and the back-end (database and control panel) in a nice, simple package.
In contrast to an SSG, which generates your HTML before serving it, CMS uses dynamic websites. Thus, it generates the site’s code right before sending it to the client. Such a practice doesn’t require any kind of “build-step,” but it may hit your web server hard depending on the number of visitors.
The most popular examples of CMSs include WordPress and Joomla. To give you a glimpse of how widespread such software is, WordPress is said to be powering about 30% of all online websites! These include some big names, like TechCrunch, Microsoft News, Facebook Newsroom, Mozilla Blog, and more.
Before we dive into the differences of a static site generator vs CMS, let’s talk about their similarities first. There are two big ones—Search Engine Optimization (SEO) and the ecosystem of the technology.
Ecosystem refers to the organization and sustainability of software, such as the size of its community and the amount of tooling available. While SEO advantages for CMSs and SSGs are crystal-clear, the ecosystem-related ones are somewhat vague. When considering the CMS category, its ecosystem is huge! Especially when looking at examples such as WordPress, the CMS has been around for so long and powers so many websites that you shouldn’t have any problem finding support or the theme/plugin you want.
Why use an SSG?
Now that we understand the similarities, we should get to know how the two solutions differ from each other. So, what’s so special about SSGs and static websites in general? Let’s take a look.
Sadly, speed is also a concern during the build-time. Depending on the amount of the content needed to be processed, your SSG might become slow as the size of your website grows. Thus, you need to find the fastest and most suitable SSG for your use-case. It should be capable of determining which parts of your website need to be rebuilt at the given run and then use that knowledge accordingly.
When you look at static websites from a developer’s perspective, you’ll see that creating one isn’t that hard. All you need is some content and an SSG with a prepared template—either by you or someone else. Preparing such a setup might take some time (especially when creating a dedicated template), but it should be a relatively painless process, especially when you’ve chosen an SSG that uses your favorite set of technologies.
After you’ve done the setup, all the following steps are pretty straightforward. You have to build your website and somehow serve the generated files. From here on, you’ve got a lot of creative freedom. You can easily automate the whole process with continuous integration, do everything locally on your machine and just serve the files, or even use Git to set up automatic version control for your content.
Static websites are also extremely cost-efficient. Besides the build-step, you don’t need much computing power to serve static files. Thus, your serving costs can be relatively low. Also, when using services like Netlify or GitHub Pages, you can get away with paying nothing for serving your files! You can also plug in some free/cheap CDN and make your website feel even faster for visitors around the globe. That’s the beauty of static websites!
Why use a CMS?
After reading the many advantages of SSGs, you may think CMSs don’t have much to offer. But CMSs have their own set of unique and significant advantages—some of which you might not even know about.
Websites generated by a CMS are dynamic, which means they can’t be generated and served as fast as static files can. However, this also means they don’t require any build-step and can integrate interactive features very easily! The last advantage is especially important when building a website that requires the use of forms, user accounts, etc. Static websites require the use of external APIs for such functionalities—either via your server or from a third-party service. In this regard, CMS can be viewed as a true all-in-one package.
Because CMS is very tightly-integrated, it’s usually easy to work with it, whether you’re a developer or anyone else. The installation process is simple—in fact, most CMS and hosting services provide CMS that is installed out-of-the-box or available through an install menu. Easy installation goes right along with easy usage. CMSs usually provide a well-organized, complex control panel where you can adjust settings, edit your website’s content, and install themes or plugins. Such a UI makes it possible for non-technical users to customize their websites the way they want instead of relying solely on developers. It also speeds up the process of editing and creating content for the website.
Simple case study
Now that we’ve covered several pros and cons of both solutions, I’d like to provide you with a case study where we analyze what kind of solution—SSG or CMS—is best suited for the given type of website.
A portfolio website is a great candidate for using an SSG. It doesn’t change that often and doesn’t require any interactive elements, except maybe a contact form. Thus, if you’re making a portfolio page or something similar (e.g., a product landing page), use an SSG and take advantage of all the goodness that static websites have to offer.
A blog is a very diverse kind of website. Its build process depends heavily on the author's needs. If you write relatively rarely, like once a week, you can consider using an SSG. This is especially true if you're a JAMstack user and like writing in Markdown.
A website such as a news site, where you publish content as often as multiple times a day, requires some special treatment. Using an SSG to generate your site that often might be a little slow, so in this case, a CMS is probably a better choice. Besides, when you have that many pages, there's no way your visitors will visit all of them, so all the generated static files just take up more and more space.
An eCommerce website is very well-suited for use with a CMS. You need to dynamically add and remove products, provide the interactive functionality of buying them, and more. Static websites don't provide all these benefits out-of-the-box like a CMS does. All these requirements make SSG a rather bad choice for eCommerce.
Combining the best of both worlds with Headless CMS
Up until now, we have only examined CMS and SSG as two completely separate entities. But what if I told you there's a way to combine CMS and SSG to have the benefits of both? Well, it’s possible—and the key idea behind it is called Headless CMS.
What’s a Headless CMS?
Headless CMS is a specific kind of CMS that consists of only the "back-end” part of a "usual" CMS. You've got the control panel, integrated settings, and content management but no front-end at all. Instead, Headless CMS gives you access to a set of APIs that allow you to retrieve its content and do whatever you want with it. This includes using it as a data source for an SSG!
A great example of this idea is Butter CMS. It gives you access to a user-friendly control panel where you can edit and customize your content. Later, you can use the API (provided in many different programming languages) to retrieve the content and create the website you want. You can also detect when a change in your content occurs, so you can automatically rebuild your static website only when necessary.
Why Headless CMS?
Headless CMS allows you to make the most out of both worlds. This makes it a very compelling solution. Thus, if you're willing to spend some more time setting things up, there's a lot of advantages that you can benefit from!
As I mentioned earlier, Headless CMS consists only of the "back-end" part of a traditional CMS. This makes it a perfect data source of your dream front-end. It gives you a lot of flexibility and scalability, allowing you to change your website the way you want.
Given the versatility of Headless CMS, you can choose for your front-end to be a static website. If you go down this path, you can expect the resulting website to provide you with most of the advantages of a regular static website. This includes speed, easy hosting (even with CDNs), great development experience, security, easy maintenance and more.
Headless CMS is still a CMS, and thus all of its back-end capabilities are still there too. This includes the control panel, which gives both technical and non-technical users an easy way to edit the content of the website—even a static one.
Even though Headless CMS doesn’t have to be for dynamic websites only, it still can provide some interactive features, like forms. These features may be in the form of API endpoints, which you can utilize within your static website. This is all in line with the "A" (APIs) in the JAMStack ideology.
As you can see, there’s no clear winner when it comes to these web development solutions. Whether you go with SSG, CMS, or the “hybrid” Headless CMS depends solely on your personal needs. I hope, however, that this guide has helped you make up your mind. Now you can move forward with a better idea of which solution is best for you!
You might also enjoy reading our guide on creating a static website with Hugo and ButterCMS.
Don’t miss a single post
Get our latest articles, stay updated!