chiark / gitweb /
theme: simpler markup in minimal cases of articles.
authorVladimír Vondruš <mosra@centrum.cz>
Sat, 9 Dec 2017 23:02:48 +0000 (00:02 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 01:48:25 +0000 (02:48 +0100)
pelican-theme/templates/archives.html
pelican-theme/templates/article.html
pelican-theme/templates/article_header.html
pelican-theme/templates/index.html

index 2ad7421b7a7296b23556368f1d768d896b2be73d..7ae981dba4a382bf23a7483545cd9ca971ff25bc 100644 (file)
       <article>
         {% 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 %}
         <div class="m-clearfix-l"></div>
 <!-- content -->
 {{ article.content|trim }}
@@ -39,7 +41,7 @@
           {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
           {{ footer()|indent(10) }}
         </footer>
-        {% if not loop.first or (articles_page and articles_page.number != 1) %}
+        {% if not show_content %}
         <div class="m-clearfix-l"></div>
         {% endif %}
       </article>
index a044ab34f49b5791e8c691155ff42c68d0fbbe92..03bcc708bcbaa601e6e54e021c735f4ca6ce26c3 100644 (file)
   <meta name="twitter:title" content="{{ article.title }}" />
   <meta property="og:url" content="{{ article.url|format_siteurl }}" />
   <meta name="twitter:url" content="{{ article.url|format_siteurl }}" />
+  {% if article.summary %}
   <meta property="og:description" content="{{ article.summary|striptags }}" />
   <meta name="twitter:description" content="{{ article.summary|striptags }}" />
+  {% endif %}
   {% if article.cover %}
   <meta property="og:image" content="{{ article.cover|expand_link(article) }}" />
   <meta name="twitter:card" content="summary_large_image" />
         <div id="m-jumbo-cover">
           <div class="m-container">
             <div class="m-row">
-              <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-left">{{ article.locale_date }}</div>
+              <div class="{% if article.authors %}m-col-t-6 m-col-s-5{% else %}m-col-t-12 m-col-s-10{% endif %} m-push-s-1 m-text-left">{{ article.locale_date }}</div>
+              {% if article.authors %}
               <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-right">{% for author in article.authors %}<a href="{{ author.url|format_siteurl }}">{{ author }}</a>{% endfor %}</div>
+              {% endif %}
             </div>
             <div class="m-row">
               <div class="m-col-t-12 m-col-s-10 m-push-s-1 m-col-m-8 m-push-m-2">
@@ -47,8 +51,9 @@
           </div>
         </div>
       </div>
-      {% 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)) %}
       <div class="m-container">
         <div class="m-row">
           <div class="m-col-m-10 m-push-m-1 m-nopady">
@@ -58,6 +63,7 @@
       </div>
       {% endif %}
     </header>
+    {% if article.content %}
     <div class="m-container m-container-inflatable">
       <div class="m-row">
         <div class="m-col-m-10 m-push-m-1 m-nopady">
@@ -67,6 +73,7 @@
         </div>
       </div>
     </div>
+    {% endif %}
     <footer class="m-container">
       <div class="m-row">
         <div class="m-col-m-10 m-push-m-1 m-nopadb">
       {% macro header() %}{% include "article_header.html" %}{% endmacro %}
       {{ header()|indent(6) }}
       <div class="m-clearfix-l"></div>
+      {% if article.content %}
 <!-- content -->
 {{ article.content|trim }}
 <!-- /content -->
+      {% endif %}
       <footer>
         {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
         {{ footer()|indent(8) }}
index 5804e8fee1bf724ac49f174a592742736b9ae9f4..9e4a74db133ffbd4a61dee8c7278f734fd53da31 100644 (file)
       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 (articles_page and
+  {% if article.summary and
+        ((articles_page and
          (page_name not in ['index', 'archives'] or
           not loop.first or
           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
-        (article.hide_summary is not defined and not M_HIDE_ARTICLE_SUMMARY) %}
+        (article.hide_summary is not defined and not M_HIDE_ARTICLE_SUMMARY)) %}
   {{ article.summary|trim|indent(2) }}
   {% endif %}
 </header>
index 74a702f30ea595cd57d0cf36e5dd8342704d8358..a9e2d454368aed33e76a63d49fe9533ac6f34df5 100644 (file)
       <article>
         {% macro header() %}{% include "article_header.html" %}{% endmacro %}
         {{ header()|indent(8) }}
-        {% if 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)) %}
+        {% 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 }}
@@ -34,7 +36,7 @@
           {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
           {{ footer()|indent(10) }}
         </footer>
-        {% if not loop.first or articles_page.number != 1 %}
+        {% if not show_content %}
         <div class="m-clearfix-l"></div>
         {% endif %}
       </article>