Bill Farrar

Portfolio Site and Blog
Wordpress To Gatsby

Wordpress To Gatsby

January 12, 2020

Since the original creation of this iteration of my blog, I’ve spent time working at an agency that made WordPress websites for people, and another company that dismantled some of those sites for more specific CMS systems or other options. That same company put up some WordPress sites for marketing and internet presence, but they’ve never really met the goals or benefits that WordPress offers.

For myself, while I used to blog quite regularly, I find I do it less and less. I’ve got no desire to go to Dev.to or Medium — I’ve been doing this long enough I want to host my own sites, and that’s pretty easy and inexpensive if you have basic knowledge. WordPress is easy enough to set up and get running. The problem with it is largely its success: at one point over two thirds of all websites were running WordPress. And WordPress comes with a CMS that co-located with the blog, and thus can be attacked.

It’s just too compelling a target.

In a lot of the Agency work we were doing, the idea was that the customer could update it for themselves, thus we were delivering something of value. On my work on the CashExplostionShow website, I created (inside of WordPress) a template with easy updating for the weekly changes that were added to the site, yet it was still a job for development to update it each week, as it was either too technical or too risky for the customer to do it.

In most cases, there weren’t even weekly or monthly updates: the client’s wordpress “blog” was just a set of static pages that were their internet presence, and that was it. Yet it came with a huge CMS that was vulnerable to attack and wasn’t something the client might even know about.

Now the WordPress team updates it regularly, rolls out bug and security fixes, but you have to be maintaining the blogs and keeping things going. There are tools to automate some of that, but it still falls back on development. In an agency model, the agency doesn’t really want to keep doing maintenance on these sites. In the agency I worked for, many of the customers couldn’t have afforded it anyway. Just getting a professionaly done website was about the extent of their budget.

This is the impetus, of course, for the rise of static site generators, like the one I’m using: Gatsby.js

Gatsby ties into the React ecosystem, and the pages themselves are composed in React. These blog pages were ported from WordPress, or — like this one — written with markdown in a text editor. It would be possible to create a small tool that allowed customers to create these in a protected environment, and publish to a their site — I’m not doing that, as it’s my site and I am development.

Their site gains the benefit of working as though it were a static site (it is not — Gatsby does a neat trick where it ‘rehydrates’ to a React app, giving you a lot of programming facility.) It’s also a Progressive Web App and once visited, doesn’t require the internet to work anymore.

Moving from WordPress was the matter of a day or two. I’m using a wordpress-to-markdown nodejs utility, slightly tweaked for some of my other sties. That produced the markdown. Gatsby’s default blog setup generates most of the other site. That’s what this site is using as I write this, but I’ll be updating it.

Getting it running on nginx is straightforward as there’s no code running on the server for it at all. Let’s Encrypt gets us HTTPS, and we’re good to go. Plus, when I’m done doing updates, I can check the whole thing into git and I’ve got a backup. If my server fails, I can make a new one in minutes, with no real loss.

I’m not denigrating WordPress here — as a blogging platform,it’s pretty good. I wrote my first blogging platform back in the mid-90s, and while it was fine, it was a bit too technical for most people to modify or use, even if I had a dozen or so users who blogged most every day. (Blogging was bigger then.) WordPress always did it better, and for things which update often and which are regularly looked at and maintained, it’s excellent. But for little one-off websites or small developer blogs that sit idle for months or years? Gatsby or something similar is the way to go.

Bill Farrar
Bill Farrar
Full stack developer with over 20 years in web technologies and over 30 years as a software engineer and designer. Senior systems analyst and team lead, spending time running projects and mentoring peers.