mirror of
https://github.com/audacity/audacity.github.io.git
synced 2026-06-13 13:41:41 -05:00
only show 3 posts on the homepage
This commit is contained in:
@@ -5,6 +5,8 @@ import { getCollection } from "astro:content";
|
||||
const publishedBlogPosts = await getCollection("blog", ({ data }) => {
|
||||
return data.draft !== true;
|
||||
});
|
||||
|
||||
const maxposts = 3;
|
||||
---
|
||||
|
||||
<section class="pt-8 pb-16">
|
||||
@@ -15,7 +17,10 @@ const publishedBlogPosts = await getCollection("blog", ({ data }) => {
|
||||
|
||||
<div class="grid grid-cols-12 my-4 sm:my-8 md:my-12 gap-y-8 sm:gap-8 md:gap-12">
|
||||
{
|
||||
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 (
|
||||
<NEWBlogPostCard
|
||||
href={post.slug}
|
||||
|
||||
Reference in New Issue
Block a user