Add comment support and redesign post layout
Introduced a new nested comment system for posts, along with related configuration updates. Enhanced the post layout to include an improved structure, metadata, and a voting mechanism for better user interaction.
This commit is contained in:
1 parent
4cf7cc1a49
commit
7628ff96a9
14 files changed
+139
-9
No files matched your search
+53
-8
@@ -1,12 +1,57 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
<article class="post">
|
||||
<header class="post-header">
|
||||
<h1 class="post-title">{{ page.title }}</h1>
|
||||
<p class="post-meta">{{ page.date | date: "%B %d, %Y" }}</p>
|
||||
</header>
|
||||
<div class="post-content">
|
||||
{{ content }}
|
||||
</div>
|
||||
<article class="flex">
|
||||
<div class="mr-2">
|
||||
<a href="#" class="text-text-muted no-underline text-sm leading-none inline-block pt-0.5 hover:text-link-hover" title="Upvote">▲</a>
|
||||
</div>
|
||||
<div class="flex-1 text-left">
|
||||
<div>
|
||||
<p>
|
||||
<strong><a href="#" class="text-text-title font-normal text-base hover:underline">{{ page.title }}</a></strong>
|
||||
</p>
|
||||
|
||||
<!-- 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 %}
|
||||
{% endif %}
|
||||
<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>
|
||||
|
||||
<div class="post-content">
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<div class="mt-8">
|
||||
<form>
|
||||
<div class="mb-4">
|
||||
<label class="block font-medium text-sm mb-1" for="comment-body">Comment:</label>
|
||||
<div>
|
||||
<textarea class="w-full px-3 py-2 bg-bg-light border border-gray-300 rounded" id="comment-body" name="body" placeholder="Enter your comment" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button class="px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark" type="submit">Add Comment</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<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" %}
|
||||
{% endif %}
|
||||
{% for comment in comments %}
|
||||
{% include comment.liquid comment=comment level=0 %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user