From ec5c77b25145f7c20fee24c6b85b478295dbc956 Mon Sep 17 00:00:00 2001 From: derwinlu Date: Thu, 18 Jun 2015 23:33:20 +0200 Subject: [PATCH] remove PAGES; use pages instead * remove PAGES from context as pages is available * add section to FAQ to provide guidance --- docs/faq.rst | 13 +++++++++++++ docs/themes.rst | 2 ++ pelican/generators.py | 1 - pelican/themes/notmyidea/templates/base.html | 2 +- pelican/themes/simple/templates/base.html | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index ff473624..08df017d 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -250,3 +250,16 @@ moved out of the pelican core and into a separate `plugin `_. See the :ref:`plugins` documentation further information about the Pelican plugin system. + +Since I upgraded Pelican my Pages are no longer rendered +======================================================== +Pages were available to Themes as lowercase ``pages`` and uppercase +``PAGES``. To bring this inline with the :ref:`templates-variables` section, +``PAGES`` has been removed. This is quickly resolved by updating your theme +to iterate over ``pages`` instead of ``PAGES``. Just replace:: + + {% for pg in PAGES %} + +with something like:: + + {% for pg in pages %} diff --git a/docs/themes.rst b/docs/themes.rst index 6ca753c6..3978e693 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -47,6 +47,8 @@ To make your own theme, you must follow the following structure:: if it helps you keep things organized while creating your theme. +.. _templates-variables: + Templates and variables ======================= diff --git a/pelican/generators.py b/pelican/generators.py index 0a5298e4..da651252 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -644,7 +644,6 @@ class PagesGenerator(CachingGenerator): process_translations(hidden_pages)) self._update_context(('pages', 'hidden_pages')) - self.context['PAGES'] = self.pages self.save_cache() self.readers.save_cache() diff --git a/pelican/themes/notmyidea/templates/base.html b/pelican/themes/notmyidea/templates/base.html index 45ab4044..188715d4 100644 --- a/pelican/themes/notmyidea/templates/base.html +++ b/pelican/themes/notmyidea/templates/base.html @@ -25,7 +25,7 @@
  • {{ title }}
  • {% endfor %} {% if DISPLAY_PAGES_ON_MENU -%} - {% for pg in PAGES %} + {% for pg in pages %} {{ pg.title }} {% endfor %} {% endif %} diff --git a/pelican/themes/simple/templates/base.html b/pelican/themes/simple/templates/base.html index bde7983b..760ca5da 100644 --- a/pelican/themes/simple/templates/base.html +++ b/pelican/themes/simple/templates/base.html @@ -40,7 +40,7 @@
  • {{ title }}
  • {% endfor %} {% if DISPLAY_PAGES_ON_MENU %} - {% for p in PAGES %} + {% for p in pages %} {{ p.title }} {% endfor %} {% else %}