From 629dbfda5b99a71e629dbbf1845c3ceba5ac97e0 Mon Sep 17 00:00:00 2001 From: Sat Naing Date: Thu, 18 Jan 2024 09:38:41 +0630 Subject: [PATCH] fix: remove recent posts section if there's no post (#238) Changes made: - Removed the recent posts section if there's no post under the recent section. - Eliminated unnecessary
tags when there's no recent post. - Extracted all-links from the recent section and put it above the footer. Closes: #204 --- src/pages/index.astro | 46 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index bc75261..82b74bc 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -14,6 +14,7 @@ const posts = await getCollection("blog"); const sortedPosts = getSortedPosts(posts); const featuredPosts = sortedPosts.filter(({ data }) => data.featured); +const recentPosts = sortedPosts.filter(({ data }) => !data.featured); const socialCount = SOCIALS.filter(social => social.active).length; --- @@ -83,18 +84,17 @@ const socialCount = SOCIALS.filter(social => social.active).length; ))} -
+ {recentPosts.length > 0 &&
} ) } -
-

Recent Posts

- +
+ ) + } + +
+ + All Posts + + + +