From e0f93dab02024d65ddb69925a21e8d8598a036e9 Mon Sep 17 00:00:00 2001 From: satnaing Date: Fri, 2 Dec 2022 23:00:57 +0630 Subject: [PATCH] fix: displays featured section only if featured posts exist --- src/pages/index.astro | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 50e928f..66de80a 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -13,6 +13,9 @@ import Socials from "@components/Socials.astro"; const posts = await Astro.glob("../contents/**/*.md"); const sortedPosts = getSortedPosts(posts); +const featuredPosts = sortedPosts.filter( + ({ frontmatter }) => frontmatter.featured +); --- @@ -59,25 +62,25 @@ const sortedPosts = getSortedPosts(posts);
- +
+ + ) + }

Recent Posts