I managed to do some minor work today on Nikola, the static website generator used to
generate ... well, this static website.
* Implemented tags (including per-tag RSS feeds)
* Simplified templates
* Separated code and configuration.
The last one was the trickiest. And as a teaser, here is the *full* configuration
file to create this site, except HTML bits for analytics, google custom search
and whatever that would make no sense on other sites. I hope it's somewhat clear.
.. code-block:: python
# -*- coding: utf-8 -*-
# post_pages contains (wildcard, destination, template) tuples.
#
# The wildcard is used to generate a list of reSt source files (whatever/thing.txt)
# That fragment must have an associated metadata file (whatever/thing.meta),
# and opcionally translated files (example for spanish, with code "es"):
# whatever/thing.txt.es and whatever/thing.meta.es
#
# From those files, a set of HTML fragment files will be generated:
# whatever/thing.html (and maybe whatever/thing.html.es)
#
# These files are combinated with the template to produce rendered
# pages, which will be placed at
# output / TRANSLATIONS[lang] / destination / pagename.html
#
# where "pagename" is specified in the metadata file.
#
post_pages = (
("posts/*.txt", "weblog/posts", "post.tmpl"),
("stories/*.txt", "stories", "post.tmpl"),
)
# What is the default language?
DEFAULT_LANG = "en"
# What languages do you have?
# If a specific post is not translated to a language, then the version
# in the default language will be shown instead.
# The format is {"translationcode" : "path/to/translation" }
# the path will be used as a prefix for the generated pages location
TRANSLATIONS = {
"en": "",
"es": "tr/es",
}
# Data about this site
BLOG_TITLE = "Lateral Opinion"
BLOG_URL = "http://lateral.netmanagers.com.ar"
BLOG_EMAIL = "ralsina@kde.org"
BLOG_DESCRIPTION = "I write free software. I have an opinion on almost "\
"everything. I write quickly. A weblog was inevitable."
# Paths for different autogenerated bits. These are combined with the translation
# paths.
# Final locations are:
# output / TRANSLATION[lang] / TAG_PATH / index.html (list of tags)
# output / TRANSLATION[lang] / TAG_PATH / tag.html (list of posts for a tag)
# output / TRANSLATION[lang] / TAG_PATH / tag.xml (RSS feed for a tag)
TAG_PATH = "categories"
# Final location is output / TRANSLATION[lang] / INDEX_PATH / index-*.html
INDEX_PATH = "weblog"
# Final locations for the archives are:
# output / TRANSLATION[lang] / ARCHIVE_PATH / archive.html
# output / TRANSLATION[lang] / ARCHIVE_PATH / YEAR / index.html
ARCHIVE_PATH = "weblog"
# Final locations are:
# output / TRANSLATION[lang] / RSS_PATH / rss.xml
RSS_PATH = "weblog"
# A HTML fragment describing the license, for the sidebar.
LICENSE = """
"""
# A search form to search this site, for the sidebar. Has to be a