From 9b119691d37f0d4884e542f50eb5ded299a601e9 Mon Sep 17 00:00:00 2001 From: Bat Date: Wed, 5 Sep 2018 18:28:23 +0100 Subject: [PATCH] Don't display empty sections on the homepage --- templates/macros.html.tera | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/templates/macros.html.tera b/templates/macros.html.tera index f1c9343b..b336f281 100644 --- a/templates/macros.html.tera +++ b/templates/macros.html.tera @@ -77,10 +77,12 @@ {% endmacro %} {% macro home_feed(title, link, articles) %} -

{{ title | _ }} — {{ "View all" | _ }}

-
- {% for article in articles %} - {{ macros::post_card(article=article) }} - {% endfor %} -
+ {% if articles | length > 0 %} +

{{ title | _ }} — {{ "View all" | _ }}

+
+ {% for article in articles %} + {{ macros::post_card(article=article) }} + {% endfor %} +
+ {% endif %} {% endmacro %}