Nikola version 7.4 was released earlier today. It includes a few new features I’ve added including some limited prefetching instructions for browsers, HTML Tidy integration for HTML minification and prettification, and support for generating Atom feeds.
Nikola’s Atom feed implementation is pretty interesting. Before I go into that, I need to explain how index pages in Nikola work. Nikola will generate an index.html page containing the most recent posts. The index-1.html page will contain the oldest posts, index-2.html contains somewhat newer posts, and so on.
The numbers never change and the page addresses and the posts contain always remain the same. Unlike most other publishing platforms, this means the older indexes are shareable as they will always contain the same content. Nikola 7.4 will now optionally generate a corresponding index.atom feed for the newest posts. This file will, like index.html, update with the newest posts and works like a traditional syndication feed (like RSS.) The interesting bit is that it will also generate an index-1.atom, index-2.atom, and so on.
These older feeds are linked together with pagination relations. Meaning, a feed processor can see and retrieve older updates to the site’s first posting. The oldest feed files are marked as being archive feeds to discourage uses of them as normal syndication feeds. Additionally, each archive feed contains a link relation to the main index.atom feed telling the feed processor to get current posts from there instead.
Update to Nikola 7.4.0 to start generating Atom feeds with your Nikola site. You also have to set the GENERATE_ATOM = True option. If you want feeds for your tags/category pages and yearly or year-monthly archive pages, you also need to set TAG_PAGES_ARE_INDEXES = True and ARCHIVES_ARE_INDEXES = True.
Nikola’s default themes support Atom feed auto-discovery from their HTML output. You may have to adjust your theme if you’ve written your theme or overwritten some of the default theme’s templates.
Speaking of HTML, there are two other new features I’ve worked on in this release too: The first one being prefetching. This tells the browser to download and cache the first new post when visiting a Nikola site’s homepage.
Based on my own site traffic, a very significant portion of readers who visited the front-page clicked-through to the newest article. Prefetching will make the page load faster. For readers who don’t click-through to the newest article, the bandwidth used is minuscule.
The second new HTML feature is integration with tidy5. It cleans up the admittedly messy HTML output from Nikola and minimizes and prettifies it. It’s a very geeky feature, but I’ve wanted it for a long time. The lack of a working output prettifier almost made me decide against using Nikola when I started this site! If you appreciate clean and readable code, you’ll find this a nice addition.
What is Nikola again?
Nikola is a static site and blog generator, written in Python. It can use many popular templating and markup languages into static pages or blog posts! It also supports image galleries, and is multilingual. Nikola is flexible, and page builds are extremely fast, courtesy of doit (which is rebuilding only what has been changed.) Nikola is the static page generator program that powers this very website.