From e9c493707d668b0c13ddb1a9d74c62d808cfa99a Mon Sep 17 00:00:00 2001 From: "Kerby Martino (aider)" Date: Sun, 4 May 2025 17:02:14 +0800 Subject: [PATCH] feat: Create user posts page to display posts by a specific user --- _includes/user_posts.liquid | 61 +++++++++++++++++++++++++++++++++++++ pages/user_posts.md | 8 +++++ 2 files changed, 69 insertions(+) create mode 100644 _includes/user_posts.liquid create mode 100644 pages/user_posts.md diff --git a/_includes/user_posts.liquid b/_includes/user_posts.liquid new file mode 100644 index 0000000..018d5d1 --- /dev/null +++ b/_includes/user_posts.liquid @@ -0,0 +1,61 @@ +

{{ page.author }}'s submissions

+ +{% comment %} Filter posts by the author specified in the page front matter {% endcomment %} +{% assign user_posts = site.posts | where: "author", page.author | sort: 'date' | reverse %} + +
+ {% if user_posts.size > 0 %} +
+ {% for post in user_posts %} +
+ +
+
+ {% endfor %} +
+ {% else %} +

This user has no submissions yet.

+ {% endif %} +
diff --git a/pages/user_posts.md b/pages/user_posts.md new file mode 100644 index 0000000..95d9a8d --- /dev/null +++ b/pages/user_posts.md @@ -0,0 +1,8 @@ +--- +layout: simple +title: User Submissions +author: post_author_placeholder # Replace with actual author/username variable if needed +permalink: /user_posts/ # Consider making this dynamic, e.g., /user/:username/posts/ +--- + +{% include user_posts.liquid %}