Blog redesign with home made tools!

Published on: 2019-07-28

Home | Archive

A static site like what you are browsing right now is a simple collection of HTML/CSS files and images. There are powerful tools like Jekyll, Hugo etc which do an excellent job at creating such sites. I too was using them for a long time. Even though they are easy to get started with, tweaking the output produced by these tools is a bit tricky. That is when I thought of putting together a small program to generate my site.

The site generator

I wrote a basic site generator in a couple of hours and about 400 lines of Golang code. The code uses blackfriday v2, a markdown processing library, as the only non-stdlib dependency.

The front end

I didn’t want to use stuff like Bootstrap, and I was totally lost when it came to anything related to design. After a few hours of effort, I was able to cobble together enough CSS to create something which doesn’t look very ugly (no idea whether readers will also share this feeling …). This CSS flexbox tutorial helped me a lot.

Web server with HTTPS support

I am a long-time nginx user. I recently came to know about Caddy, a web server (written in Go) which provides HTTPS support out of the box (using letsencrypt). I tried this out and was surprised by how simple it was (it is really simple - basically nothing more than “just run the binary”). Highly recommended!

The workflow

I commit to git locally and push to a private gitlab.com repo. I have configured gitlab CI (using the runners provided by gitlab itself) to compile the go code, run the code to generate the site and scp it to my digitalocean VM (this process will take about one minute).