This is the list of variables that are available to your templates. Additionally, plugins that you are using will add additional variables. To get a complete list of what variables are available in your blog, use the debug renderer by changing the renderer property in your config.py file to debug like this:
py["renderer"] = "debug"
That will tell you all kinds of stuff about the data structures involved in the request. Don't forget to change it back when you're done!
PyBlosxom 1.3 allows you to escape and URL encode any variables by adding "_escaped" or "_urlencoded" to the end of the variable name.
title_escaped is an escaped form of
the title with ' (single-quote) replaced with ' and " (double-quote)
replaced with ".
title_urlencoded is a URL encoded form of the title
which uses the Python urllib.
These template variables are available to all templates. They come directly from your config.py file.
Table 4-1. Template variables from config.py
|blog_description||the description of the blog||blosxom with a touch of python|
|blog_title||the title of the blog||RoughingIT - pyblosxom : /weblogs/tools/pyblosxom|
|blog_language||the language of the blog||en|
|blog_encoding||the encoding of the blog||iso8859-1|
|blog_author||the author of the blog (hopefully you)||Joe Dirt|
|blog_email||the email address of the author of the blog (feel free to obfuscate it)||joe at joe dot com|
Additionally, any other properties you set in config.py
are available in your templates. If you wanted to create a
blog_images variable holding the base url of the directory
with all your images:
Example 4-2. creating your own config.py variables
py["blog_images"] = "http://www.joe.com/~joe/images/"
to your config.py file and it would be available in all your templates.
These template variables are available to all templates as well. They are calculated based on the request.
Table 4-2. Calculated template variables
|content_type||the content type of this page||text/html|
|root_datadir||the root datadir of this page?||/home/subtle/blosxom/weblogs/tools/pyblosxom|
|url||the PATH_INFO to this page||pyblosxom/weblogs/tools/pyblosxom|
|flavour||the flavour for this page||html|
|latest_date||the date of the most recent entry that is going to show||Tue, 15 Nov 2005|
|latest_w3cdate||the date of the most recent entry that is going to show in w3cdate format||2005-11-13T17:50:02Z|
|latest_rfc822date||the date of the most recent entry that is going to show in RFC 822 format||Sun, 13 Nov 2005 17:50 GMT|
|pi_yr||the four-digit year the user requested||2002|
|pi_mo||the month name the user requested||Sep|
|pi_da||the day number the user requested||15|
|pi_bl||the entry the user requested to see||weblogs/tools/pyblosxom|
|pyblosxom_version||the version number and release date of the pyblosxom version you're using||1.2 3/25/2005|
These template variables are only available in your story template.
Table 4-3. Variables in the story template
|title||title of the entry||First Post!|
|filename||template file name and path of the entry||/home/subtle/blosxom/weblogs/tools/pyblosxom/index.txt|
|file_path||just the filename and extensions of the entry||index.txt|
|fn||just the filename (no extension)||index|
|absolute_path||the category/path of the entry||weblogs/tools/pyblosxom|
|body||the text of the entry||first post!|
|tb_id||the trackback id of the entry||_index|
|path||the category/path of the entry||weblogs/tools/pyblosxom|
|yr||the four digit year of the mtime of this entry||2004|
|mo||the month abbreviation of the mtime of this entry||Jan|
|mo_num||the month number of the mtime of this entry||01|
|ti||the hour and minute of the mtime of this entry||16:40|
|date||the date string of the mtime of this entry||Sun, 23 May 2004|
|w3cdate||the date in w3cdate format||2005-11-13T17:50:02Z|
|rfc822date||the date in RFC 822 format||Sun, 13 Nov 2005 17:50 GMT|
|fulltime||the date in YYYYMMDDHHMMSS format||20040523164000|
|timetuple||the time tuple (year, month, month-day, hour, minute, second, week-day, year-day, isdst)||(2004, 5, 23, 16, 40, 0, 6, 144, 1)|
|mtime||seconds since the epoch||1085348400.0|
|dw||the day of the week||Sunday|
|da||the day of the month||23|
Additionally, many plugins will create additional variables. Refer to the plugin's documentation for what variables it creates, where the variables are available, and what the variables do.