I love these posts on static site generators. They are a constantly reoccurring topic. Everyone wants something that's "easy" and "simple" but this is at odds with having flexibility to handle more than one person's favorite workflow. There's endless discussion because there are endless solutions.
Personally, I've used a number of static site generators and I ended up in the opposite direction. I needed a website where I could write posts and not have to worry about more than just writing and posting, no deployment, no plain text intermediate languages between me and the end result.
I ended up using Wordpress. I was already familiar with it, knew how to self-host it, and was comfortable modifying a theme to suit my purposes.
Writing and posting new articles is so much easier using rich text. I generally type up my post in Apple Notes first. Copying and posting to Wordpress saves most of the formatting. Inserting images is drag and drop.
Large numbers of good plugins meant it was easy to find something to implement features like having a click-through warning on 18+ posts. Install a plugin, configure it, and I'm done.
Wordpress works well for me, but a lot of programmers are rightfully horrified. Wordpress is popular and complex, which results in a long history of security issues requiring mitigation. It's inefficient and needs caching. It needs to be backed up because everything is in a database, not plain text. As a result, it requires more systems knowledge than a static website.
Static site generators and applications like Wordpress are tools.
Everyone ultimately looks for a tool that works for them. My goal is to write posts, not fiddle endlessly. Other people love the fiddling.
So, if you’re looking to build and maintain a website, think about what’s important to you. What’s your skill set, interests, preferred workflow, and goals?
Sometimes I wish I could just use WordPress as a static site generator off of a docker machine that turns on on login and off at log off. Nobody wants to deal with slow and insecure always-on WordPress sites.
I know that there are some websites that take care of this… for money. Unfortunately $20/month is not in the budget for one-off sites.
You can use WP2Static and either run a container locally with something like https://lokl.dev, or spin up a VM that's firewalled off and access it through an SSH tunnel. The auto-on/-off part really does little for security, it's the firewalling that does the trick. Turning it off is good to save costs though.
I'm actually working on basically exactly what you described (using WP2Static), and we're planning for a competitive $10-15/mo price, but we're not quite ready for launch yet.
It should be possible. You can use wget to crawl your Wordpress site and save it all to html files, which you can then copy/ftp to your static site. I've done this with Drupal. Drupal 6 was at EOL and not getting security fixes. The site was fairly large and had been built over a period of years, but was no longer being updated. We wanted to keep it online, but did not want to take on a project to migrate it to the next major release of Drupal and then get on that update treadmill.
I forget the exact set of wget options but you can find blog posts about how to do this.
I’ve done it too, but wget is pretty “dumb” and will try to save files as main.js?v=1.2.3. Also wget doesn’t support everything so you have to carry over some files manually.
> Sometimes I wish I could just use WordPress as a static site generator off of a docker machine that turns on on login and off at log off.
But you can do exactly that right now. For example:
- use wordpress as your data backend in next.js
- not exactly a static site generator, but you can use w3tc plugin to perform full page caching with very long expiry time, which essentially turns your wordpress site into a static site. You can also do this using cloudflare "cache everything" page rule, but it must be paired with another page rule to skip caching if wp cookie found. Similarly, you can add web app firewall rules on cloudflare to disallow login access except for you.
Neither case is really static and you still need the server running.
Also for whatever reason even with the right headers I could never force CloudFlare to actually cache everything. I think it will just keep a copy of a visited page in some servers, but not in all, and definitely it won’t cache the whole site at once.
The next.js method is completely static. You can run your wordpress instance locally in your laptop/pc, run next.js static site generator, then upload the resulting static site to aws or github pages. No need to run the wordpress instance 24/7 as it's only required as a data source during static site generation and can be turned off when you're done with it.
There is also an option in cloudflare to pre-cache everything on their edge servers so visitors will never hit the origin server, but it's not available in free plan (I think it's enterprise only plan).
Hand off WordPress / Django CMS to untechy people (either hosted or installed on their pc locally), setup a daily scraping job that updates a static website.
By using free static hosts (eg netlify) and free scheduled processes somewhere (eg heroku) you can do it for free.
Wordpress is pretty great but for me the main reason to go with a static site generator is the simplicity of hosting. Wordpress is a complex beast which requires a server and application that must be updated regularly and backed up.
With a SSG I just have gitlab host it for me which is everything sorted and git does the backups.
But the biggest reason I use Wordpress is I can't handle the friction of treating my website like code. My author hat hates programming and needs a faster feedback loop than flipping back and forth between different windows to see what's happening.
Being able to click Edit, fix a typo, and hit Publish, without any other steps, is what I need.
That's before I get into all of the features Wordpress supports. I installed the JetPack plugin and now I have mailing lists, analytics, monitoring, and a bunch of other things with No Extra Work.
For any website, the complexity has to go somewhere. If you're a programmer with simple needs, an SSG is easier than wrangling an angry kraken like Wordpress.
It depends on your "Just". With Wordpress I "Just" use Dreamhost and do a one-click install.
The trick with Wordpress is to accept that somethings wont be as slick as if you spent $1-10k of your own time building perfect static site generator and customising it beautifully. You have to do what most non-IT people do and make do. But I feel like I rarely have to make do with Wordpress - I can get speed, I can customise a bit with PHP sometimes (although I avoid that) and there are a tonne of plugins.
You can build many "no-code" level solutions in Wordpress for free.
But my problem is similar with static sites: The various templates I’ve bought used Jekyll (Python), Gulp and NPM, it is not feasible to explain newbies how to properly install the dependencies for 3 systems (especially Python, with the 2.7 vs 3.7 difficulty).
Wordpress is inherently unstable on the long term because plugins must be upgraded (anyone who’s had a vulnerability issue knows it). But there is no other decently simple technology.
git does not do the backups, it provides file history, which is not the same thing.
There are many horror stories of people using git as their backup strategy and finding out a corrupted object or a goofed up rebase not noticed right away meant a mass panic looking for an old clone.
If you want to backup your site, do it in addition to git.
Any recommendations for a CMS that is as pleasant to write in as WordPress but designed from the start for outputting static files? I feel like that would have some advantages over trying to hammer WordPress (and more importantly its plugin ecosystem) to act as an SSG.
> to hammer WordPress (and more importantly its plugin ecosystem) to act as an SSG
I don't have recent experience here but, last time I used WP (10+ years ago), they had caching plugins. Isn't that kind of the same? If not, couldn't you just yank out the editor of WP if you think it's more pleasant and put it into anything else you wanted?
But with self-hosted Wordpress, especially with large number of plugins, you will have to constantly update your Wordpress installation or get hacked and spammed, no?
Yes, but wordpress has implemented its own form of a "cron" which allows it to do self-updates. Basically every request spawns a "cron" request (literally a HTTP request to itself over localhost) to be processed asynchronously if it's been long enough since the last. And since a "proper" wordpress install can self-modify, it can thus self-update.
My knowledge is about 5 years old at this point, but the idea still scares me silly.
Personally, I've used a number of static site generators and I ended up in the opposite direction. I needed a website where I could write posts and not have to worry about more than just writing and posting, no deployment, no plain text intermediate languages between me and the end result.
I ended up using Wordpress. I was already familiar with it, knew how to self-host it, and was comfortable modifying a theme to suit my purposes.
Writing and posting new articles is so much easier using rich text. I generally type up my post in Apple Notes first. Copying and posting to Wordpress saves most of the formatting. Inserting images is drag and drop.
Large numbers of good plugins meant it was easy to find something to implement features like having a click-through warning on 18+ posts. Install a plugin, configure it, and I'm done.
Wordpress works well for me, but a lot of programmers are rightfully horrified. Wordpress is popular and complex, which results in a long history of security issues requiring mitigation. It's inefficient and needs caching. It needs to be backed up because everything is in a database, not plain text. As a result, it requires more systems knowledge than a static website.
Static site generators and applications like Wordpress are tools.
Everyone ultimately looks for a tool that works for them. My goal is to write posts, not fiddle endlessly. Other people love the fiddling.
So, if you’re looking to build and maintain a website, think about what’s important to you. What’s your skill set, interests, preferred workflow, and goals?