From 7101c269924d31d89a4fb6a3461e6a8f27d33677 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 10 Dec 2017 13:43:08 +0100 Subject: [PATCH] theme: make the index and archives page completely equivalent. Pagination can be enabled/disabled for either of them. --- pelican-theme/templates/article_header.html | 12 ++--- pelican-theme/templates/index.html | 50 +-------------------- 2 files changed, 8 insertions(+), 54 deletions(-) diff --git a/pelican-theme/templates/article_header.html b/pelican-theme/templates/article_header.html index 9e4a74db..ba5d7847 100644 --- a/pelican-theme/templates/article_header.html +++ b/pelican-theme/templates/article_header.html @@ -7,15 +7,17 @@ {{ article.title }} {# 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 diff --git a/pelican-theme/templates/index.html b/pelican-theme/templates/index.html index a9e2d454..34d21519 100644 --- a/pelican-theme/templates/index.html +++ b/pelican-theme/templates/index.html @@ -1,49 +1 @@ -{% extends "base_blog.html" %} - -{% block head %} - {{- super() -}} - {% if articles_page.has_previous() %} - - {% endif %} - {% if articles_page.has_next() %} - - {% endif %} -{% endblock head %} - -{% block content %} -
- {% if not articles_page.object_list %} -
-

Congratulations!

- The m.css theme is alive and kicking! Now, feed it some articles so it doesn't feel so empty :) -
- {% endif %} - {% for article in articles_page.object_list %} -
- {% 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 %} -
- -{{ article.content|trim }} - - {% endif %} -
- {% macro footer() %}{% include "article_footer.html" %}{% endmacro %} - {{ footer()|indent(10) }} -
- {% if not show_content %} -
- {% endif %} -
- {% endfor %} - {% if articles_page.has_other_pages() %} - {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %} - {{ pagination()|indent(6) }} - {% endif %} -
-{% endblock content %} +{% extends "archives.html" %} -- 2.30.2