When the web was young, developers coded web pages and writers wrote content in HTML, or, in the case of non-technical writers, they gave their content to someone else, who translated it into HTML. Then, as today, HTML was the language of the web. But few people write content in HTML today.
Content management systems like WordPress became popular because they made it easier for everyone to manage and publish content. With a CMS, writers and editors don’t have to understand HTML or even know what it is. They write in a friendly online interface, their content is stored in a database, and when people visit the site, they’re served the HTML browsers understand.
Content management systems and WordPress in particular are the most common way to publish on the web. But an alternative has gained popularity in the last few years: the static site generator (SSG). SSGs create fast, secure sites that consume fewer server resources than content management systems. They don’t need updating like a CMS. They’re immune to many of the security vulnerabilities that cause problems for web applications. They don’t need a database. They don’t even need a programming language interpreter like PHP on the server.
Static site generators have quite a following, but they’re not for everyone. To explain why, let’s look in more detail at how WordPress and SSGs work.
What Is WordPress?
WordPress is a dynamic site generator wrapped with features for writing, managing and publishing content. When WordPress receives a request for a web page, it generates the page’s HTML on the fly. WordPress is made up files written in PHP, a programming language, and when WordPress’ PHP files are executed, they gather data from a database, combine it with templates, and generate the HTML page to send to a browser.
What Is a Static Site Generator?
Instead of generating pages on the fly, a static site generator builds the site once, combining content and templates before spitting out a fully formed website that can be uploaded to a server. Once the site is generated, the SSG has done its work. The web server takes over, serving HTML, CSS, and JavaScript as they’re requested by the user. Every time new content is added or existing content is changed, the SSG is run again to create the modified site.
The SSG doesn’t have to live on the server; it can be run on the site owner’s laptop, on a virtual server, as part of a continuous integration pipeline, or on any other compatible computer.
The process for adding content to a static site involves putting the content’s source, often a Markdown file, into a specific folder on the filesystem and rerunning the SSG. Static site generators are not content management systems, so all the work of managing content has to be done with tools external to the SSG.
There are hundreds of static site generators to choose from, largely because they are quite simple to make and are a fun exercise for developers. Among the most popular are Jekyll, Hugo, and Gatsby, the latter an SSG that creates static progressive web applications.
The Pros of Using WordPress
There are many advantages to building websites dynamically. WordPress can serve different content to users so that each user has a unique experience. Content is easy to add to the CMS and update after publication. WordPress’ admin interface depends on the ability to dynamically generate content based on the actions of the user. Without that ability, there would be no logins or user accounts, no user roles, no site membership, and no way to process content through a well-defined publishing workflow — at least not without a lot of additional tools and infrastructure.
All the features that made WordPress the most popular content management system on the web and the foundation of tens of millions of websites depend on its ability to dynamically generate pages.
The Cons of Using WordPress
WordPress is a complex piece of software, and it depends on other, even more, complex pieces of software. That isn’t inherently problematic: a well-maintained and updated WordPress site is as secure as any comparable system, but it may be less secure than a statically generated site, especially if it isn’t maintained.
WordPress also consumes more server resources than a static site. It’s more expensive to host a WordPress site than a static site that receives the same amount of traffic. Generating pages dynamically takes time and adds latency. However, a WordPress site equipped with a caching plugin such as W3 Total Cache or WP Rocket is competitive with a static site for performance, so the performance advantage of SSGs isn’t as clear-cut as it might appear.
The Pros of Using A Static Site Generator
Static sites are fast. Web servers like Apache are optimized for serving static content, and they can do so with far fewer server resources than a dynamic CMS that runs code and makes database queries.
Static sites are secure. Because a static site runs no code on the server other than the web server itself and has no database, it is immune to many of the attacks that dynamic sites are vulnerable to. There’s no thread on which hackers can pull to unravel the site’s security.
A static site requires little maintenance: there’s no need to “update” a static site unless you want to change it.
The Cons of Using a Static Site Generator
Static site generators are simple, but that doesn’t mean they are simple to use. Much of WordPress’ complexity is the result of features that make it easy to use for people who aren’t web developers. With an SSG, you’re expected to know how to build a website and to have at least some programming ability. Take a look at Gatsby’s introductory tutorial or Hugo’s documentation for insight into what you’re expected to know to use an SSG. They’re perfect for developers, but there is a steep learning curve for anyone who is used to WordPress.
As I have already mentioned, SSGs don’t include content management features, so you’re on your own as far as building publishing workflows is concerned. That can be a particular problem for publishers with a large number of contributors, some of whom may not have the technical knowledge to use an SSG.
In Conclusion
Content management systems like WordPress and static site generators achieve the same ends — creating a website — but their priorities are radically different. Whereas WordPress focuses on simplicity for the user and a rich set of content management capabilities, SSGs are built by developers for developers. Most businesses, bloggers, and publication should choose WordPress, but static site generators are a great option for developers and bloggers with the technical know how.
About Robert Bailey – With almost a decade of experience in the tech industry, Robert has worked as a marketing consultant, product strategist, and content developer. At Nexcess, he spends his time helping clients find the best hosting solutions for their needs through online content and as a brand ambassador.
As a Brit raised to ignore umbrellas, when he’s not in the office you’ll find him either climbing a mountain, kayaking a river, or trying to find his next outdoor adventure. For more content, visit the Nexcess blog and give them a follow at @nexcess.