View profile

Why You Shouldn't Use a Static Site Generator for Your Next Blog

Why You Shouldn't Use a Static Site Generator for Your Next Blog
By Mastering JS Weekly • Issue #48 • View online
This article about migrating from WordPress to Gatsby is a good read. TLDR; migrating from WordPress is hard, because WordPress exports come with a lot of legacy quirks.
I manually migrated thecodebarbarian.com off of WordPress in 2014. I didn’t have very many articles, so migrating wasn’t too bad. But working with WordPress taught me the importance of owning my content. When I was on WordPress, my content was effectively owned by Automattic: they got paid for it, they decided what I could or could not publish, and they made it less than easy to leave them once and for all.

SSGs and Content Ownership
“Own your content” is, ironically enough, the title of a WordPress campaign. But what does it mean to really own your content? Clearly, being dependent on WordPress, Medium, or even Twitter to serve your content doesn’t qualify. If you do, some corp collects all the revenue from your content, and can decide to shut you down at the drop of a hat.
Static site generators like Gatsby promise an alternative: they generate plain HTML sites that you can then host on Netlify, Gatsby Cloud, an EC2 box, or any other hosting platform.
The downside, though, is that you’re dependent on Gatsby’s tool to compile your site into HTML. And that comes with significant problems. Gatsby’s performance issues are well known. Imagine having to wait 30 minutes for your blog to compile!
It's not 2007 anymore. There's no excuse for 30 minute build steps.
It's not 2007 anymore. There's no excuse for 30 minute build steps.
But performance issues aside, there’s still a problem with complex static site generators: you’re dependent on the SSG to compile your site. If the SSG company decides to do a big backwards breaking change to better support the needs of a lucrative client, you’re stuck having to either rework your entire blog or never get any more updates.
If your goal is to truly own your content, the way to go is to write your own basic build step, and then ship the compiled HTML to a tool like Netlify. While you are still depending on an outside service to serve your content, at least you have full control over how your content is built. And, if your hosting provider decides to do something you don’t like, it is much easier to switch static site hosting providers than it is to switch out the build system for your entire site.
For example, check out masteringjs.io’s GitHub Repo. No established static site generator, just ES6 template literal layouts and a `for` loop that compiles markdown. Granted it is far from “perfect”, but perfect is the enemy of good. And this setup has been good enough to achieve our goal of not spending any more than 1 hour per quarter on the build system.
Most Recent Tutorials
Equality in JavaScript - Mastering JS
NaN in JavaScript - Mastering JS
Compare Objects with Lodash - Mastering JS
Vuex Getters - Mastering JS
What is a Vuex Store? - Mastering JS
Other Interesting Reads
Lessons from migrating a 14 year old blog with 1500 posts to Gatsby | Swizec Teller
Static Site Generators are Overkill | www.thecodebarbarian.com
JavaScript template literals
Did you enjoy this issue?
Mastering JS Weekly

A weekly summary of our tutorials

If you don't want these updates anymore, please unsubscribe here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Powered by Revue