Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Adding if clause that will display blog entries box only if there are any entry to list

Matias Aguirre4c193f47edf3
diff --git a/sites/scrapy.org/templates/base_home.html b/sites/scrapy.org/templates/base_home.html
index 3c57b3c8b..cf4714b2e 100644
--- a/sites/scrapy.org/templates/base_home.html
+++ b/sites/scrapy.org/templates/base_home.html
@@ -32,10 +32,12 @@
</div>
{% endif %}
+ {% load lastblogentry %}
+ {% get_latest_blog_entries 2 as entries %}
+
+ {% if entries %}
<div class="box">
<h3>Scrapy Weblog</h3>
- {% load lastblogentry %}
- {% get_latest_blog_entries 2 as entries %}
{% for entry in entries %}
<div class="post{% if forloop.last %} last{% endif %}">
@@ -46,6 +48,7 @@
</div>
{% endfor %}
</div>
+ {% endif %}
</div>
</div>
{% endblock %}