Posts about nikola (old posts, page 3)

2012-08-27 22:09

Nikola: New Tag Index Pages

Short and sweet:

In Nikola my static site/blog generator, the Tag pages used to just be a big list of titles linking to the posts in the tag. Now they can (optionally) look just like the blog does, but filtered. Check it out.

Minor tweaks still needed (like, mentioning the tag somewhere in the title), but the basic functionality (filtering, pagination, layout, etc) is complete.

To enable it in your site, just use master from git and enable TAG_PAGES_ARE_INDEXES = True in your

2012-08-17 10:10

Nikola 4 Released


  • Previous/Next post links
  • Teaser support
  • Support posts with HTML "sources"
  • Site checking script (nikola_check)
  • Maximum image size in galleries
  • Image descriptions in galleries
  • Image exclusion in galleries
  • Special "draft" tag
  • Pretty code listings ("code galleries")
  • Page descriptions
  • Easy theme tuning via Bootswatch
  • Support for WebAssets bundles
  • "Filters" for powerful file post-processing


  • Improved HTML output
  • Support multiple time formats in post metadata
  • Slugify tag names for URLs
  • Archive path and filename configurable
  • Galleries sorted by date (supports EXIF)
  • Rotate gallery thumbnails (EXIF)
  • Tag feeds in tag pages
  • Colorbox support in restructured text figures
  • Fix for content displaying too wide
  • Changelog

As usual, you can discuss bugs or make feature requests at the nikola-discuss group and I love to know of sites using Nikola.

Hope you like it!

2012-08-10 20:06

Nikola: Filters & Bundles


Filters let you postprocess your output. Think of it like instagram for websites, but useful. You can configure per file extension a series of python functions or shell commands, which will be applied in place to the output file.

For example, suppose you want to apply yui-compressor to your CSS and JS files:

    ".css": [filters.yui_compressor],
    ".js": [filters.yui_compressor],

There, filters.yui_compressor is a simple wrapper around the command so that it applies in-place to the output files.

If you use strings there (untested), they are taken as commands. The "%s" will be replaced by the filename, the usual crazy shell quoting rules apply:

    ".jpg": ["jpegoptim '%s'"],
    ".png": ["pngoptim '%s'"],

Keep in mind that the filters modify the output of Nikola, not the input, so your images, CSS, and JS files will not be touched in any way. And of course changing the filters applied to a file will force a rebuild, so you can experiment freely.


Having many separate CSS or JS files is usually a nono for performance reasons because each one may involve a separate HTTP transaction. The solution is to "bundle" those files in a single, larger file.

The reason not to do that is that usually it means having a huge, uncomfortable thing to handle. So Nikola tries to give you the best of both worlds, by letting you have separate files, and bundling them (or not) on build.

There is a new option, USE_BUNDLES that defaults to False, and there are some changes in the theme templates so that it uses the bundled version when needed.

This was only possible thanks to Webassets. However, if you don't have Webassets installed, or you don't enable USE_BUNDLES, this should cause no changes in the output.


These new features will allow Nikola users to improve their site's performance with minimal tweaking, which is always a good thing.

2012-07-09 11:18

Nikola-as-a-service demo

One of the things I hacked at during this PyCamp is trying to figure out a nice workflow for Nikola, something that will enable users that are not so technical, to use it.

One first step is Nikola-as-a-service, which is meant for technical users anyway but lays down the infrastructure for this to work semi-nicely.

In the video below, you will see me do this:

  • Go to GitHub
  • Take a starter's blog I provided, and do a clone
  • Go to the nikola-as-a-service site, and login (via twitter)
  • Create a site using my fork's repo URL
  • Get a "webhook" URL, and add it to my fork's admin as a post-commit hook
  • Edit a file in github's web UI and commit it (you can of course just push from any github client)
  • Automatically, the site nikola-as-a-service publishes gets updated.

Please don't try to use this service yet because:

  1. It's running in a $4.50/month server
  2. It's the same server my own blog uses
  3. I will turn it off, delete everything, etc. every once in a while
  4. I am editing the code on the server, so no guarantees it will not just stop working.

So, here's the video:

2012-07-09 01:45

PyCamp 2012 - Day 3

So, day 3 and next-to-last of PyCamp is done.

  • Great day, sunny, not all that cold
  • Empanadas at lunch, pizza for dinner, cake for tea. Feeling kinda spoiled today.
  • Lots of hacking at Nikola-as-a-service (details below)
  • PyAr meeting by a huge, somewhat scary bonfire earlier tonight

So: Nikola-as-a-service is an idea where you can keep your blog somewhere, and this service will get the data, and publish a nice site for you.

Here's the current workflow, which is just one of a dozen that can be implemented because this thing is quite simple:

  1. The authenticator

    Currently it has twitter authentication. You never need to create an account, just login with some service you already have accounts with. Anything with OAuth will work.

  2. The data provider

    Currently, github. Soon, Ubuntu One. Later, who knows. A data provider is something from where we can grab data, and that can notify us (automatically or by having the user click on a button) when we should get that data and rebuild the site.

  3. The renderer

    I am doing it with Nikola, of course :-)

  4. The infrastructure

    Jobs using Redis and Celery, server app using Flask, rendering using Nikola

  5. How does it work?

    You go to github, clone a barebones blog. Do your modifications. Go to nikola-as-a-service, and login via something. Then you give Nikola your github repo's URL, and you get a webhook URL. Go back to github, and configure the webhook.

    From that moment on, every time you push to github, your blog is updated :-)

    In the future: every time you save to Ubuntu One, your blog is updated. In the further future: Every time you X to Y, your blog is updated.

It's going to be cool :-)

2012-07-07 23:51

New Nikola Feature: code listings

This is a new feature in Nikola, my static website and blog generator.

It's aimed at showing pieces of files in the posts, and giving you a link to the full file, does reasonable syntax highlight thanks to pygments, and the syntax for embedding in your posts is not excessively awful, so I can use it for some of my tutorial / book projects.

Here's an example:

.. listing:: python
   :start-at: def compile_html
   :end-before: output =

System Message: ERROR/3 (<string>, line 14)

Error in "listing" directive: unknown option: "start-at".

.. listing:: python
    :start-at: def compile_html
    :end-before: output =

This is not merged into master yet, but should be soon.

2012-07-06 23:54

PyCamp Day 1

Going to sleep, so here's a quick rundown of my 1st day at Pycamp:

  • Woke up at 6AM, and after taking trains, buses and automobiles, arrived around noon. Place is nice, wheather is cold. Beds are bunks.
  • Presented ideas, voted working slots
  • Implemented a Nikola feature to get themes from
  • Implemented first draft of pipelines for post-processing generated files
  • Martín Gaitán is working on improving the image galleries
  • Hugo Ruscitti is doing some celery+flask magic to create a Nikola hosting service
  • Had fun with lots of other things and talking with a lot of people.
  • Played some table tennis (won 1, lost 1)
  • Got a firefox t-shirt
  • Got a Ninja-IDE mug that changes colour with temperature.

Now, exhausted, going to bed.

2012-07-04 22:28

Nikola Ideas for PyCamp

This friday is the beginning of PyCamp, four days of python hacking without distraction or pause. And I want to code a lot. My main target is features for Nikola my static blog generator.

If you are attending PyCamp (or even if you are not), you are welcome to join me in implementing these in a marathon of kickass coding starting this friday and lasting all weekend.

I have a few ideas in my head, but I want more. These are the ones I have, please add more in the comments if you have any:

Code Gallery
Like image galleries but for code. Put code in a folder and it will be beautifully displayed. With the addition of a "listings" docutils directive, it will make showing code in detail and in context easy and powerful, and make Nikola more attractive to programmer-bloggers.
Gallery Polishing
Image galleries are implemented and work, but they could use a lot of polish. From making them more network-efficient, to image RSS feeds, recursive galleries, gallery metadata, image texts, and much more.
File Pipelines

Want to minimize your CSS? Tidy your HTML? pngcrush your images? apply HTML transformations? Other things I can't imagine?

File pipelines would bring the power of the unix shell to a site generator, letting you connect lego-like filters, some provided, some from the community, into a powerful machinery.

Online Editing (Alva)
While static site generators have lots of benefits, they have one significant downside: you edit the files in your own device. A online editor for Nikola lets you edit them through a web interface for blogging-from-aywhere goodness.
Nikola Hosting (Shoreham)
Why not create a service where the user feeds posts to a server and then the server publishes them? The feeding can be via a DVCS, or a file sync service, or via online editors, and the output is published automatically or at the push of a button.
I don't do drafts. I type and that's it. But others prefer more cautious and sane approaches. So, how should drafts work? While the feature may be easy to implement, it's a good beginner programmer's task, where you have to think more about what you want to achieve and providing a good user experience than about just banging code.

So, is there something you saw in another static blog generator and Nikola lacks? Any cool ideas and want a friendly codebase to hack them on? Do you have any crazy ideas noone would touch with a ten-foot-pole but you think would be awesome to have?

Well, now's a good time to talk about it!

2012-07-02 20:49

PyCamp Starts This Week

This friday marks the beginning of the 2012 PyCamp. What's PyCamp? It's a lot of python programmers (this year, about 50) gathering in an isolated place for a long weekend, with nothing to do except code. We will have our meals catered, there are no TVs, there is hardly anything within walking distance, and it's going to be very cold.

So, it's going to be awesome. It's a rare chance for me to spend a few days hacking at my own personal projects, uninterrupted by more important things like family, work, cooking, or socializing except between nerds.

Sure, there is the occasional monocycle riding, or juggling lesson, or shooting practice, but really, three or four solid days of hacking.

I intend to work on projects related to Nikola my static site generator, so if you are interested in that and going to pycamp, I want to talk with you.

And if you are interested but not going to pycamp, there is no reason not to join in a virtual sprint. We'll have internet. There is IRC. I will have time. It's a weekend! Please share any interesting ideas you have about static site generators in the nikola-discuss group and we'll see how much can get implemented or at least started.

Contents © 2000-2019 Roberto Alsina