Files
project-behind-the-desk/_includes/comment.liquid
T

43 lines
1.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% comment %}
Flat iterative version - no recursion, just nested loops up to N levels
{% endcomment %}
{% assign top_comments = site.comments | where: "parent", nil | sort: "date" %}
{% for comment in top_comments %}
<div class="px-0 text-sm border-l-2 border-gray-300 pl-2 mb-4">
<div class="mb-1">
<a href="#" class="text-text-muted no-underline text-sm leading-none inline-block pt-0.5 hover:text-link-hover">▲</a>
<small class="text-text-muted ml-2 text-sm">@{{ comment.author }}</small>
<small class="text-text-muted ml-2 text-sm">{{ comment.date | date: "%b %d, %Y" }}</small>
</div>
<p>{{ comment.content }}</p>
<small class="text-right underline text-xs cursor-pointer mt-1 inline-block">reply</small>
{% assign replies = site.comments | where: "parent", comment.slug | sort: "date" %}
{% for reply in replies %}
<div class="ml-4 mt-3 border-l-2 border-gray-200 pl-2">
<div class="mb-1">
<small class="text-text-muted">@{{ reply.author }}</small> –
<small class="text-text-muted">{{ reply.date | date: "%b %d, %Y" }}</small>
</div>
<p>{{ reply.content }}</p>
<small class="text-right underline text-xs cursor-pointer mt-1 inline-block">reply</small>
{% assign replies2 = site.comments | where: "parent", reply.slug | sort: "date" %}
{% for reply2 in replies2 %}
<div class="ml-4 mt-3 border-l-2 border-gray-200 pl-2">
<div class="mb-1">
<small class="text-text-muted">@{{ reply2.author }}</small> –
<small class="text-text-muted">{{ reply2.date | date: "%b %d, %Y" }}</small>
</div>
<p>{{ reply2.content }}</p>
<small class="text-right underline text-xs cursor-pointer mt-1 inline-block">reply</small>
{# Extend further levels here if needed #}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}