How I Blog

It’s hacked together but it’s mine

September 22, 2017
random caddy hugo bitbucket

I am now using a static site generator called Hugo, which means my entire site (well the building blocks) can be stored in a git repo. I use a private Bitbucket so I can have drafts that can be synced between machines. As for an editor since all posts, pages and config files are Markdown and TOML, I use whatever is close by, so emacs, Sublime Text, gedit or notepad. The only thing I miss from other blogging platforms is the ability to blog when on mobile, but I have supplemented that with either Google Keep or Toodledo Notes. Once I have a blog post drafted with notes, started or completed, it gets committed (with a terrible commit message) and pushed to Bitbucket. A draft tag in the post’s metadata allows me to create drafts and push them without them being visible once the site is re-generated. All completed posts are run through Grammarly as some plain text editors lack spellchecking and all lack grammar checking. Once something new is pushed my server that hosts my blog will pick it up. It runs a cron job every 5 minutes fetching and pulling from Bitbucket. I could do something with hooks or Bitbucket pipelines but I needed something quick and dirty, and it works. Once that cron job pulls a change down, Hugo with is running in watch mode under Caddy. Caddy is my web server of choice on this server; it auto-generates Let’s Encrypt certs and has a simple configuration file within my setup.

So with the process, technology and hacking described above, I have a straightforward and efficient blog that uses no resources to host, other than the bandwidth of course.

Update: Just after posting this, I noticed that it was not auto-updating the site. Looks like the Hugo watch mode flag in Caddy stopped working. I have moved that part to the script that pulls changes from Bitbucket.

— Michael