Photo by Stokpic / CC0 License | Modified from original.
Using a static site generation tool for your blog makes your blog performant and secure. Using Docker helps you get started quickly.
Aller anfang ist schwer my German teacher told us, and oh my! does that apply to blogging when you are a techie, who—in theory at least—could have built a blogging platform if you just had the time. It does not help that you have extremely capable colleagues who probably have done just that. Obviously the abandoned WordPress-blog from yesteryear does not cut it anymore …
As static site generators are all the rage now, I decided to try the most popular one, Jekyll. Jekyll was originally created 6 years ago by the now ousted Github founder, Tom Preston-Werner, but seems to be in active development still. There are other popular static site generators, but I chose to just go with the flow, trying not to create extra pre-blogging hurdles for myself.
Static site generators have a some very nice characteristics:
- Page generation happens generation-time, not when serving the page, which means a faster site and lower server load.
- Less code and fewer components on the server reduces the attack vector, your site can be made more secure.
- No relational database with state, and in fact, after the site is generated it is immutable - which makes it easier to reason about.
- Usually your site is generated from plain old text files (and perhaps the odd image), which is very amenable to revision control systems.
While static site generators demand very little from your web server you still need infrastructure to run your generator, and sometimes that may be non-trivial to set up. I love Docker and isolating the generator using containerization is a really sweet idea. The presence of a Docker image with Jekyll made choosing Jekyll even easier.
Another great thing about Jekyll, is that it is what Github uses for its User, Project and Organization pages, so if you can leave it to them to do both page generation and serve the pages - if you want to.
Setting up your own Github Pages site is easy, and when you’ve generated a Jekyll site locally you can just push it to your Pages repo. If you want a custom domain name (not *.github.io) there are just a few small things you have to do with your DNS provider, and add a file to your repo.
One nice benefit of using Github Pages is that you get to use Github’s CDN solution, which makes your web page snappier around the world than if you just put your page on some host. (I know this is not a perfect test for this, but you can use a service like 24x7 to check ping from dozens of places around the world, to get a feel for network roundtrip times.)
You’ll find the git repo backing this site on Github, where you will see things like how easy it is to add Clicky or Disqus after you have signed up on their sites.
@akafred Do I have to :P Disqus is .. well .. not my favourite (I rewrote this with nicer words three times).— Denis Braekhus (@denisb) December 17, 2014
@denisb Interesting! I have a post where I mention Disqus - is using Disqus to diss Disqus something we can discuss? http://t.co/MxkKTRI0rJ— a.k.a Fred :-) (@akafred) December 17, 2014
@akafred Well, I’d much rather diskuss it on twitter tbh. It’s bad on so many levels. Security, tracking, slowness..— Denis Braekhus (@denisb) December 17, 2014
@denisb I have disabled 'anonymous cookie tracking', and it loads async so doesn't affect page load much. Security? Alternatives to Disqus?— a.k.a Fred :-) (@akafred) December 17, 2014
@akafred Spotty track record in fixing bugs, misfeatures that enable stalkers and harassers and not protecting identities.— Denis Braekhus (@denisb) December 17, 2014
@akafred Alternatives: discussions on twitter! ;-)— Denis Braekhus (@denisb) December 17, 2014
@akafred Admittedly not much of this applies to your blog, but it’s wider problems with the company, and I’d rather not give them my ID.— Denis Braekhus (@denisb) December 17, 2014
@denisb You don’t have to give an ID :-) You can use pron mode, Tor and post as guest :)— a.k.a Fred :-) (@akafred) December 17, 2014
@akafred Duh, you’re destroying my arguments with boring facts.— Denis Braekhus (@denisb) December 17, 2014
@denisb I know. Hate it when people do that.— a.k.a Fred :-) (@akafred) December 17, 2014