changeset 412:c1d33d7e4b96

blog (item): Check if there are items before displaying comments: The template was crashing if `items` field was not present at all in comments data. rel 463
author Goffi <goffi@goffi.org>
date Sun, 31 Aug 2025 12:38:49 +0200
parents f7a434581872
children 0190a0d32909
files sat_templates/templates/bulma/blog/item.html
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat_templates/templates/bulma/blog/item.html	Fri Jul 04 17:33:22 2025 +0200
+++ b/sat_templates/templates/bulma/blog/item.html	Sun Aug 31 12:38:49 2025 +0200
@@ -111,9 +111,11 @@
 
                 {# comments #}
                 {% for comments_data in item.comments %}
-                    {% for item in comments_data['items'] %}
-                        {% include 'blog/item.html' %}
-                    {% endfor %}
+                    {% if "items" in comment_data %}
+                        {% for item in comments_data['items'] %}
+                            {% include 'blog/item.html' %}
+                        {% endfor %}
+                    {% endif %}
                     {% if allow_commenting and item_level == 1 %}
                         <div class="comment_post">
                             {{- textbox.comment(service=comments_data.service, node=comments_data.node) -}}