Add new option for controlling whether to display categories on menu or not

Conflicts:
	docs/changelog.rst
	pelican/tests/output/basic/tag/bar.html
	pelican/tests/output/basic/tag/baz.html
	pelican/tests/output/basic/tag/foo.html
	pelican/tests/output/custom/tag/bar.html
	pelican/tests/output/custom/tag/baz.html
	pelican/tests/output/custom/tag/foo.html
This commit is contained in:
David Beitey 2013-04-01 21:52:30 +10:00
commit e042e11c23
66 changed files with 136 additions and 126 deletions

View file

@ -7,6 +7,8 @@ Release history
* Support for Python 3! * Support for Python 3!
* Ensure exceptions are raised if they take place during processing * Ensure exceptions are raised if they take place during processing
with autoreload enabled with debug enabled. with autoreload enabled with debug enabled.
* Provide ability to show or hide categories from menu using
``DISPLAY_CATEGORIES_ON_MENU`` option.
3.1 (2012-12-04) 3.1 (2012-12-04)
================ ================

View file

@ -42,6 +42,9 @@ Setting name (default value) What doe
`DISPLAY_PAGES_ON_MENU` (``True``) Whether to display pages on the menu of the `DISPLAY_PAGES_ON_MENU` (``True``) Whether to display pages on the menu of the
template. Templates may or may not honor this template. Templates may or may not honor this
setting. setting.
`DISPLAY_CATEGORIES_ON_MENU` (``True``) Whether to display categories on the menu of the
template. Templates may or not honor this
setting.
`DEFAULT_DATE` (``None``) The default date you want to use. `DEFAULT_DATE` (``None``) The default date you want to use.
If ``fs``, Pelican will use the file system If ``fs``, Pelican will use the file system
timestamp information (mtime) if it can't get timestamp information (mtime) if it can't get

View file

@ -35,6 +35,7 @@ _DEFAULT_CONFIG = {'PATH': os.curdir,
'SITEURL': '', 'SITEURL': '',
'SITENAME': 'A Pelican Blog', 'SITENAME': 'A Pelican Blog',
'DISPLAY_PAGES_ON_MENU': True, 'DISPLAY_PAGES_ON_MENU': True,
'DISPLAY_CATEGORIES_ON_MENU': True,
'PDF_GENERATOR': False, 'PDF_GENERATOR': False,
'OUTPUT_SOURCES': False, 'OUTPUT_SOURCES': False,
'OUTPUT_SOURCES_EXTENSION': '.text', 'OUTPUT_SOURCES_EXTENSION': '.text',

View file

@ -31,14 +31,16 @@
{% for title, link in MENUITEMS %} {% for title, link in MENUITEMS %}
<li><a href="{{ link }}">{{ title }}</a></li> <li><a href="{{ link }}">{{ title }}</a></li>
{% endfor %} {% endfor %}
{% if DISPLAY_PAGES_ON_MENU %} {% if DISPLAY_PAGES_ON_MENU -%}
{% for page in PAGES %} {% for page in PAGES %}
<li><a href="{{ SITEURL }}/{{ page.url }}">{{ page.title }}</a></li> <li><a href="{{ SITEURL }}/{{ page.url }}">{{ page.title }}</a></li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if DISPLAY_CATEGORIES_ON_MENU -%}
{% for cat, null in categories %} {% for cat, null in categories %}
<li {% if cat == category %}class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li> <li {% if cat == category %}class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li>
{% endfor %} {% endfor %}
{% endif %}
</ul></nav> </ul></nav>
</header><!-- /#banner --> </header><!-- /#banner -->
{% block content %} {% block content %}

View file

@ -44,10 +44,12 @@
<li{% if p == page %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ p.url }}">{{ p.title }}</a></li> <li{% if p == page %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ p.url }}">{{ p.title }}</a></li>
{% endfor %} {% endfor %}
{% else %} {% else %}
{% if DISPLAY_CATEGORIES_ON_MENU %}
{% for cat, null in categories %} {% for cat, null in categories %}
<li{% if cat == category %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li> <li{% if cat == category %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %}
</ul></nav><!-- /#menu --> </ul></nav><!-- /#menu -->
{% block content %} {% block content %}
{% endblock %} {% endblock %}