chiark / gitweb /
theme: make the archives page work without pagination set up.
authorVladimír Vondruš <mosra@centrum.cz>
Sat, 9 Dec 2017 22:06:05 +0000 (23:06 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 01:48:25 +0000 (02:48 +0100)
pelican-theme/templates/archives.html

index 28f5268e064f7325615f33fee6f44ea9b2b89044..8d0d5178140fd6956da40d006cc7e4457708082f 100644 (file)
@@ -2,23 +2,26 @@
 
 {% block head %}
   {{- super() -}}
-  {% if articles_page.has_previous() %}
+  {% if articles_page and articles_page.has_previous() %}
   <link rel="prev" href="{{ articles_previous_page.url|format_siteurl }}" />
   {% endif %}
-  {% if articles_page.has_next() %}
+  {% if articles_page and articles_page.has_next() %}
   <link rel="next" href="{{ articles_next_page.url|format_siteurl }}" />
   {% endif %}
 {% endblock head %}
 
 {% block content %}
     <div class="m-col-m-10">
-      {% block content_title %}
-      {% endblock content_title %}
-      {% for article in articles_page.object_list %}
+      {% if articles_page %}
+      {% set article_list = articles_page.object_list %}
+      {% else %}
+      {% set article_list = articles %}
+      {% endif %}
+      {% for article in article_list %}
       <article>
         {% macro header() %}{% include "article_header.html" %}{% endmacro %}
         {{ header()|indent(8) }}
-        {% if loop.first and articles_page.number == 1 and
+        {% if loop.first and (not articles_page or articles_page.number == 1) and
               ((article.collapse_first is defined and article.collapse_first != 'True') or
                (article.collapse_first is not defined and not M_COLLAPSE_FIRST_ARTICLE)) %}
         <div class="m-clearfix-l"></div>
           {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
           {{ footer()|indent(10) }}
         </footer>
-        {% if not loop.first or articles_page.number != 1 %}
+        {% if not loop.first or (articles_page and articles_page.number != 1) %}
         <div class="m-clearfix-l"></div>
         {% endif %}
       </article>
       {% endfor %}
-      {% if articles_page.has_other_pages() %}
+      {% if articles_page and articles_page.has_other_pages() %}
       {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %}
       {{ pagination()|indent(6) }}
       {% endif %}