# ¿Quién vigila a los vigilantes?

Spanish only post. You can read it here

# Creating a Site (Not a Blog) with Nikola

One of the most frequent questions I get about Nikola is "but how do I create a site that's not a blog?". And of course, that's because the documentation is heavily blog-oriented. This document will change that ;-)

Since it started, Nikola has had the capabilities to create generic sites. For example, Nikola's own site is a fairly generic one. Let's go step by step on how you can do something like that.

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 = "[email protected]" 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 create our first page: $ nikola new_post -p
Creating New Post
-----------------

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


Note

The -p option in the nikola new_post command means we are creating a page and not a blog post.

We can now build and preview our site:

$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 (very empty) site in http://localhost:8000

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

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



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 below, the content. By default you are expected to use reStructured text but Nikola supports a ton of formats, including Markdown, plain HTML, BBCode, Wiki, and Textile.

So, let's give the page a nicer title, and some fake content. Since the default Nikola theme (called "site") is based on bootstrap you can use anything you like from it:

.. title: Welcome To The Fake Site
.. slug: index
.. date: 2013/03/01 10:26:17
.. tags:
.. 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]


TIP: Nice URLs

If you like your URLs without the ".html" then you want to create folders and put the pages in index.html inside them. Example:

nikola new_post -p pages/foo/index.txt


which will create a page you could access as "http://yoursite.com/foo"

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.

TIP: So, how do I add a blog now?

First, change the post_pages option like this:

post_pages = (
("pages/*.txt", "", "story.tmpl", False),
("posts/*.txt", "blog", "post.tmpl", True),
)


And to avoid a conflict (because blogs try to generate /index.html:

INDEX_PATH = "blog"


Create a post with nikola new_post and that's it, you now have a blog in http://yoursite.com/blog (you may want to add links to it in SIDEBAR_LINKS of course).

You can see the finished site in http://notablog.ralsina.me and its full configuration in //ralsina.me/listings/notablog/conf.py.html

## 2013-02-25 17:34

Nikola generates static sites, so load testing it is not very interesting, except as a benchmark for the difference between static and dynamic sites.

Today I was told about blitz.io and since a quick test is free, I thought, why not? The result is quite impressive: a cheap VPS, using gatling as a web server, which is almost configuration-free and not meant for extremely high loads, can handle roughly 9 million daily hits.

## 2013-02-10 17:54

I have had a Kindle Paperwhite (with ads) for a month. I was a big fan of my previous kindles, specially the 4th-gen non-touch one. I preferred it to the Kindle Touch because it was lighter, the bezel was shallower, and it had dedicated page-flipping buttons.

So, why did I get a Paperwhite instead of the cheaper 4th gen after I sold my Touch? Because of the darkness.

Reading is an enjoyable activity, and I read almost anywhere, in the supermarket queue, while having breakfast, while on the train, and in bed. But in bed, the older Kindles required me to turn on the light, like a caveman.

Of course, I could read in my cellphone (small) or in a tablet (heavier!) or in a book (again, lights, caveman!) So, this was the logical choice.

It still doesn't have the buttons, and it still has a touchscreen which makes little sense in a Kindle (except for the keyboard) and the bezel is intermediate. But the lighting is glorious. Sure, it's uneven at the bottom. So is the lighting in a paper book while in bed (check it out). But it's not all that heavy (even with the fancy cover), and it has a similarly glorious battey life.

The cover is really great. It feels like leather/rubber, it's solid, has a deadgrip on the device, and it turns on/off when you flip it open/closed, so you don't have to hunt for the tiny button at the bottom.

The font selection is a welcome improvement, although none compares well to the default.

Also, WTF happened to the audio? Why is it gone?

So my ideal Kindle that will never exist would be: a 4th gen with frontlight and smart cover. A man can always dream.

# Nikola 5.2 released!

I am thrilled to announce that you can now download Nikola 5.2. a new version of my static blog/site generator.

What's new in this version? A LOT. Don't let the minor version tick fool you, this version is packed with goodness. Let's start with features:

You can easily embed more content:

• New vimeo directive for restructured text.
• Custom "gist" directive providing reStructured text support for GitHub gists.

You can write your content in almost any markup:

• Textile markup support.
• Creole Wiki markup support.
• txt2tags markup support.
• bbcode markup support.
• And of course, it still supports reStructured text, Markdown and HTML.

More languages:

• New Catalá translation
• New polish translation.
• New Simplified Chinese translation.
• Use multilingual Disqus (although it doesn't seem to work)

• New Blogger/Blogspot importer
• Much improved Wordpress importer
• Extract metadata from filename by using regexp (helpful for importing from octopress or other systems).

You can do fancier and more configurable sites:

• Recursive post/story folders
• Local search based on Tipue (extra_plugins/task_localsearch)
• New STORY_INDEX option to generate index.html in story folders.
• Add multi size favicon support.

You can use Python 2.6 or higher ... including Python 3. The only missing bit for full Python 3 support is Google sitemap generation.

And of course, a lot of bugs got smashed:

• Added sane defaults for most options, so you can have a lean config file.
• Made layout of the site theme responsive, with collapsing navbar.
• Updated disqus integration code, added identifiers so it works on any URL.
• Make sure folder links end in "/" in the gallery code.
• Detect "namespace" dependencies for Mako templates.
• Use consistent encodings in RSS feeds.
• Refactored disqus code into separate helpers
• Use the correct extension (or raise an error) on new_post
• Fix titles that include quotes
• Updated to current CSS from docutils (was using version from 2005)
• Avoid needless regeneration of gallery indexes.
• Always ensure the folder for the new post exists.
• Get title from filename if not available in metadata.
• Don't copy sources if they end in ".html"
• Don't link to unexisting translations.
• Sort tags case insensitive.

Enjoy!