From e045515b91dc8c0b56c32f92aa9ba3bfc4e272cf Mon Sep 17 00:00:00 2001 From: William Light Date: Fri, 11 Jan 2013 01:01:31 +0100 Subject: [PATCH] add "output_file" Jinja context variable "output_file" contains the name of the HTML file that pelican is currently rendering. --- docs/themes.rst | 3 +++ pelican/writers.py | 1 + 2 files changed, 4 insertions(+) diff --git a/docs/themes.rst b/docs/themes.rst index 19fd9274..95af399a 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -54,6 +54,9 @@ All of these settings will be available to all templates. ============= =================================================== Variable Description ============= =================================================== +output_file The name of the file currently being generated. For + instance, when Pelican is rendering the homepage, + output_file will be "index.html". articles The list of articles, ordered descending by date All the elements are `Article` objects, so you can access their attributes (e.g. title, summary, author diff --git a/pelican/writers.py b/pelican/writers.py index 43b95062..8e611556 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -129,6 +129,7 @@ class Writer(object): context['localsiteurl'] = relative_path localcontext['SITEURL'] = relative_path + localcontext['output_file'] = name localcontext.update(kwargs) # check paginated