Skip to main content

Ralsina.Me — Roberto Alsina's website

Nikola Ideas for PyCamp

This fri­day is the be­gin­ning of Py­Cam­p, four days of python hack­ing with­out dis­trac­tion or pause. And I want to code a lot. My main tar­get is fea­tures for Niko­la my stat­ic blog gen­er­a­tor.

If you are at­tend­ing Py­Camp (or even if you are not), you are wel­come to join me in im­ple­ment­ing these in a marathon of kick­ass cod­ing start­ing this fri­day and last­ing all week­end.

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

Code Gallery

Like im­age gal­leries but for code. Put code in a fold­er and it will be beau­ti­ful­ly dis­played. With the ad­di­tion of a "list­ings" do­cu­tils di­rec­tive, it will make show­ing code in de­tail and in con­text easy and pow­er­ful, and make Niko­la more at­trac­tive to pro­gram­mer-blog­ger­s.

Gallery Polishing

Im­age gal­leries are im­ple­ment­ed and work, but they could use a lot of pol­ish. From mak­ing them more net­work-­ef­fi­cien­t, to im­age RSS feed­s, re­cur­sive gal­leries, gallery meta­data, im­age texts, and much more.

File Pipelines

Want to min­i­mize your CSS? Tidy your HTM­L? pngcrush your im­ages? ap­ply HTML trans­for­ma­tion­s? Oth­er things I can't imag­ine?

File pipe­lines would bring the pow­er of the unix shell to a site gen­er­a­tor, let­ting you con­nect lego-­like fil­ter­s, some pro­vid­ed, some from the com­mu­ni­ty, in­to a pow­er­ful ma­chin­ery.

Online Editing (Alva)

While stat­ic site gen­er­a­tors have lots of ben­e­fit­s, they have one sig­nif­i­cant down­sid­e: you ed­it the files in your own de­vice. A on­line ed­i­tor for Niko­la lets you ed­it them through a web in­ter­face for blog­ging-from-ay­where good­ness.

Nikola Hosting (Shoreham)

Why not cre­ate a ser­vice where the us­er feeds posts to a serv­er and then the serv­er pub­lish­es them? The feed­ing can be via a DVC­S, or a file sync ser­vice, or via on­line ed­i­tors, and the out­put is pub­lished au­to­mat­i­cal­ly or at the push of a but­ton.


I don't do draft­s. I type and that's it. But oth­ers pre­fer more cau­tious and sane ap­proach­es. So, how should drafts work? While the fea­ture may be easy to im­ple­men­t, it's a good be­gin­ner pro­gram­mer's task, where you have to think more about what you want to achieve and pro­vid­ing a good us­er ex­pe­ri­ence than about just bang­ing code.

So, is there some­thing you saw in an­oth­er stat­ic blog gen­er­a­tor and Niko­la lack­s? Any cool ideas and want a friend­ly code­base to hack them on? Do you have any crazy ideas noone would touch with a ten-­foot-pole but you think would be awe­some to have?

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

Kay Hayen / 2012-07-05 08:58:

If you do pipelines, I could upstream my optimizations. I am therefore hoping you do that. The Gallery Polishing, I would do my own, but I am not really qualified. I would love if it became network efficient, and it actually matters a lot to me. For bonus points, could you integrate with Digikam tags?

Roberto Alsina / 2012-07-05 10:44:

Are digikam tags in the EXIF data?

Kay Hayen / 2012-07-05 11:01:

I believe in settings/metadata you get to specifiy what.

From the gallery, I would hope to be able to export all, then let Nikola work on those in its template I suppose, and remove the rest with jpegoptim and friends.

So then in Digikam, I would tag things to be in a certain album, and then I would want it to appear in Nikola. That would be a great user interface, and would require no copying of files and links at all.

But if you do that as a last step, it would probably be best. But I seem to recall you as a KDE guy, so i kind of expect you to know how to talk with Digikam directly.

Roberto Alsina / 2012-07-05 11:09:

Yes, former KDE guy, but have no clue about digikam's inner workings, really.

Kay Hayen / 2012-07-05 12:15:

lol, I will forgive. Enjoy your hackfest... I am currently at Europython, and don't get anything done, just talking to so many people, new and witty people, who have a lot to say. But I rebased to latest Nikola and it was easy to do.

One thing, I believe you ought to not forget, is the pylint cleanliness thing. It would allow you to catch typos and mismerges easier (seen recent commits of such) and it's only practical, if you once make it to 0, so you can then use it easily as a check before push.

And btw, I was considering to package Nikola for Debian, but for that, I need a solution for the "doit/nikola" mix. Did you give an OK for that? I wanted to attack that occasionally. It's can't be that hard. As for the packaging, the lack of a doit Debian package will be hurting though.

Roberto Alsina / 2012-07-05 12:22:

I am ok with making the nikola command a doit wrapper. If doit is not packaged, you can bundle the standalone doit script: http://python-doit.sourcefo...

And yes, I need to be more careful with pylint and the rest :-)

Kay Hayen / 2012-07-05 15:32:

Ok, will do that then. As for the packaging for Debian, builtin copies bundled are not very popular, but I can still try.

As for pylint, don't worry, it would just be nice, if you had something like "check-with-pylint". You can steal it from Nuitka and re-license as you see fit. It already has most of the things sorted out.

Git it from here:

Just change the path to your script, and adapt the while listing, then adapt the options. I have disabled naming stuff, and useless things already.

As a contributor, I would appreciate a quick way to tell that I don't submit any bad stuff. But now, changing things, it's not really practical. So if you want to go for that, you are welcome. :-)


Pablo2M / 2012-07-05 17:21:

Es una pavada pero tener como opcional tener un "almanaque" similar al que usa el gran hermano del canal ( para asustar menos con el archivo creo que estaria bueno

jjconti / 2012-07-06 00:47:

Exportar a pdf!

Petri Savolainen / 2012-07-11 09:57:

Here's my two cents: 1) Add support for predefined page layouts. Most sites/pages have header, footer, content area and optionally a left column and/or right column. That would also allow for more powerful theming. 2) add support for including YAML metadata in file header rather than a separate file, as in Jekyll (see

Roberto Alsina / 2012-07-11 12:55:

There is already a way to put the metadata in a comment in the post itself (but it seems to be slightly buggy)

I am not sure I understand about the layouts. Can you point me at docs or examples?