fix: Render comments in mobile view by adjusting parent filter logic
This commit is contained in:
1 parent
cf1499e0ec
commit
076b54bd1b
1 file changed
+3
-12
@@ -3,23 +3,14 @@
|
||||
Assumes JavaScript will handle the navigation to nested replies using fragment identifiers.
|
||||
{% endcomment %}
|
||||
|
||||
<!-- Debug: Page Slug: {{ page.slug }} -->
|
||||
<!-- Debug: Total Comments in site.comments: {{ site.comments.size }} -->
|
||||
|
||||
{% assign post_comments = site.comments | where: "post", page.slug %}
|
||||
<!-- Debug: Comments matching post '{{ page.slug }}': {{ post_comments.size }} -->
|
||||
|
||||
{% assign top_level_comments = post_comments | where_exp: "item", "item.parent == nil" | sort: "date" %}
|
||||
<!-- Debug: Top-level comments for this post: {{ top_level_comments.size }} -->
|
||||
|
||||
{% assign top_level_comments = post_comments | where_exp: "item", "item.parent == nil or item.parent == ''" | sort: "date" %}
|
||||
|
||||
<div id="mobile-comments-list" class="space-y-4">
|
||||
{% if top_level_comments.size > 0 %}
|
||||
{% for comment in top_level_comments %}
|
||||
<!-- Debug: Rendering comment by {{ comment.author | default: 'Unknown Author' }} with slug {{ comment.slug | default: 'no-slug' }} -->
|
||||
{% assign direct_replies = site.comments | where: "parent", comment.slug %}
|
||||
<!-- Debug: Direct replies for {{ comment.slug }}: {{ direct_replies.size }} -->
|
||||
<div class="border-b border-gray-200 pb-3 mb-3" id="mobile-comment-{{ comment.slug }}"> {# Changed ID prefix for clarity #}
|
||||
<div class="border-b border-gray-200 pb-3 mb-3" id="mobile-comment-{{ comment.slug }}">
|
||||
<div class="flex justify-between items-center mb-1">
|
||||
<small class="text-xs text-primary">
|
||||
<a href="#" class="text-text-muted hover:underline">@{{ comment.author }}</a>
|
||||
@@ -55,4 +46,4 @@
|
||||
<div id="mobile-comment-thread-content">
|
||||
<!-- Parent comment and its replies will be loaded here by JavaScript -->
|
||||
</div>
|
||||
{% endcomment %}
|
||||
</div>
|
||||
Reference in new issue
Block a user