Going Static With Nikola
I started blogging around May 2006. I started with blogger, then moved on to wordpress and then eventually to self-hosted wordpress. This time around, when I decided to blog again, I have setup a static blog site built using Nikola - A static site generator written in Python. Nikola comes with a wide range of plugins and themes and helps us create beautiful websites and blogs with very minimal effort. And more importantly, Nikola is a Free/Libre Open Source Software.
Static Site Generators
Static Site Generators are tools that transpile contents written in some light-weight markup language like ReST, MarkDown, or AsciiDoc into HTML and CSS. They do this usually by using a templating engine behind the scenes. The templates of a templating engine define both the layout and the look & feel of a web page. These templates have placeholders and variables, CSS and the base HTML structure. A static site generator transpiles text from the input document into HTML by replacing variables and placeholders in these templates. Jinja and Mako are the most popular templating engines in the Python eco-system.
Most static site generators come with dozens of themes to choose from. Here, a theme is a collection of templates, CSS and possibly images. This site uses a common Nikola theme.
Why self-hosting? and why static?
A common question the several people ask me is why am I self-hosting when there are excellent platforms like Medium and even cloud-hosted wordpress. And some people go on to ask why I am using a static site when we can self-host something as powerful as wordpress.
The answer for the first one is simple. I want to own my data. And, I write blogs to share thoughts, opinions, stories and experience. I don’t want ads on my blog. The first point rules out blogger/blogspot and the last one rules out cloud-hosted wordpress.
The reason why I chose a static site is a little difficult to explain. But here it is anyway - My blog consists of several blog posts, comments for each of those and an about page. The only dynamic content in my blog is the comments section. Now, why would I want to have a sophisticated PHP + Apache/nginx + MariaDB ecosystem when about 95% of my web site is just HTML+CSS. All I need is a small sqlitedb for comments and some version control tool like git to maintain my blogs. So instead of setting up and maintaining something complex, vulnerable to attackers and sophisticated to use, I just use emacs + make + rsync.
Comments have become ubquituous in the modern web and so comments are an essential part of blogs too. Since this is a static web site, comments aren’t possible by default. But there is an amazing tool called isso that integrates well with Nikola. This amazing FLOSS supports comment moderation too. So that’s what is powering the commenting system in this blog.
Finally, if you are running your own self-hosted blog using a sophisticated tool and you want to move to a static site, feel free to reach out to me :)