chiark / gitweb /
theme: make the index and archives page completely equivalent.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 10 Dec 2017 12:43:08 +0000 (13:43 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 01:48:25 +0000 (02:48 +0100)
Pagination can be enabled/disabled for either of them.

pelican-theme/templates/article_header.html
pelican-theme/templates/index.html

index 9e4a74db133ffbd4a61dee8c7278f734fd53da31..ba5d7847eb6aa1873bd8d4d96c954f8594d99dda 100644 (file)
@@ -7,15 +7,17 @@
     {{ article.title }}
   </a></h1>
   {# Display summary only if:
-    - we're on article listing page and the article is not expanded (it's
-      expanded only if it's first on the first page only on the index/archive
-      page and only if it doesn't say it should be collapsed)
+    - we're on article listing page (either the articles_page is defined by
+      Pelican the article_list is defined by our archive/index page and the
+      article is not expanded (it's expanded only if it's first on the first
+      page only on the index/archive page and only if it doesn't say it should
+      be collapsed)
     - the article is expanded but doesn't say the summary should be hidden #}
   {% if article.summary and
-        ((articles_page and
+        (((articles_page or article_list) and
          (page_name not in ['index', 'archives'] or
           not loop.first or
-          articles_page.number != 1 or
+          (articles_page and articles_page.number != 1) or
           (article.collapse_first is defined and article.collapse_first == 'True') or
           (article.collapse_first is not defined and M_COLLAPSE_FIRST_ARTICLE))) or
         (article.hide_summary is defined and article.hide_summary != 'True') or
index a9e2d454368aed33e76a63d49fe9533ac6f34df5..34d21519fd26c490bb38761137a63abff3061365 100644 (file)
@@ -1,49 +1 @@
-{% extends "base_blog.html" %}
-
-{% block head %}
-  {{- super() -}}
-  {% if articles_page.has_previous() %}
-  <link rel="prev" href="{{ articles_previous_page.url|format_siteurl }}" />
-  {% endif %}
-  {% if 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">
-      {% if not articles_page.object_list %}
-      <div class="m-note m-success">
-        <h3>Congratulations!</h3>
-        The m.css theme is alive and kicking! Now, feed it some articles so it doesn't feel so empty :)
-      </div>
-      {% endif %}
-      {% for article in articles_page.object_list %}
-      <article>
-        {% macro header() %}{% include "article_header.html" %}{% endmacro %}
-        {{ header()|indent(8) }}
-        {% set show_content =
-            article.content and loop.first and 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)) %}
-        {% if show_content %}
-        <div class="m-clearfix-l"></div>
-<!-- content -->
-{{ article.content|trim }}
-<!-- /content -->
-        {% endif %}
-        <footer>
-          {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
-          {{ footer()|indent(10) }}
-        </footer>
-        {% if not show_content %}
-        <div class="m-clearfix-l"></div>
-        {% endif %}
-      </article>
-      {% endfor %}
-      {% if articles_page.has_other_pages() %}
-      {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %}
-      {{ pagination()|indent(6) }}
-      {% endif %}
-    </div>
-{% endblock content %}
+{% extends "archives.html" %}