Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

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

Nikola 5.4.3 released!

I am th­ri­lled to an­noun­ce the re­lea­se of ver­sion 5.4.3 of Niko­la a sta­tic web­si­te/­blog ge­ne­ra­to­r.

The chan­ge­log is pre­tty lon­g, mo­re in­for­ma­tion at the an­noun­ce­ment

Ha­ve fun!

The Password Is Password (follow the link to see what I mean)

I think this is a first in the world of stat­ic site gen­er­a­tors :-)

Now Niko­la sup­ports pass­word-pro­tect­ed pages. How does it work?

If you add a pass­word meta­da­ta field, then it will "Just Work". Like this:

I think this is a first in the world of stat­ic site gen­er­a­tors :-) And the re­sult is what you are see­ing now.

How is it im­ple­ment­ed? Niko­la will en­crypt the con­tent us­ing RC4, then wrap it in a <di­v>, and tack a form at the end that trig­gers Javascript code to de­crypt it, and show it.

Is it se­cure? Well, I am not a cryp­tog­ra­pher, so as­sume no. Specif­i­cal­ly, while RC4 is con­sid­ered se­cure, I am not dis­card­ing the be­gin­ning of they keystream, and the im­ple­men­ta­tions I am us­ing are not au­dit­ed.

So, don't use this for any­thing that could get you in trou­ble. Have fun!

UP­DATE Re­mem­ber when I asked "Is it se­cure?" well, re­al­ly, no it's not. It's not stupid in the sense that de­cod­ing what's writ­ten in the post will re­quire at least a mod­icum of ef­fort by who­ev­er is so in­ter­est­ed in read­ing what you are post­ing in your site, but peo­ple with cryp­to chops will crack it like a WEP-se­cured AP, mm­mmkay? It's al­so stupid­ly easy to brute­force this, so be smart about pass­word­s.

OTO­H, it's more se­cure than HTTP sim­ple au­th, since you can't sniff it (not that sim­ple auth is se­cure) and it can hide a piece of the page, which us­ing server-based auth can't.

I may do a more se­cure ver­sion even­tu­al­ly, but this is not it. There­fore, use for fun stuff, not to hide im­por­tan­t/il­le­gal stuff.

Nikola Internals Doc

Ya que Niko­la, mi ge­ne­ra­dor de si­tio­s/­blogs es­tá­ti­cos re­ci­be bas­tan­te có­di­go de otro­s, me pa­re­ció que ya era ho­ra de em­pe­zar a do­cu­men­tar co­mo fun­cio­na por aden­tro. Así que acá es­tá Niko­la in­ter­nals aun­que to­da­vía le fal­ta un her­vo­r.

Migrating from Wordpress to Nikola

Se­ve­ral peo­ple ha­ve mi­gra­ted from Wor­dpress in­to Niko­la, and he­re are so­me of their des­crip­tions of the pro­ce­ss:

In ge­ne­ra­l, it see­ms to be wo­rkin­g, but the­re's so­me wo­rk sti­ll to be do­ne. Wor­dpress su­ppor­ts many di­ffe­rent plu­gins and ex­ten­sions whi­ch react to ma­rkup in their pa­ges, and su­ppor­ting tha­t's al­most an in­fi­ni­te ta­sk. Cu­rren­tly Niko­la's im­por­ter hand­les a few of the mo­re co­m­mo­n. But if you try to im­port your blog and get le­ss than ideal re­sul­ts, plea­se fi­le a bug and I'­ll do my best to fix it.

Usua­lly the fixes are ra­ther sim­ple, it's just that I ha­ve ne­ver seen that spe­ci­fic thing ;-)

Ha­ve fun!

Standalone Search in Nikola

This has been in the mas­ter bran­ch of Niko­la for a whi­le but on­ly now ha­ve I tried to fu­lly in­te­gra­te it, and po­lish all (mos­t) of the rou­gh edges.

By de­faul­t, Niko­la co­mes wi­th su­pport for sear­ch for­ms using Google and Du­ck­du­ck­go. So­me peo­ple di­sappro­ve of them for di­ffe­rent rea­sons [1] so the­re was a re­quest about su­ppor­ting a stan­da­lo­ne sear­ch en­gi­ne.

The best of breed of tho­se things see­ms to be Ti­pue so tha­t's what I su­pporte­d.

To use this, you need to ena­ble a plu­gi­n, and do so­me con­fi­gu­ra­tion chan­ges.

The plugin is called task_localsearch and you can find it in the Nikola source tree

Suppose your site is in a folder called mysite then to enable this plugin you need to create mysite/plugins and then copy task_localsearch.plugin and task_localsearch in there.

Then, in your site's conf.py find these options and change them accordingly:

SEARCH_FORM = """
<span class="navbar-form pull-left">
<input type="text" id="tipue_search_input">
</span>"""

ANALYTICS = """
<script type="text/javascript" src="/assets/js/tipuesearch_set.js"></script>
<script type="text/javascript" src="/assets/js/tipuesearch.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#tipue_search_input').tipuesearch({
        'mode': 'json',
        'contentLocation': '/assets/js/tipuesearch_content.json',
        'showUrl': false
    });
});
</script>
"""

EXTRA_HEAD_DATA = """
<link rel="stylesheet" type="text/css" href="/assets/css/tipuesearch.css">
<div id="tipue_search_content" style="margin-left: auto; margin-right: auto; padding: 20px;"></div>
"""

How does it wo­rk? He­re's a de­mo si­te for you to tr­y!

I would not re­co­m­mend doing this for a big si­te, sin­ce it may load a mul­ti-­me­ga­b­y­te ja­vas­cript fi­le when you sear­ch, but for sma­ll to me­dium si­tes, it may be ok.


Contents © 2000-2024 Roberto Alsina