Run WordPress locally and publish statically

This website is actually a WordPress site exported as static content. This makes the website run as fast as technically possible.

To achieve this, you have multiple options. You can create a static site from the get-go, or you can use a system that allows exporting as static content.

I tried some static site generators. You write in markdown, then you export, and then you upload it to your server.

Markdown is good when you need to write technical documentation, but not so great when you need advanced styling. It is very hard to create a table using markdown. Too much typing and moving.

You can use HTML inside markdown, but writing HTML is not simple either. Too much typing.

That leaves anything that runs on markdown out for me.

Which leads me to WordPress. Decent editor. Page and post distinction right from the beginning. Multiple themes and customization options. Modules that help you handle things like SEO and analytics.

Except for one drawback. I don’t want to run a full WordPress install on my server. Yes, I want to use WordPress, but not on my server. My server should have the least amount of load possible, without losing functionality essential to me.

So how do you achieve this? You can run WordPress on your own computer and it will handle all the editing of content, all the interactivity. Then you can make it publish to your server.

You can easily achieve this with a docker-compose file, running wordpress and mysql inside. Then you setup a system to publish to your server automatically, and you are done.

To achieve this, I wrote a script to first start my local blog.begiter.net, and then when i run it with stop, it generates the static content, copies to my desktop from the container, copies it to my server, and voila! My latest content updates are published.

You may think “but you are still uploading your changes manually!”. The reason for that is simple really. I do not like running multiple projects at the same time. So I open my blog, write my content, stop the containers, and move on to another project. Working on a single task at a time makes life much easier compared to juggling multiple items.

Long story short, that’s what you are reading. A static HTML output written in WordPress and generated through an extension.