feat: Update post_comment layout to use post data

This commit is contained in:
Kerby Martino authored and Kerby Martino (aider) committed 2025-05-02 14:43:06 +08:00
1 parent 199a88b965
commit 05a4cf1c64
1 file changed
+8 -5
+8 -5
View File
@@ -1,6 +1,9 @@
--- ---
layout: default layout: default
--- ---
{% assign post_slug = page.post %}
{% assign post = site.posts | where: "slug", post_slug | first %}
<article class="flex"> <article class="flex">
<div class="mr-2"> <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="Back"><i class="fas fa-arrow-left"></i></a> <a href="#" class="text-text-muted no-underline text-sm leading-none inline-block pt-0.5 hover:text-link-hover" title="Back"><i class="fas fa-arrow-left"></i></a>
@@ -8,7 +11,7 @@ layout: default
<div class="flex-1 text-left"> <div class="flex-1 text-left">
<div> <div>
<p class="mt-0 mb-1"> <p class="mt-0 mb-1">
<strong><a href="#" class="text-text-title font-bold text-base hover:underline">{{ page.title }}</a></strong> <strong><a href="#" class="text-text-title font-bold text-base hover:underline">{{ post.title }}</a></strong>
</p> </p>
<div class="post-content mb-2"> <div class="post-content mb-2">
@@ -18,18 +21,18 @@ layout: default
<div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2"> <div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2">
<div class="flex items-start space-x-2 mb-2 md:mb-0"> <div class="flex items-start space-x-2 mb-2 md:mb-0">
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center"> <span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center">
<i class="fa-solid fa-arrow-up mr-1"></i> {{ page.upvotes }} <i class="fa-solid fa-arrow-up mr-1"></i> {{ post.upvotes }}
</span> </span>
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center"> <span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center">
<i class="fas fa-reply mr-1"></i> REPLY <i class="fas fa-reply mr-1"></i> REPLY
</span> </span>
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center"> <span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center">
<i class="fas fa-comment mr-1"></i> {{ page.comments_count }} <i class="fas fa-comment mr-1"></i> {{ post.comments_count }}
</span> </span>
</div> </div>
<small class="text-sm font-action"> <small class="text-sm font-action">
<a href="#" class="text-sm hover:underline">{{ page.author }}</a> <a href="#" class="text-sm hover:underline">{{ post.author }}</a>
<span class="text-text-muted text-sm opacity-75">{{ page.date | date: "%d %b %Y" }}</span> <span class="text-text-muted text-sm opacity-75">{{ post.date | date: "%d %b %Y" }}</span>
</small> </small>
</div> </div>
</div> </div>