Files
project-behind-the-desk/_includes/comment.liquid
T
2025-04-29 19:21:43 +08:00

84 lines
4.1 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 %}
Supports up to 6 levels of nested comments (non-recursive)
{% 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 hover:text-link-hover">▲</a>
<small class="text-text-muted ml-2">@{{ comment.author }}</small>
<small class="text-text-muted ml-2">{{ 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 replies1 = site.comments | where: "parent", comment.slug | sort: "date" %}
{% for reply1 in replies1 %}
<div class="ml-4 mt-3 border-l-2 border-gray-200 pl-2">
<div class="mb-1">
<small class="text-text-muted">@{{ reply1.author }}</small> –
<small class="text-text-muted">{{ reply1.date | date: "%b %d, %Y" }}</small>
</div>
<p>{{ reply1.content }}</p>
<small class="text-right underline text-xs cursor-pointer mt-1 inline-block">reply</small>
<!-- Reply Box -->
<div class="mt-4">
<textarea class="w-full px-3 py-2 bg-bg-light border border-gray-300 rounded text-sm mb-2" placeholder="Reply to this comment..."></textarea>
<button class="px-3 py-1 text-xs bg-primary text-white rounded hover:bg-primary-dark">Reply</button>
</div>
{% assign replies2 = site.comments | where: "parent", reply1.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>
{% assign replies3 = site.comments | where: "parent", reply2.slug | sort: "date" %}
{% for reply3 in replies3 %}
<div class="ml-4 mt-3 border-l-2 border-gray-200 pl-2">
<div class="mb-1">
<small class="text-text-muted">@{{ reply3.author }}</small> –
<small class="text-text-muted">{{ reply3.date | date: "%b %d, %Y" }}</small>
</div>
<p>{{ reply3.content }}</p>
<small class="text-right underline text-xs cursor-pointer mt-1 inline-block">reply</small>
{% assign replies4 = site.comments | where: "parent", reply3.slug | sort: "date" %}
{% for reply4 in replies4 %}
<div class="ml-4 mt-3 border-l-2 border-gray-200 pl-2">
<div class="mb-1">
<small class="text-text-muted">@{{ reply4.author }}</small> –
<small class="text-text-muted">{{ reply4.date | date: "%b %d, %Y" }}</small>
</div>
<p>{{ reply4.content }}</p>
<small class="text-right underline text-xs cursor-pointer mt-1 inline-block">reply</small>
{% assign replies5 = site.comments | where: "parent", reply4.slug | sort: "date" %}
{% for reply5 in replies5 %}
<div class="ml-4 mt-3 border-l-2 border-gray-200 pl-2">
<div class="mb-1">
<small class="text-text-muted">@{{ reply5.author }}</small> –
<small class="text-text-muted">{{ reply5.date | date: "%b %d, %Y" }}</small>
</div>
<p>{{ reply5.content }}</p>
<small class="text-right underline text-xs cursor-pointer mt-1 inline-block">reply</small>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}