From 9c5708cc92af894e414bc76ee35ec2230de5d288 Mon Sep 17 00:00:00 2001 From: Agustin Henze Date: Wed, 2 Jan 2013 08:35:03 -0300 Subject: Imported Upstream version 5.1 --- docs/theming.txt | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'docs/theming.txt') diff --git a/docs/theming.txt b/docs/theming.txt index 93c7824..33884e9 100644 --- a/docs/theming.txt +++ b/docs/theming.txt @@ -8,6 +8,9 @@ Theming Nikola .. contents:: +This document is a reference about themes. If you want a tutorial, please read +`Creating a Theme `_ + The Structure ------------- @@ -69,20 +72,15 @@ bundles Templates should use either the bundle or the individual files based on the ``use_bundles`` variable, which in turn is set by the ``USE_BUNDLES`` option. -Creating a New Theme --------------------- - -In your site's folder, create a ``themes`` folder. Choose a theme to start from, and -create ``themes/yourthemename/parent`` as a file containing the parent theme's name. -There, you just created a new theme. Of course it looks exactly like the other one, -so let's customize it. - Templates --------- In templates there is a number of files whose name ends in ``.tmpl``. Those are the theme's page templates. They are done usig the `Mako `_ -template language. If you want to do a theme, you should learn the Mako syntax first. +or `Jinja2 `_ template languages. If you want to do a theme, you +should learn one first. What engine is used by the theme is declared in the ``engine`` file. + +The rest of this document explains Mako templates, but Jinja2 is fairly similar. Mako has a nifty concept of template inheritance. That means that, a template can inherit from another and only change small bits of the output. For example, @@ -183,6 +181,13 @@ list.tmpl * ``items``: a list of (text, link) elements. + +list_post.tmpl + Template used to display generic lists of links. Can use everything ``base.tmpl`` uses, plus: + + * ``posts``: a list of Post objects. + + You can add other templates for specific pages, which the user can the use in his ``post_pages`` option in ``dodo.py``. Also, keep in mind that your theme is yours, there is no reason why you would need to maintain the inheritance as it is, or not require whatever data you want. -- cgit v1.2.3