From e85173f55a0c3318933cb24db80a7bf359d5cfa1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 10 Dec 2017 00:02:48 +0100 Subject: [PATCH] theme: simpler markup in minimal cases of articles. --- pelican-theme/templates/archives.html | 10 ++++++---- pelican-theme/templates/article.html | 15 ++++++++++++--- pelican-theme/templates/article_header.html | 5 +++-- pelican-theme/templates/index.html | 10 ++++++---- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/pelican-theme/templates/archives.html b/pelican-theme/templates/archives.html index 2ad7421b..7ae981db 100644 --- a/pelican-theme/templates/archives.html +++ b/pelican-theme/templates/archives.html @@ -27,9 +27,11 @@
{% macro header() %}{% include "article_header.html" %}{% endmacro %} {{ header()|indent(8) }} - {% 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)) %} + {% set show_content = + article.content and 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)) %} + {% if show_content %}
{{ article.content|trim }} @@ -39,7 +41,7 @@ {% macro footer() %}{% include "article_footer.html" %}{% endmacro %} {{ footer()|indent(10) }} - {% if not loop.first or (articles_page and articles_page.number != 1) %} + {% if not show_content %}
{% endif %}
diff --git a/pelican-theme/templates/article.html b/pelican-theme/templates/article.html index a044ab34..03bcc708 100644 --- a/pelican-theme/templates/article.html +++ b/pelican-theme/templates/article.html @@ -12,8 +12,10 @@ + {% if article.summary %} + {% endif %} {% if article.cover %} @@ -32,8 +34,10 @@
-
{{ article.locale_date }}
+
{{ article.locale_date }}
+ {% if article.authors %}
{% for author in article.authors %}{{ author }}{% endfor %}
+ {% endif %}
@@ -47,8 +51,9 @@
- {% if (article.hide_summary is defined and article.hide_summary != 'True') or - (article.hide_summary is not defined and not M_HIDE_ARTICLE_SUMMARY) %} + {% if article.summary and + ((article.hide_summary is defined and article.hide_summary != 'True') or + (article.hide_summary is not defined and not M_HIDE_ARTICLE_SUMMARY)) %}
@@ -58,6 +63,7 @@
{% endif %} + {% if article.content %}
@@ -67,6 +73,7 @@
+ {% endif %}