Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre nikola (publicaciones antiguas, página 6)

Nikola: Nuevas Páginas Tag Index

En Niko­la mi ge­ne­ra­dor de si­tios y blogs es­tá­ti­co­s, las pá­gi­nas de tags so­lían ser una sim­ple lis­ta de tí­tu­los li­nkea­dos a los pos­ts del ta­g.

Aho­ra pue­den (op­cio­nal­men­te) ver­se co­mo el res­to del blo­g, pe­ro fil­tra­do. Ojo al pio­jo.

Ne­ce­si­ta re­to­ques (por ejem­plo, men­cio­nar el tag en el tí­tu­lo­), pe­ro la fun­cio­na­li­dad bá­si­ca (fil­tra­do, pa­gi­na­do, la­you­t, etc) es­tá he­cha.

Para habilitarlo en tu sitio, si usás master de git, poné TAG_PAGES_ARE_INDEXES = True en tu

Nikola 4 Released

I have just up­load­ed re­lease 4 of Niko­la my stat­ic blog/site gen­er­a­tor. Here are some of the changes in this ver­sion:


  • Pre­vi­ous/Next post links

  • Teas­er sup­­port

  • Sup­­port posts with HTML "sources"

  • Site check­­ing script (niko­la_check)

  • Max­i­­mum im­age size in gal­­leries

  • Im­age de­scrip­­tions in gal­­leries

  • Im­age ex­­clu­­sion in gal­­leries

  • Spe­­cial "draft" tag

  • Pret­­ty code list­ings ("­­code gal­­leries")

  • Page de­scrip­­tions

  • Easy theme tun­ing via Bootswatch

  • Sup­­port for We­bAs­sets bun­­dles

  • "Fil­ter­s" for pow­er­­ful file post-pro­cess­ing


  • Im­proved HTML out­­put

  • Sup­­port mul­ti­­ple time for­­mats in post meta­­da­­ta

  • Slugi­­fy tag names for URLs

  • Ar­chive path and file­­name con­­fig­urable

  • Gal­­leries sort­ed by date (sup­­ports EX­IF)

  • Ro­­tate gallery thum­b­­nails (EX­IF)

  • Tag feeds in tag pages

  • Col­or­box sup­­port in re­struc­­tured text fig­ures

  • Fix for con­­tent dis­­­play­ing too wide

  • Changel­og

As usu­al, you can dis­cuss bugs or make fea­ture re­quests at the niko­la-dis­cuss group and I love to know of sites us­ing Niko­la.

Hope you like it!

Nikola: Filters & Bundles

Two up­com­ing fea­tures for the next re­lease of Niko­la, my stat­ic site gen­er­a­tor, due some­time in Au­gust.


Fil­ters let you post­pro­cess your out­put. Think of it like in­sta­gram for web­sites, but use­ful. You can con­fig­ure per file ex­ten­sion a se­ries of python func­tions or shell com­mand­s, which will be ap­plied in place to the out­put file.

For ex­am­ple, sup­pose you want to ap­ply yui-­com­pres­sor 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 (untest­ed), they are tak­en as com­mand­s. The "%s" will be re­placed by the file­name, the usu­al crazy shell quot­ing rules ap­ply:

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

Keep in mind that the fil­ters mod­i­fy the out­put of Niko­la, not the in­put, so your im­ages, CSS, and JS files will not be touched in any way. And of course chang­ing the fil­ters ap­plied to a file will force a re­build, so you can ex­per­i­ment freely.


Hav­ing many sep­a­rate CSS or JS files is usu­al­ly a nono for per­for­mance rea­sons be­cause each one may in­volve a sep­a­rate HTTP trans­ac­tion. The so­lu­tion is to "bundle" those files in a sin­gle, larg­er file.

The rea­son not to do that is that usu­al­ly it means hav­ing a huge, un­com­fort­able thing to han­dle. So Niko­la tries to give you the best of both world­s, by let­ting you have sep­a­rate 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 on­ly pos­si­ble thanks to We­bas­sets. How­ev­er, if you don't have We­bas­sets in­stalled, or you don't en­able USE_BUNDLES, this should cause no changes in the out­put.


These new fea­tures will al­low Niko­la users to im­prove their site's per­for­mance with min­i­mal tweak­ing, which is al­ways a good thing.

Nikola-as-a-service demo

Un pri­mer pa­so es Niko­la-a­s-a-­ser­vi­ce, que es­pa­ra usua­rios muy téc­ni­co­s, pe­ro po­ne la in­fra­es­truc­tu­ra pa­ra que es­to fun­cio­ne.

En el vi­deo de aba­jo, van a ver es­to:

  • Voy a Gi­­tHub

  • Fo­­­rkeo un blog de de­­mo

  • Voy al si­­tio de niko­­­la-a­s-a-­­se­r­­vi­­ce y me lo­­­gueo via twi­­tter

  • Creo un si­­tio usan­­do la URL del re­­po de mi fo­­­rk

  • Ob­­ten­­go una URL del "we­­bhook" y la ca­r­­go en el ad­­min de gi­­thub pa­­ra po­s­­t-­­co­­­m­­mit

  • Edi­­to un ar­­chi­­vo en la UI web de Gi­­tHub y lo co­­­m­­mi­­teo (por su­­pues­­to, po­­­dría pus­hear con cua­l­­quier clien­­te gi­­t)

  • Au­­to­­­má­­ti­­ca­­men­­te, el si­­tio en niko­­­la-a­s-a-­­se­r­­vi­­ce se ac­­tua­­li­­za.

Por fa­vor no in­ten­ten usar es­to por­que:

  1. Es­­tá en un se­r­­ver de U$S 4.50

  2. Es el mis­­mo se­r­­ver que mi blog

  3. Lo voy a apa­­gar y bo­­­rrar to­­­do den­­tro de un ra­­to

  4. Es­­toy edi­­tan­­do el có­­­di­­go di­­re­c­­ta­­men­­te en el se­r­­ve­­r, así que en cua­l­­quier mo­­­men­­to lo ro­m­­po.


Contents © 2000-2023 Roberto Alsina