mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
feat: add number of posts config for home page (#281)
* Add a SITE config parameter for posts in index page * docs: update blog post for `postPerIndex` config --------- Co-authored-by: satnaing <satnaingdev@gmail.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import Hr from "@components/Hr.astro";
|
||||
import Card from "@components/Card";
|
||||
import Socials from "@components/Socials.astro";
|
||||
import getSortedPosts from "@utils/getSortedPosts";
|
||||
import { SOCIALS } from "@config";
|
||||
import { SITE, SOCIALS } from "@config";
|
||||
|
||||
const posts = await getCollection("blog");
|
||||
|
||||
@@ -96,7 +96,7 @@ const socialCount = SOCIALS.filter(social => social.active).length;
|
||||
<ul>
|
||||
{recentPosts.map(
|
||||
({ data, slug }, index) =>
|
||||
index < 4 && (
|
||||
index < SITE.postPerIndex && (
|
||||
<Card
|
||||
href={`/posts/${slug}/`}
|
||||
frontmatter={data}
|
||||
|
||||
Reference in New Issue
Block a user