New Nikola Thing: scripts
Nikola is a static site generator, and it knows its audience: Nerds, programmers, science people, and the like. Oh, and me. I mostly develop it for me.
One important thing for this category of tools is that they should cater to what the users want to do, and also to how they want to do it.
So, faced with the need to do things like "set this specific metadata field in these 490 posts out of the 1450 you have" ... editing them manually is not going to happen.
Sure, I could sed/python/whatever my way to do it "automatically". But that is going to be awfully error prone.
So, I have started a campaign to fix it. I want to make Nikola be the API to its data. This has two sides.
I need to be able to run one-off things
This needs to be easier than creating a Nikola command plugin but less annoying than typing them in nikola console
[ralsina@salma static]$ nikola console
Scanning posts..........done!
Python 3.8.2 (default, Feb 26 2020, 22:21:03)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.11.1 -- An enhanced Interactive Python. Type '?' for help.
Nikola v8.0.4 -- IPython Console (conf = configuration file, site, nikola_site = site engine, commands = nikola commands)
In [1]:
The good news is: this is done in git master!
Now you can create a python script and run it as nikola console -s cool_script.py
and
the script runs in the same context as the console, so you magically have the site
itself and the timeline and the configuration and all the good stuff ready to use.
I need the API to be useful
And this is where Nikola has ... not been a good boy. Since it was meant to generate static sites, it's pretty good about offering you ways to know things about your data.
Want to know what is the description of the tags applied to the post in slovene? it totally can do that in two lines.
Want to add a tag to a post? Sorry dude, that's impossible.
So, I am adding these things, slowly.
And that's the current status.