Fixing post comment rendering
This commit is contained in:
1 parent
838f410b4d
commit
67edb553c7
4 files changed
+47
-12
No files matched your search
+16
-11
@@ -14,11 +14,13 @@ layout: default
|
||||
<!-- Post title header -->
|
||||
<div class="mt-0.5 mb-2 text-sm flex items-center">
|
||||
<small class="text-text-muted ml-2 text-sm hover:underline">@{{ page.author }}</small>
|
||||
{% assign comment_count = site.comments | where: "post", page.slug | size %}
|
||||
{% if comment_count == 0 %}
|
||||
{% assign filename = page.path | split: "/" | last | replace: ".md", "" %}
|
||||
{% assign comment_count = site.comments | where: "post", filename | size %}
|
||||
{% assign filename = page.path | split: "/" | last | replace: ".markdown", "" | replace: ".md", "" %}
|
||||
{% if page.slug %}
|
||||
{% assign post_id = page.slug %}
|
||||
{% else %}
|
||||
{% assign post_id = filename %}
|
||||
{% endif %}
|
||||
{% assign comment_count = site.comments | where: "post", post_id | size %}
|
||||
<small class="text-text-muted ml-2 text-sm">{{ page.date | date: "%B %d, %Y" }} | <a href="#" class="ml-2 text-xs text-primary hover:underline">report</a> | <a href="#" class="ml-2 text-xs text-primary hover:underline">next</a> | <a href="#" class="ml-2 text-xs text-primary hover:underline">{{ comment_count }} comments</a></small>
|
||||
</div>
|
||||
|
||||
@@ -45,14 +47,17 @@ layout: default
|
||||
<h3 class="mt-4 text-lg font-medium">Comments</h3>
|
||||
|
||||
<div class="mt-4">
|
||||
{% assign comments = site.comments | where: "post", page.slug | where_exp: "item", "item.parent == nil" %}
|
||||
{% if comments.size == 0 %}
|
||||
{% assign filename = page.path | split: "/" | last | replace: ".md", "" %}
|
||||
{% assign comments = site.comments | where: "post", filename | where_exp: "item", "item.parent == nil" %}
|
||||
{% assign filename = page.path | split: "/" | last | replace: ".markdown", "" | replace: ".md", "" %}
|
||||
{% if page.slug %}
|
||||
{% assign post_id = page.slug %}
|
||||
{% else %}
|
||||
{% assign post_id = filename %}
|
||||
{% endif %}
|
||||
{% if comments.size > 0 %}
|
||||
{% for comment in comments %}
|
||||
{% include comment.liquid comment=comment level=0 %}
|
||||
{% assign top_level_comments = site.comments | where: "post", post_id | where_exp: "item", "item.parent == nil" | sort: "date" %}
|
||||
|
||||
{% if top_level_comments.size > 0 %}
|
||||
{% for comment in top_level_comments %}
|
||||
{% include comment.liquid comment=comment %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p>No comments yet.</p>
|
||||
|
||||
Reference in new issue
Block a user