Turning Self-Hosted WordPress into a Static Site Generator
I’ve finally decided what I want to do with this website. I want to convert it to a completely static site. The way to do that is by making radical changes.
Why? Well, I’m not completely sure. Perhaps it’s because I’m getting older and I no longer have the stamina to do the things I’ve done the way I’ve done them. Maybe it’s because I want to lower my web hosting cost to five dollars or less per month since I’m earning less than ever. Whatever the reason, I have a choice to make and I’m making it.
Preparing to go Completely Static
Turning a self-hosted WordPress installation into a static site generator is easier than you can possibly know. I can probably do it in a day when the website is ready. It isn’t.
I have to alter the “You may also like” section on every article page, using a plugin that differs from what I used to generate them. I’ve done some of them already but it will probably take a month to do them all.
I have to replace the comment section with something else. I’m leaning toward using Disqus again. I switched back to native comments more than a year ago. Back then, I said I’d probably turn off comments completely if things didn’t work out. Well, I changed my mind.
I still get a comment now and then, but nothing like it was when I started doing this. I can cater to that low amount with Disqus and not feel bad about it.
The e-mail subscription widget has to be replaced with something that isn’t connected to WordPress.com. I don’t really want to use FeedBurner, but it’s the only free alternative I’ve found. The “RevResponse” service never replied to the message I sent about fixing my website on their system.
It’ll probably take me a month (or longer) to get everything straightened out here and ready to go completely static. I’m not going to lose sleep over it.
Using what I’ve already Coded
I’m already using a custom caching script. A visitor gets served a static page unless he or she posts a comment. It will be extremely easy to make the script do what I need it to do, with only a few changes. In the future, all visitors will get served static pages.
I recently (within the last month) discovered a way to change the web page output without using more than a single function. I’ll probably convert it into a dedicated plugin and remove the plugins it can replace. In fact, the ads you see (if you can see them) are controlled by that function.
I’m getting rid of every other website I control and turning my focus on this one. That way, when I make a change, I only need to do it once. It won’t happen overnight, of course. I have articles to move.
The Static Site Generator on my PC
I’m running Linux Mint on my laptop. Sure, it’s a desktop version of Linux, but I use it like a non-desktop version as well. I have Nginx, PHP 7, MariaDB (instead of MySQL) and a self-hosted WordPress installation in place.
I leave the servers in a “stopped” state until I need to work with them. A single alias starts them all up in sequence when I’m ready to get down to business.
I’ll be using rsync to update the files on the website. A few years ago, I avoided doing things like this because I thought I’d have to use FTP for everything. My, how times have changed – using rsync is trivial compared to automating FTP commands.
I’m planning to share a step-by-step guide (somewhere) that anyone will be able to use. I won’t create the guide until after I’m done with this website, of course.