Hi, I’m Leon Stafford, author of the WP Static Site Generator tool.
I’m going to share with you why I think static sites are important to the freedom of information and in keeping with the ideal of the internet as a decentralised means of sharing information. I’ll also touch on why free hosting is important to me and how it can empower you to share what’s important to you with the world.
WordPress still remains one of the most powerful free publishing tools available. Though there are more specialised tools available to developers in order to publish content as a static website, WordPress has been around in some form since 2003 and has grown exponentially with the support of the open source community. It’s simple even for beginners to dive in and start writing content and is extensible by the massive amount of themes and plugins easily installable.
There are other tools and platforms available to get content online, but with a self-hosted WordPress installation, you remain in control of your content. No need for signing your content’s rights away to a company’s terms and conditions. No fear of it being taken down or censored.
Static sites (those without reliance of a server-side language to generate the pages when a user visits your site) were the first websites ever created and again are seeing a resurgence of interest from the developer community, with static site generators like gatsby.js and Hugo leading the new wave of powerful, performant options.
Every webpage you see requires some kind of web server, so that when you request an address, like https://mydomain.com/ or https://mydomain.com/contact-me, that you get the right content presented to you.
With a dynamic site, the journey from your request to the respondent content served to you, may need to traverse several hoops to appear on your screen, including multiple scripts in languages, such as PHP or Ruby, which do heavy lifting to pull different pieces of content from databases and perform processing on it.
With a static site, this has all been done before hand, so that each request you make is getting a complete, single HTML file handed straight to you, with no middlemen required. An abundance of free and specialised hosting options
A by-product of having generated a static website, is that it becomes very portable. You can take your statically generated site and put it on any of the free and fast static website hosting options that we are lucky to have available today.
When it comes to freedom of information, when you need to pay an authority to host the information for you, that’s immediately excluding a large portion of the world who cannot afford to publish their voice.
Though you may still be under their terms and conditions for censorship of what they deem offensive content, GitHub Pages and Netlify deserve applause for allowing anyone to host their static website for free on their reliable, globally performant servers. There are also many more options out there, providing free hosting for static sites.
By all means, you can host a static website from your own home off your ISPs internet connection. I’ve been a computer geek for over 20 years now and I’m still not confident to deal with the security issues of hosting on my own servers – if you are, that’s awesome, go for it! Users of my plugin have self-hosted on RasperryPi’s, showing how low-resource friendly static sites really are.
Where self-hosting can be ideal and a necessity is in a conflict zone, where authoritarian actors have blocked the internet and peer to peer or mesh networks have been setup to keep information accessible to people. I wish I didn’t know that this kind of thing was needed in the world, but it is a harsh reality.
How to go from WordPress to static?
The general approach to the WordPress-powered static website is to host your WordPress site in one location, generate your static copy of the site and publish it to where your users will view it.
The WordPress site doesn’t cease to exist, it remains the website that you develop and add content to. As your users will never directly visit this site, you can really tighten up security by hosting it on your own computer, with no public access, locking it down with basic authentication/IP filtering or hide it from the world by putting it somewhere obscure, like a long, uniquely named subdirectory or subdomain on your real site’s domain.
Crawling/scraping your site
There are many tools that have been around since the early days of the internet, specialising in making a copy of a website. The manual process to convert your WordPress site to static is generally to “scrape” the site, downloading a copy of the homepage and any linked pages, then using another tool to replace all the old/development-server links to the static site’s intended address. Already sounds like a lot of work, right?
Here’s where I pitch my plugin to you – it just does all this with a press of a button. Well, you’ve got to install the plugin, specify your static site’s URL and then press a button, still pretty easy.
There’s also one other WordPress static site generator plugin, Simply Static, a bit out of date, but still works reliably for many sites.
We now also have some interesting hybrid WordPress/static site hosts around:
The above are paid/hosted services, requiring you to host your WordPress site on their servers, which may be a good solution for some, sacrificing control for convenience.
Optimizing for static
You may need to adjust your optimize your existing WordPress site to ensure all functionality is retained in your static site. Namely, contact forms – nearly every WordPress site has them, but they usually require server-side processes to send the email. See my little guide on contact forms for static websites. See also this one on static site search engines if you need to solve that problem.
Deploying to a static site host
Whether you choose to write your own scripts to convert your WordPress site to static or use a plugin, you’ll need to choose where to host it. Netlify and GitHub Pages are good places to start, both offering free static site hosting with the ability to point your own custom domain name to the site at no extra charge. Where GitHub has higher usage limits (Netlify was limiting freely hosted static sites to 200MB!), Netlify has built-in support for forms handling and a bunch of other neat features for static sites. Both also offer free SSL certificates for your custom domain, which is kind of expected for any hosting these days.
Where deploying your site to GitHub manually requires using a git client and some understanding of git, Netlify also offers git based deployments or a simple drag and drop of a zip file onto a page in their website, which is simplistically brilliant.
Another pitch for WP Static Site Generator here, you don’t need to do either of those things, you can just set some credentials within your WordPress admin, click a button and the plugin communicates with the APIs of Netlify, GitHub Pages (or several other providers) to deploy your site.
I hope this serves as a not too biased guide to freely, securely and speedily hosting your WordPress-powered static site.
I hope to see a resurgence of independent websites sharing quality information from people all over the world.
If you’d like to make any corrections to this article or offer to translate it into your native language, please contact me at email@example.com