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

55 lines
3.6 KiB
Plaintext

<h3 class="mt-4 text-lg font-medium">{{ page.author }}'s submissions</h3>
{% comment %} Filter posts by the author specified in the page front matter {% endcomment %}
{% comment %}{% assign user_posts = site.posts | where: "author", page.author | sort: 'date' | reverse %}{% endcomment %}
{% assign user_posts = site.posts | sort: 'date' | reverse %}
<div class="mt-4">
{% if user_posts.size > 0 %}
<div class="post-list space-y-4">
{% for post in user_posts %}
<div class="post-item mb-4" data-type="{{ post.type | default: 'unknown' }}" data-date="{{ post.date | date_to_xmlschema }}" data-upvotes="{{ post.upvotes | default: 0 }}" data-comments="{{ post.comments_count | default: 0 }}">
<article class="flex flex-col md:flex-row items-start">
<div class="flex-1 text-left">
<div>
<!-- Post Title -->
<div class="flex items-center space-x-2 mb-0.5">
<p class="mt-0 mb-0">
<strong>
<a href="{{ post.url | relative_url }}" class="text-text-title font-bold text-md md:text-sm hover:underline">
{{ post.title }}
</a>
</strong>
</p>
</div>
<!-- Post Metadata -->
<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">
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
<i class="fa-solid fa-arrow-up mr-1"></i> {{ post.upvotes | default: 0 }}
</span>
<a href="{{ post.url | relative_url }}#comments" class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
<i class="fas fa-reply mr-1"></i> REPLY
</a>
<a href="{{ post.url | relative_url }}#comments" class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
<i class="fas fa-comment mr-1"></i> {{ post.comments_count | default: 0 }}
</a>
</div>
<small class="text-sm font-action">
<a href="/user/{{ post.author }}/" class="text-sm hover:underline">{{ post.author }}</a>
<span class="text-text-muted text-sm opacity-75">{{ post.date | date: "%d %b %Y" }}</span>
</small>
</div>
</div>
</div>
</article>
<hr class="border-border-light my-4">
</div>
{% endfor %}
</div>
{% else %}
<p class="text-text-muted">This user has no submissions yet.</p>
{% endif %}
</div>