1
0
Fork 0
forked from github/pelican

Fixes #1068, #1572: template page navigation bugs

Updates the template logic for when page navigation is included in the
generated HTML in the notmyidea theme, fixing:

* Issue #1068: useless pagination controls should not be displayed when a
  single page is generated (i.e. "Page 1/1"). New logic prevents the
  generation of these superfluous page navigation controls. Tests updated
  accordingly.

* Issue #1572: when multiple pages are generated and the last page contains
  only one item, the closing </ol> and </section> tags are not generated,
  resulting in page breakage. We need to check if
  articles_page.has_other_pages(); if it does, a list has been generated per
  line 19 or 25 and the tags must be closed.
This commit is contained in:
Elana Hashman 2015-06-20 20:47:37 -06:00
commit 22bc56ddf1
17 changed files with 4 additions and 57 deletions

View file

@ -11,9 +11,6 @@
<h1 class="entry-title"><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></h1>
{% include 'article_infos.html' %}{{ article.content }}{% include 'comments.html' %}
</article>
{% if loop.length == 1 %}
{% include 'pagination.html' %}
{% endif %}
</aside><!-- /#featured -->
{% if loop.length > 1 %}
<section id="content" class="body">
@ -42,13 +39,11 @@
</article></li>
{% endif %}
{% if loop.last %}
{% if loop.length > 1 %}
{% if loop.length > 1 or articles_page.has_other_pages() %}
</ol><!-- /#posts-list -->
{% endif %}
{% if articles_page.has_previous() or loop.length > 1 %}
{% include 'pagination.html' %}
{% endif %}
{% if loop.length > 1 %}
{% if articles_page.has_other_pages() %}
{% include 'pagination.html' %}
{% endif %}
</section><!-- /#content -->
{% endif %}
{% endif %}