It’s 2018 and you want a blog
How would you build a blog-site in 2018? That was the question I started with. I’ve been blogging now and then, but last time was some years ago. Now I feel the need to have, if nothing else, a public notebook I can use as reference in the future.
Well, it took some digging to find out the right components for making a blog that fulfilled my requirements. But finally I’m comfortable with the current setup.
Just the bare minimum, a static site.
Keep it as simple as possible.
git pushand publish.
I started with Azure
Since I’ve recently have overcome a decade of Microsoft-phobia and is on a quest to learn Azure I started there and tried out there static website hosting. After putting some effort there I realized that it would take more time than I have at the moment. The journey continued.
Then GitLab pages
I recently switched my code repositories from GitHub to GitLab (Microsoft-phobia as I said). I’ve heard about GitHub Pages and reasoned that GitLab must have something similar. Yes, there is the GitLab Pages of course. Solving the continuous delivery part, the site will be published after push to the master branch.
But there was still a big question mark, what blog framework should I use? I was looking for something more modern and less bloated (looking at you Wordpress) and know much have happened since the days of the LAMP-stack and the MEAN-stack. I wanted a static page, something as simple as possible. Hello JAM-stack!
Fortunately GitLab Pages have great a supply of examples of different frameworks so it was very easy to start testing them out. First i tried out Jekyll, written in Ruby. Then Hexio, made with Node.js, before settling with Hugo.
Hugo gave me the hassle free experience I was looking for. It’s written in Go and is a superfast static site generator (SSG). As other JAM-stack frameworks you write your posts in Markdown. There is thus no need for learning another esoteric templating language. It also has a lot of themes to choose from.
I picked one I liked and started to build my site locally. When I felt I had enough I set up the CD-pipeline after my liking. And within seconds I had my page up on GitLab Pages. Sweet!
Custom domain and SSL
Ok, but of course I want my custom domain: nomagic.software, and of course it should only be served over HTTPS.
Setting a custom domain was no problem. But unfortunately, automatic creation and renewal of certificates is not supported at the moment. This would mean I would have to use (the excellent initiative) Let’s Encrypt to create my certificates manually and update them now and then.
But I didn’t settle for that.
Netlify to the rescue
While googling around I found Netlify. Here I could connect my gitlab repo, add build settings and let it deploy on
git push, just as I intended. And the best of it, they offer free (Let’s Encrypt) certificates that are managed automatically. So I switched from Gitlab Pages to Netlify.
With HTTPS enabled for my site, Netlify supports HTTP/2. I also changed nameservers for my domain to use Netlify’s ultra-fast DNS provider NS1. And as a plus, I also get a global CDN. Another cool feature is the ability to perform A/B testing on 2 different Git branches
Setting security headers
What’s the cost?
Best of everything: it’s completely free. At GitLab you have free private repositories, and with Netlify one user websites are also free.