diff --git a/docs/templates/shortcodes/gallery.html b/docs/templates/shortcodes/gallery.html
index d2afc716..a9261e99 100644
--- a/docs/templates/shortcodes/gallery.html
+++ b/docs/templates/shortcodes/gallery.html
@@ -1,8 +1,8 @@
-{% for asset in page.assets %}
- {% if asset is ending_with(".jpg") %}
-
-
+{% for asset in page.assets -%}
+ {%- if asset is ending_with(".jpg") -%}
+
+
- {% endif %}
-{% endfor %}
+ {%- endif %}
+{%- endfor %}