Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre python (publicaciones antiguas, página 85)

Creating a Theme for Nikola From Scratch (almost)

The­re is so­me do­cu­men­ta­tion about crea­ting the­mes for Niko­la, but ma­y­be a tu­to­rial is al­so a use­ful way to ex­plain it. So, he­re it is. I'­ll ex­plain how to crea­te a the­me (al­mos­t) from scra­tch. Al­ter­na­ti­ve­l­y, you can take an exis­ting the­me and mo­di­fy on­ly par­ts of it via inhe­ri­tan­ce, but tha­t's for ano­ther do­cu­men­t.

I wi­ll try to crea­te a the­me that looks like Vi­ni­cius Ma­s­su­che­tto­'s Mo­nos­pa­ce The­me.

Leer más…

Nikola Feature-by-request: tag cloud!

I asked for fea­tu­re re­ques­ts for Niko­la my sta­tic si­te ge­ne­ra­to­r. I got so­me. One was from lon­g-­ti­me user Kay Ha­yen, so I just could­n't say no.

He asked for tag clou­d­s. Look:

An­y­thing in he­re wi­ll be re­pla­ced on bro­w­sers that su­pport the can­vas ele­ment

Cu­te, is­n't it? And it's rea­l, ac­tual tag da­ta from this ve­ry si­te. Wi­th li­nks!

How it's do­ne:

Niko­la ge­ne­ra­tes a JSON fi­le that has the cloud da­ta (tag na­me, si­ze, li­nk), and tha­t's pro­ce­ss­ed by JQue­ry and ta­gCan­vas and ... we­ll, it wo­rks.

You have to add jquery.tagcanvas.min.js somewhere and embed a whole pile of raw HTML (see here for details) but hey, it works.

Ho­pe you are ha­pp­y, Ka­y, you ma­de me co­de ja­vas­cript, du­de ;-)

It's pro­ba­bly ra­ther "ea­s­y" to make it use any of the­se ins­tead of ta­gCan­vas if an­yo­ne is so in­cli­ne­d.

Why Use Something Else?

I wro­te a sta­tic si­te ge­ne­ra­to­r, ca­lled Niko­la a whi­le ago, and it's star­ting to get so­me adop­tion and con­tri­bu­tion­s.

I thi­nk it's a fair­ly ni­ce pie­ce of co­de, to be ho­nes­t, and it pre­tty mu­ch does eve­r­y­thing I nee­d. On the other han­d, it's fun to co­de wi­th.

So, if you are using ano­ther sta­tic si­te ge­ne­ra­to­r, or are re­sear­ching in­to it, or just ha­ve opi­nions about it... wha­t's mis­sin­g? What should it ha­ve that it does­n't ha­ve no­w?

No fea­tu­re too sma­ll, no idea too cra­z­y, plea­se sha­re! I pro­mi­se to make a good effort to im­ple­ment any that seem like a good idea :-)

New in Nikola Master: Interactive Console

Ins­pi­red by Djan­go­'s in­te­rac­ti­ve con­so­le, I added one to Niko­la, my sta­tic si­te ge­ne­ra­tor so that if you want to play wi­th its in­ter­nal­s, you can do it ea­si­l­y. He­re's an exam­ple ses­sio­n:

$ nikola init pepe
A new site with some sample data has been created at pepe.
See README.txt in that folder for more information.
$ cd pepe
$ nikola console
Scanning posts
.
.
done!
You can now access your configuration as conf and your site engine as SITE
>>> [p.title('en') for p in SITE.timeline]
[u'Listings Demo', u'Nikola: it generates static', u'Welcome to Nikola',
u'A reStructuredText Primer', u'A reStructuredText Reference', u'Sample
Nikola Config File', u'The Nikola Handbook', u'Theming Nikola']

Ha­ve fun!

Nikola Wordpress Importer Improvements

Thanks to ha­ving users tr­ying to ac­tua­lly im­port da­ta from wor­dpress, the wor­dpress im­por­ter plu­gin for Niko­la, my sta­tic si­te ge­ne­ra­tor got a cou­ple of new fea­tu­res.

  • It wi­­ll try to mai­n­­tain your URLs via re­­di­­re­c­­ts

    If your post was in /2012/1/2/a-­­po­s­­t/ and now it wi­­ll be in /po­s­­ts/a-­­po­s­­t.h­t­­ml it wi­­ll crea­­te a re­­di­­rect from the fo­r­­mer to the la­­tte­­r.

  • ur­­l_­­map for co­­­m­­ment mi­­gra­­tion

    It wi­­ll crea­­te a CSV fi­­le co­n­­tai­­ning the ol­­d,­­new fu­­ll URLs so that you can mo­­­ve your dis­­qus th­­rea­­ds to the ri­­ght pla­­ce­s.

Al­so, mas­ter wo­rks wi­th do­cu­tils 0.10 whi­ch bro­ke in the last re­lea­se.

For the­se rea­son­s, the­re wi­ll be a 5.0.1 re­lea­se to­day or to­mo­rro­w.

PS: if you want to see a few si­tes using Niko­la, now you can.


Contents © 2000-2023 Roberto Alsina