diff --git a/tpl/gallery.html b/tpl/gallery.html
index f4df131..1d05128 100644
--- a/tpl/gallery.html
+++ b/tpl/gallery.html
@@ -16,6 +16,7 @@
+ {% if(!empty($dirs)): %}
{% foreach($dirs as $d): %}
{% endforeach %}
+ {% endif %}
+ {% if(!empty($images)): %}
{% foreach($images as $image): %}
{% endforeach %}
+ {% endif %}
{% endblock %}