Updated: August 28, 2019
The modern web is all about dynamic content. But in most cases, this is a technological illusion. A large number of website uses dynamically generated pages, i.e. stuff gets read from a database and rendered on the screen when requested, even for things that don't necessarily require any interaction. This takes resources, and might even be considered less secure, because bad or malformed instructions could theoretically generate something undesired.
The old Web was all about static content - HTML pages with links and images and not much else. Not bad, very light on the resources, and as secure as the Web server what does it. But then, not much interaction happens, and updating content can be tedious. What if there was something midway between the two worlds? That would be Nikola, a static site generator.
Exploring, installing, testing
The essence of the idea is - you create your static websites dynamically. A bunch of Python scripts helps you create and edit your pages, fixing links and such in the background so you don't need to manually do that every time you change something. Plugins and themes make this an even easier task. The differences from traditional CMS are, no database, and you build everything locally before uploading to wherever your site is meant to live. And yonder, it's just HTML and images.
I found this interesting because offline content creation in modern times ain't easy. I wrote about this in 2018, and sadly, ironically, logically found the ancient KompoZer to be the most suitable tool that gives you both GUI and flexibility of direct code editing should you so desire. Nikola offers a hybrid approach - it's mostly command line, but you also get a visual editor plus live browser previews.
I followed the generic setup instructions (pip and virtualenv commands), and this worked fine. I guess the whole thing can be automated (put inside a script). Once this step was complete, I followed the online tutorial on how to create the first (demo) website.
nikola init --demo test-site
Creating Nikola Site
This is Nikola v8.0.2. We will now ask you a few easy questions about your new site. If you do not want to answer and want to go with the defaults instead, simply restart with the `-q` parameter.
--- Questions about the site ---
Site title [My Nikola Site]:
Once I've provided the basic data - you also need a domain, which is registered, because this will be used as the homepage - I then went about creating a first post. I did this following the instructions, and hit a problem right away.
(nikola) roger@tester:~/nikola/test-site$ nikola new_post -e
Creating New Post
Title: Why Badgers Shouldn't Be Allowed to Drive
[2019-04-07T18:05:25Z] INFO: new_post: Your post's text is at: posts/why-badgers-shouldnt-be-allowed-to-drive.rst
[2019-04-07T18:05:25Z] ERROR: new_post: The $EDITOR environment variable is not set, cannot edit the post with '-e'. Please edit the post manually.
The thing was, I needed to manually export the EDITOR variable. I set it to Kate in KDE, but for that matter, I could have used any editor, including even Notepad++, which is quite nifty. Then, if you do this, you won't hit this error again.
The editing piece is a bit ... weird. Nikola uses files with the .rst extension, to signify them as being reStructuredText, although you can manually configure other formats like Markdown. I found this a little odd, because this forces people to learn yet another (odd) syntax. It also means there's no style and content separation.
This means you can't just work - you need to learn another language, and this is then rendered into HTML, but I'm wondering what about CSS classes, what about styles, what about actual HTML elements. After all, if someone is making a website, shouldn't they have control over the actual syntax? Eventually, I was done with my first post, and I let Nikola build.
Once this step is complete, you can preview your changes inside the browser. Then, you have the additional themes and plugins in case you don't feel like hacking anything of your own. So far, this wasn't bad, but I still had some questions. The biggest among them was, well, what's next? Say I'm happy with the website, do I just upload the whole thing to my server via FTP or what? And how does one handle updates?
I did find other interesting bits and pieces, like the ability to deploy to various build systems, ability to import gists, create charts and thumbnails, and use code blocks. But I still thought there was insufficient focus on the final state, which is, once the user is done with creating content, how do they go from the local build environment to an online deployment in a straightforward manner?
The really important question one needs to ask is, if Nikola Tesla were to setup a website, what technology would he be using today? Microsoft FrontPage? Geocites? Nikola? I like the concept, I like the idea of saving users a lot of time on unnecessary website skeleton updates, but I found the approach too devsy. I know, building websites isn't a game, but it shouldn't be a hax0rfest either.
For me, Nikola could do better with a more streamlined setup, ability to use HTML directly or at least add blocks of code, and more intuitive preview and deployment parts. I know the answers are out there, but the beauty is having simple, self-explanatory tools that give more than they ask. If one must labor massively just to get to the point of being able to deploy their first page, then the very tools that was supposed to save time becomes the problem they were meant to save in the first place. That said, I like Nikola, this is a very cool approach, and I will be keeping an eye. After all, who knows what Web 4.0 or whatever's going to bring.