Getting Started with WordPress Static Site GeneratorsJuly 02, 2020
In a rush? Skip to our list of Wordpress static site generators.
You’ve heard the saying: “opposites attract.”
It certainly is true of the two concepts explored in this post.
On one side, WordPress. On the other, static sites.
The first represents the old guard of monolithic CMS; the second, the new frontend wave.
Despite their apparent differences, we hear more and more about WordPress static websites, WordPress static site generators, and so on.
It might sound counterintuitive, but when you think about it, why wouldn’t you want the best of both worlds?
That’s exactly the question I’ll explore today. More precisely, I’ll have a look at:
- Why you should use WordPress to generate static sites
- The benefits & limits of this approach
- The many existing WP static site generators
The rising interest for Jamstack in the WordPress community is quite exciting to observe.
Let’s jump into it right away!
Why use WordPress to generate static sites?
Pairing WP and static sites doesn’t strip away power from the site editors. WordPress users can still use the popular CMS to create and edit content.
So where does the process differ? After an editor hits “Publish”, the site content is exported to HTML, pre-compiled static files ready to be served, instead of the usual PHP-generated views.
There are many available tools & plugins to accomplish this. I’ll list them later on.
However, if terms like Jamstack, static websites, or headless CMS are unfamiliar to you, there are a few things we need to clarify before going further.
This section will lay out the differences with a standard WordPress setup and a Jamtack-inspired one. I’ll then highlight the benefits & limitations of the latter.
Why make your website static in the first place?
It’s a good place to start. I mean, WordPress already generates fully-dynamic, functional websites. Why would you want to go the static route?
By definition, “a static website contains web pages with fixed content. Each page is coded in HTML and displays the same information to every visitor. Unlike dynamic websites, they do not require any server-side operations or database design.”
It’s a concept that’s as old as the web itself. But modern static websites do way more than their name might inspire. The evolution of frontend development has allowed more powerful operations to happen directly in our browsers. Simultaneously, the advent of Content Delivery Networks (CDNs) made the distribution of static content very efficient.
The major difference is that the site’s HTML is already compiled and ready to be served to the client with no request to any server. This graph we’ve created for an earlier post explains this process in both setup:
The static approach brings many benefits compared to the standard WordPress instance. Mainly:
The time added from dynamically pulling information from a database on every page hit of a content-heavy site can result in delays, frustration, and bounces.
Static sites serve pre-compiled files to browsers, cutting load times by a large margin. Say hello to better performing websites and considerable SEO gains.
→ Enhanced security
WordPress is known for its high risk of attack from malicious hackers. The simple mention that your site is built with it is enough to attract these unwelcome visitors.
Bigger server-side infrastructures often open up potential breaches. With static setups, there's little to no server-side functionality.
→ Reliability & low maintenance
Optimization for WordPress websites often demands multiple plugins—for caching, firewalls, security, backups, etc. These tools come with high-maintenance that can become overwhelming, particularly for non-technical users.
Static sites are reliable and don’t have as many dependencies, making them easier to maintain.
Why use WordPress with the Jamstack?
At this point, you might think: “If static websites are so great, why use WordPress instead of regular static site generators?”
If you already have a WordPress-powered website that you want to turn static, simply exporting it to static HTML files using a plugin is way more efficient than migrating your entire site to a new platform.
If you’re creating a website from scratch, SSGs like Gatsby, Next, or Hugo are great. I mean, we love these tools. You should absolutely at least consider them. But they’re missing what makes WordPress great. They’re missing a user-friendly system to add and edit content, and the vast, time-proven ecosystem backing WP.
If you’re interested in looking into static site generators, there are also many headless CMS out there to make the content management experience smoother.
As I said in my intro: the best of both worlds. With such a setup, you benefit from modern frontend techs with better performance & security, while using WordPress for what it’s really great at: managing content.
Drawbacks to be aware of before going forward
Of course, like anything in web dev, this solution is no silver bullet.
Before jumping eyes closed into WordPress static site development, there are a few limitations that you should be aware of.
By default, exporting a WP instance to HTML cancels out all server-side functionalities. The list can be extensive:
- server-based comment forms
- server-based contact forms
- site search
- events signup plugins
- e-commerce plugins
- membership plugins
- RSS feed
- & any other functions that need dynamic server operations.
There are workarounds for many of these. It’s essential to have all the pieces available to make them work if you need any of these functionalities.
Some of the tools listed below can resolve these drawbacks out-of-the-box. For some others, you’ll need to integrate third-party services to your website—like, say, Snipcart to enable e-commerce on your static site ¯_(ツ)_/¯.
All of them will bring you the benefits of static websites mentioned earlier. Let’s take a look at what these solutions are.
How to convert WordPress to HTML (List of WP static site generators)
Strattic converts WordPress-based websites to a serverless architecture, instantly making sites faster and more secure, with absolutely no change in user behavior.
It might have become the “big player” in this field in 2020. The news that they had raised $6.5M in February came as a confirmation of the surging need for static site generators for WordPress.
The Israeli company didn’t waste that money and now has a more fully-featured product than the competition. It also got answers to some of the usual disadvantages of exporting a WP site to static HTML.
CDN (Content Delivery Network). A fast way to distribute your static assets to users. Simpler plugins don’t procure CDNs to serve content, forcing you to configure other solutions.
Site search out-of-the-box.
Support for standard 301 & 302 redirects.
Proper handling of 404 pages. Usually, simple SSG plugins will serve a default page generated by your server when there’s an error. Strattic allows you to have a good-looking, theme-based 404 page.
Strattic starts at $35/month if you only have one WordPress website to turn static. It goes up to $225/mo for multiple websites.
All their plans come with a 30-day free trial to test things out.
Get started with Strattic
- Official Strattic documentation
- Walkthrough of Strattic - Static Hosting for WordPress
- A Strattic Review - 4 Minutes to JAMstack using WordPress, by Chris Lema
WP2Static is a fully open-source plugin for WordPress static site generation. As its creator Leon Stafford told us:
“Strattic is going to be very big, with their funding and the killer team they've got. WP2Static will remain the completely open-source option, which has a market in people wanting more control over their workflows/not wanting to host their WP with someone else.”
In full transparency, we currently support Leon & WP2Static financially. It’s the kind of independent, Jamstack-related project we, at Snipcart, love to encourage. This remains a fair and honest review of the product.
WP2Static queries the WP database and your website’s filesystem to find out which URLs need to be included in your static site. It then crawls each detected URL, saving a copy of the content as a static HTML file. This is then transferred to your chosen hosting platform.
Add-ons for added functionalities. These currently include Algolia for search, Cloudflare Workers for static site hosting, and many options for deployment.
Removal of all tell-tale signs that your site runs with WordPress. Making it less attractive to malicious hackers.
Desktop notifications for completed exports.
The roadmap includes providing WP API & GraphQL access to control WP2Static, multiple deploy configurations, and new add-ons. One of these new add-ons could allow users to migrate their WooCommerce shop to Snipcart in one-click. (!!!)
The biggest advantage of WP2Static is that it’s fully open-source, and not expensive. You can download the core plugin here.
There’s a lifetime fee of $100.
Get started with WP2static
- GitHub repo
- Official WP2Static documentation
- How to create a Static version of your WordPress Website, by Open Source Channel UK
Shifter is a commercial alternative similar to Strattic. It enables the creation of a new WordPress site directly from their dashboard. It also built in a way non-technical users can get started. No coding required.
They offer a “WordPress as a service” setup, which means, unlike WP2Static, you’ll need to use their hosting platform. However, you then have access to tools for outputting a static version of your website to host with them or deploy externally.
Shifter comes with enough built-in features to accommodate different types of businesses, such as Enterprise, Nonprofit, Marketing, Education, etc.
Other than their WordPress static site generator, they also recently developed a solution to transform your WP CMS into a headless CMS. More info here.
Automated backups. WP backups are automatically generated as you generate static sites deploy changes.
Site usage and statistics.
Support for dynamic functions. Including site search, forms & e-commerce.
I might have understated Shifter's full feature set at first. Fortunately, their team was there to take me back on track. Read this Twitter thread for a deeper exploration of Shifter's features.
Shifter offers a free tier for testing things out on which you can’t get a custom domain. Once you go live, there’s a Tier 1, Tier 2, and Tier 3, which cost respectively $16/mo, $24/mo, and $144/mo depending on the storage and features you need.
Important to note that these plans are for one site uniquely. It’ll end up costing you more if you’re working on multiple WP projects.
Get started with Shifter
Again, HardyPress has the same kind of commercial offer as Strattic and Shifter.
With HardyPress, WordPress lives in a virtualized environment that can be shut down at the flick of a switch. It’s only alive when a user is logged in and needs to make changes to the website’s content. The server automatically shuts down after a period of inactivity.
It doesn’t affect the public-facing website as it’s never served by WordPress in the first place. Like the others, HardyPress makes a static copy of the site that’s then served by a CDN.
I honestly know less about this one, and at a glance, it seems like their offer resembles the two mentioned above a lot. I’ve read good things about it, though. It’s worth considering it as their feature set, and pricing could be more in-line with what you’re looking for.
Content served through a CDN.
Staging environment. Work on your website without risking disruption on the live content.
Its own site search function.
Support for contact forms plugin. Seamless integration with the Contact Form 7 plugin.
One year backup. Saved snapshots of your WordPress site up to a year can be useful to go back in time if needed.
They also have plans for “Enterprise” business that go up to $338/mo.
Get started with HardyPress
Other options for WordPress static site generator
In the four solutions I’ve presented above, WP2Static stands out by being a more independent, fully open-source project. I’d like to give shout outs to more of this kind of solution.
Simply Static was once a popular plugin for static site generation with WP. It provided a simple yet solid alternative for this task. Sadly, it has been unmaintained for a while now. Maybe this post can inspire someone to patch the plugin to work with the latest WordPress versions.
Sitesauce is a new project that creates a static version of not only WordPress sites, but any sites. So it also works for CMSs such as Ghost, Statamic, CraftCMS, Joomla!, Laravel, and so on. A cool idea, and a promising tool to keep an eye on!
If you haven’t found the solution you’re looking for in this article, fear not. There are other ways to use WordPress with the Jamstack.
In the past, we’ve explored the WP REST API, which enables WordPress to be used as a headless CMS. Doing so lets you build the frontend of your site with tools you love. Here are the posts we’ve written for React and Vue.js:
- How to Use WordPress with React to Build a Modern Web App
- Build a Vue.js SPA on Top of Headless WordPress
Otherwise, I hope this guide for WordPress static sites was helpful. Of course, it’s a concept that is still very young. There’s no doubt that the existing tools I’ve mentioned are going to get better as time passes—and that many similar ones will be born.
The fact that “traditional” ways of building websites are now intertwined with modern technologies is good for every dev out there. These paradigms don’t have to be opposites or always pitted against one another.
If you've enjoyed this post, please take a second to share it on Twitter. Got comments, questions? Hit the section below!