diff --git a/pelican/themes/notmyidea/templates/index.html b/pelican/themes/notmyidea/templates/index.html
index f81275ae..69dc4622 100644
--- a/pelican/themes/notmyidea/templates/index.html
+++ b/pelican/themes/notmyidea/templates/index.html
@@ -19,7 +19,7 @@
Other articles
-
+
{% endif %}
{# other items #}
{% else %}
@@ -44,17 +44,17 @@
or not articles_page.has_previous() and loop.length > 1) %}
{% include 'pagination.html' %}
{% endif %}
-{% endfor %}
- {% if loop.length > 1 or articles_page.has_previous() %}
-
-
-{% endif %}
+ {% if loop.last %}
+
+
+ {% endif %}
+ {% endfor %}
{% else %}
Pages
-{% for page in PAGES %}
- {{ page.title }}
-{% endfor %}
+ {% for page in PAGES %}
+ {{ page.title }}
+ {% endfor %}
{% endif %}
{% endblock content %}