Skip to content

Commit 1a7fbee

Browse files
committed
Limit 20 posts on static builds
1 parent 1059aea commit 1a7fbee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

functions/ssr/src/pages/[...slug].astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ export async function getStaticPaths() {
5757
if (slug) paths.push({ params: { slug } });
5858
});
5959
const postSlugs = await getConfig().getContent('blog/');
60-
postSlugs.forEach((_slug) => {
61-
paths.push({ params: { slug: `posts/${_slug}` } });
62-
});
60+
const maxStaticPostSlugs = Math.min(postSlugs.length, 20);
61+
for (let i = 0; i < maxStaticPostSlugs; i++) {
62+
paths.push({ params: { slug: `posts/${postSlugs[i]}` } });
63+
}
6364
}
6465
return paths;
6566
}

0 commit comments

Comments
 (0)