Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Creating a Site (Not a Blog) with Nikola

One of the most fre­quent ques­tions I get about Niko­la is "but how do I crea­te a si­te tha­t's not a blo­g?". And of cour­se, tha­t's be­cau­se the do­cu­men­ta­tion is hea­vi­ly blo­g-o­rien­te­d. This do­cu­ment wi­ll chan­ge that ;-)

Sin­ce it starte­d, Niko­la has had the ca­pa­bi­li­ties to crea­te ge­ne­ric si­tes. For exam­ple, Niko­la's own si­te is a fair­ly ge­ne­ric one. Le­t's go step by step on how you can do so­me­thing like tha­t.

As usual when starting a nikola site, you start with nikola init which creates a empty semi-configured site:

$ nikola init mysite
Created empty site at mysite.

Then we go into the new mysite folder, and make the needed changes in the conf.py configuration file:

##############################################
# Configuration, please edit
##############################################


# Data about this site
BLOG_AUTHOR = "Roberto Alsina"
BLOG_TITLE = "Not a Blog"
# This is the main URL for your site. It will be used
# in a prominent link
SITE_URL = "http://notablog.ralsina.me"
BLOG_EMAIL = "ralsina@kde.org"
BLOG_DESCRIPTION = "This is a demo site (not a blog) for Nikola."

#
# Some things in the middle you don't really need to change...
#

post_pages = (
    ("pages/*.txt", "", "story.tmpl", False),
)

And now we are ready to crea­te our first pa­ge:

$ nikola new_post -p
Creating New Post
-----------------

Enter title: index
Your post's text is at:  pages/index.txt

We can now build and pre­view our si­te:

$ nikola build
Scanning posts.done!
.  render_site:output/categories/index.html
.  render_sources:output/index.txt
.  render_rss:output/rss.xml
:
:
: [Much more of the same]

$ nikola serve
Serving HTTP on 127.0.0.1 port 8000 ...

And you can see your (ve­ry emp­ty) si­te in http://­lo­calhos­t:8000

So, what's in that pages/index.txt file?

.. title: index
.. slug: index
.. date: 2013/03/01 10:26:17
.. tags:
.. link:
.. description:


Write your post here.

Title is the page title, slug is the name of the generated HTML file (in this case it would be index.html) the date doesn't matter much in not-blogs, same for tags and link. Description is useful for SEO purposes if you care for that.

And be­lo­w, the con­ten­t. By de­fault you are ex­pec­ted to use reS­truc­tu­red text but Niko­la su­ppor­ts a ton of for­ma­ts, in­clu­ding Ma­rk­do­wn, plain HT­M­L, BB­Co­de, Wiki, and Tex­ti­le.

So, le­t's gi­ve the pa­ge a ni­cer ti­tle, and so­me fake con­ten­t. Sin­ce the de­fault Niko­la the­me (ca­lled "si­te") is ba­sed on boots­trap you can use an­y­thing you like from it:

.. title: Welcome To The Fake Site
.. slug: index
.. date: 2013/03/01 10:26:17
.. tags:
.. link:
.. description: Fake Site version 1, welcome page!


.. class:: hero-unit span6

.. admonition:: This is a Fake Site

    It pretends to be about things, but is really just an example.
    So, don't click this button, it leads nowhere.

    .. class:: btn

    Click Me!


.. class:: span5

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris non nunc turpis.
Phasellus a ullamcorper leo. Sed fringilla dapibus orci eu ornare. Quisque
gravida quam a mi dignissim consequat. Morbi sed iaculis mi. Vivamus ultrices
mattis euismod. Mauris aliquet magna eget mauris volutpat a egestas leo rhoncus.
In hac habitasse platea dictumst. Ut sed mi arcu. Nullam id massa eu orci
convallis accumsan. Nunc faucibus sodales justo ac ornare. In eu congue eros.
Pellentesque iaculis risus urna. Proin est lorem, scelerisque non elementum at,
semper vel velit. Phasellus consectetur orci vel tortor tempus imperdiet. Class
aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos.

[And more in the same vein]

And that's it. You will want to change the SIDEBAR_LINKS option to create a reasonable "menu" for your site, you will want to hack the theme (check nikola help bootswatch_theme for a quick & dirty solution), and you may want to add a blog later on, for company news or whatever.

You can see the fi­nis­hed si­te in http://­no­ta­blo­g.­ral­si­na.­me and its fu­ll con­fi­gu­ra­tion in //­ral­si­na.­me/­lis­tings/­no­ta­blo­g/­con­f.­p­y.ht­ml

I ho­pe this was hel­pfu­l!

Constellation Games

Cover for Constellation Games

Review:

Re­mind­ed me of Year Ze­ro, which is a very good thing.

Very in­ter­est­ing point of view about a first con­tac­t, even if it's of course, in may ways, a trans­par­ent nerd self­-re­al­iza­tion fan­ta­sy.

Spe­cial­ly loved the at­tempts at de­scrib­ing games just on the edge of in­com­pre­hen­si­bil­i­ty. If they were made less un­der­stand­able, there's no plot. If they were more hu­man, then it's not fun.

Go­ing to read the ex­tra free con­tent avail­able at the book's site.

Load Testing Nikola

Niko­la ge­ne­ra­tes sta­tic si­tes, so load tes­ting it is not ve­ry in­te­res­tin­g, ex­cept as a ben­ch­ma­rk for the di­ffe­ren­ce be­tween sta­tic and dy­na­mic si­tes.

To­day I was told about bli­tz.io and sin­ce a qui­ck test is free, I thou­gh­t, why no­t? The re­sult is qui­te im­pres­si­ve: a cheap VP­S, using ga­tling as a web ser­ve­r, whi­ch is al­most con­fi­gu­ra­tio­n-­free and not meant for ex­tre­me­ly hi­gh load­s, can hand­le rou­gh­ly 9 mi­llion dai­ly hi­ts.

Let me say that agai­n: 9 mi­llion hi­ts. On a un­con­fi­gu­red $5 ser­ve­r. He­re's the re­port

How mu­ch tu­ning does it take for a wor­dpress ins­tan­ce to ser­ve tha­t? On what har­dwa­re?

And tha­t's on­ly half the pic­tu­re. Not on­ly are Niko­la's sta­tic pa­ges in­cre­di­bly li­ght on your ser­ve­r, we ha­ve al­so spent a lot of effort tr­ying to make in­di­vi­dual pa­ges load fas­t, for a be­tter user ex­pe­rien­ce. So­me of the te­ch­ni­ques us­ed for fas­t-­loading si­tes are:

  • Using we­­ba­sse­­ts to bun­d­­le CSS and JS in­­to si­n­­gle fi­­le­s.

  • Au­­to­­­ma­­tic su­­pport for CD­Ns for the co­­­m­­mon JS li­­bra­­ries

  • Su­­pport for tran­s­­pa­­ren­­tly using HT­­M­­L/­­CSS/­­JS/I­­ma­­ge co­m­­pres­­sion tools

So, if you try so­me­thing like YS­lo­w! on a Niko­la si­te, it wi­ll gi­ve you a sco­re of rou­gh­ly 93 up to 98 (out of 100) de­pen­ding on your web­ser­ver con­fi­gu­ra­tio­n.

BTW: I rea­lly want to get that up to 100. Rea­lly want it

So, re­mem­be­r, if your si­te can be ser­ved sta­ti­ca­ll­y, it's going to be chea­pe­r, fas­te­r, safe­r. And if you ever get 9 mi­llion hi­ts a da­y, it wi­ll be avai­la­ble.

Disclaimer:

Bli­tz.io is sen­ding me a t-s­hirt ;-)

Captain Vorpatril's Alliance (Vorkosigan Saga, #15)

Cover for Captain Vorpatril's Alliance (Vorkosigan Saga, #15)

Review:

Re­mem­ber when the Vorkosi­gan books were about some­one hav­ing an ad­ven­ture, and char­ac­ters do­ing in­ter­est­ing things?

Well, that was then. Now these books tend to be more about the char­ac­ters re­mem­ber­ing pre­vi­ous ad­ven­tures, and run­ning in­to char­ac­ters that did in­ter­est­ing things in oth­er book­s.

Fi­nal­ly around the 60% mark, a sort of plot is put in mo­tion, and some things hap­pen. But the stakes seem low, the risk seems lit­tle.

I adore the Vorkosi­gan se­ries, but this book is not good.

Colón Al Colón

Spa­nish on­l­y, so­rr­y!


Un lu­gar co­mún en la char­la po­lí­ti­ca ar­gen­ti­na es "se gas­tan la pla­ta en Fú­tbol pa­ra To­dos en vez de co­sas im­por­tan­tes". Siem­pre me hi­zo un po­co de rui­do, a ver si me sa­le ex­pli­car por qué.

Pa­ra em­pe­zar par­te de una je­rar­quía de prio­ri­da­des, hay co­sas más im­por­tan­tes que otra­s, y una de ella­s, el fú­tbo­l, es me­nos im­por­tan­te que al­gu­na, y por lo tan­to no ha­bría que gas­tar di­ne­ro en ella. Eso es un ar­gu­men­to de ca­li­dad du­do­sa, ya que no se gas­ta di­ne­ro úni­ca­men­te en la co­sa más im­por­tan­te.

Ima­gi­ná­te que en tu ca­sa se lle­ga a un con­sen­so, y de­ci­den que la co­sa más im­por­tan­te es la co­mi­da, y a con­ti­nua­ción gas­tan el 100% de to­dos los suel­dos en co­mi­da. Eso pa­re­ce ra­zo­na­ble? No. Las prio­ri­da­des de­fi­nen en qué se gas­ta más o me­nos y en al­gún ca­so si hay que cor­tar al­go se cor­ta­rá lo me­nos im­por­tan­te, pe­ro "A es más im­por­tan­te que B" no es, a prio­ri, mo­ti­vo pa­ra no gas­tar na­da en B.

Lo que sí se­ría mo­ti­vo pa­ra no gas­tar na­da en fú­tbol se­ría que pro­vo­ca­ra un da­ño. Por ejem­plo, a mí me gus­ta­ría que el go­bierno no gas­ta­ra un pe­so en ejérci­to, por­que no veo que sir­va pa­ra na­da, e his­tó­ri­ca­men­te (di­ga­mos los úl­ti­mos cien año­s) el ejérci­to ar­gen­tino y sus ale­da­ños han si­do cla­ra­men­te un fac­tor ne­ga­ti­vo en la vi­da de la na­ció­n, des­de bom­bar­dear Bue­nos Ai­res, a in­va­dir Mal­vi­na­s, de­rro­car go­bier­no­s, etc. Aún si so­s, po­né­le, an­ti­pe­ro­nis­ta, y creés que Pe­rón es la cau­sa de to­dos los ma­le­s... bue­no, el vie­ne del ejérci­to.

Pe­ro no creo que el fú­tbol sea al­go ma­lo en sí mis­mo. No es co­mo si es­tu­vie­ran gas­tan­do la gui­ta en pe­tar­do­s. En­ton­ce­s, com­pa­ré­mos­lo con al­go si­mi­la­r. Com­pa­ré­mos a Co­lón (de San­ta Fe) con el Co­ló­n.

En el fon­do, tan­to el fú­tbol (y Co­ló­n) co­mo el Co­ló­n, son en­tre­te­ni­mien­to. Son cir­co. Los pre­su­pues­tos son com­pa­ra­bles (den­tro de un or­den de mag­ni­tu­d, o sea, no es que el fú­tbol cues­ta cien ve­ces má­s). Si bien el ori­gen de los fon­dos es dis­tin­to, pa­ra es­te aná­li­sis no ha­ce di­fe­ren­cia, es pla­ta pú­bli­ca, pla­ta de im­pues­to­s.

¿Qué nos dá el Co­ló­n, que no nos dá Co­ló­n? Nos dá ópe­ra y ba­lle­t. For­mas ar­tís­ti­cas que al 93% (por­cen­ta­je in­ven­ta­do) no les mue­ve un pe­lo. Co­lón (no el co­ló­n) nos dá fú­tbo­l, apre­cia­do por un por­cen­ta­je mu­cho ma­yor de la po­bla­ció­n.

El Co­lón nos da, di­je, esas for­mas ar­tís­ti­ca­s, apre­cia­das en gran par­te por gen­te que, sea­mos sin­ce­ro­s, po­dría pa­gar por ella­s. Sí, hay una canti­dad de gen­te de cla­se me­dia y ba­ja que va al Co­ló­n. Tam­bién hay un mon­tón de oli­gar­cas que van a ver es­pec­tá­cu­los pa­ga­dos por los im­pues­tos de gen­te a la que no le in­te­re­sa en lo más mí­ni­mo pa­gar por ello­s. El Co­lón sub­ven­cio­na el en­tre­te­ni­mien­to de los ri­co­s.

Sí, tam­bién es cier­to que Co­lón (el equi­po) pro­vee fú­tbo­l, que mu­cha gen­te (yo in­cluí­do) no tie­ne nin­gún in­te­rés en ver (es­pe­cial­men­te a Co­ló­n), pe­ro ca­da fin de se­ma­na más gen­te apre­cia un par­ti­do del Sa­ba­le­ro que la au­dien­cia de me­dia tem­po­ra­da de líri­ca.

¿En­ton­ce­s, si uno hi­cie­ra un cál­cu­lo uti­li­ta­rio, por qué ha­bría que pa­gar por el Co­lón pa­ra po­cos y no por Co­ló­n, pa­ra mu­cho­s? ¿Por qué na­die pi­de que cie­rren el Co­ló­n?

¿No hay una hi­po­cresía ahí? ¿No hay un jui­cio de que el Co­lón es cul­tu­ra mien­tras que el fú­tbol no lo es? ¿Es ése en rea­li­dad el ar­gu­men­to?

Yo, per­so­nal­men­te, nun­ca fuí a ver un es­pec­tá­cu­lo al Co­ló­n, igual que nun­ca fuí a ver a Co­lón (de­bo ha­ber ido a ver a Unión 8 ve­ces en 30 año­s, con la con­si­guien­te de­si­lu­sión pa­ter­na), pe­ro sé que hay gen­te que apre­cia ca­da una de esas co­sas, y sé que el "pro­ble­ma" de no apre­ciar­las es mío. No de ello­s. No es­tá mal que les gus­te la líri­ca, o el ba­lle­t, o el Tor­neo Clau­su­ra.

Y no es­tá mal que un go­bierno le dé a la gen­te al­go que les gus­te. No es­tá mal que el Co­lón le dé a los por­te­ños mo­ti­vo de or­gu­llo por­que tie­nen ese tea­tro ahí, y a al­gu­nos el pla­cer de ir a ver una fun­ció­n. No es­tá mal que Co­lón le dé a los sa­ba­le­ros mo­ti­vo de or­gu­llo por­que es­tán en pri­me­ra, y el pla­cer de ir a ver un par­ti­do. Y no es­tá mal que un go­bierno pon­ga pla­ta pa­ra eso.

Aun­que eso no sea tan im­por­tan­te co­mo el Ga­rra­han, o co­mo re­pa­vi­men­tar una ru­ta, o co­mo pa­gar un po­li­cía. Por lo me­nos no la es­tán gas­tan­do en el ejérci­to.

Aclaración

Ya que veo por co­men­ta­rios en dis­tin­tos lu­ga­res que no se en­tien­de del to­do, acla­ro un po­qui­to. Me la fu­ma en pi­pa el FP­T, y me la fu­ma en pi­pa el Co­ló­n. Li­te­ral­men­te, si los dos des­apa­re­cie­ran ma­ña­na, no me da­ría cuen­ta. Lo úni­co que es­te ar­tícu­lo es, es un in­ten­to de jun­tar y contras­tar dos co­sas dis­tin­tas y mos­trar el pa­re­ci­do, pa­ra ver si se pue­de pen­sar en ellas de una ma­ne­ra dis­tin­ta.

Hay una lar­ga tra­di­ción de usar es­te re­cur­so cuan­do se es­cri­be un en­sa­yo. No es ori­gi­nal en lo más mí­ni­mo. Es di­ver­ti­do ver la gen­te con es­pu­ma en la bo­ca por­que oso es­bo­zar una de­fen­sa (¡­ni si­quie­ra!) del gas­to en FP­T. Pien­sen que tran­qui­la­men­te po­drían ver es­te mis­mo ar­ti­cu­lo co­mo un ata­que contra el gas­to en el Co­lón y de­más cul­tu­ra pre­ten­cio­sa y eli­tis­ta. Di­ver­ti­do, pe­ro no es­ti­mu­lan­te. Por eso es­ta acla­ra­ció­n.


Contents © 2000-2024 Roberto Alsina