diff --git a/src/components/homepage/BlogPosts.astro b/src/components/homepage/BlogPosts.astro index fe2cc2b..e334063 100644 --- a/src/components/homepage/BlogPosts.astro +++ b/src/components/homepage/BlogPosts.astro @@ -5,6 +5,8 @@ import { getCollection } from "astro:content"; const publishedBlogPosts = await getCollection("blog", ({ data }) => { return data.draft !== true; }); + +const maxposts = 3; ---
@@ -15,7 +17,10 @@ const publishedBlogPosts = await getCollection("blog", ({ data }) => {
{ - publishedBlogPosts.sort((a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime()).map((post) => { + publishedBlogPosts + .sort((a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime()) + .slice(0,maxposts) + .map((post) => { return (