- Introduced a new FeaturedPostsGrid component to display featured posts on the homepage. - Updated the Home component to fetch and render featured posts from the WordPress API. - Changed instances of "بلاگ" to "دانشنامه" across various components for consistent terminology.
34 lines
927 B
TypeScript
34 lines
927 B
TypeScript
import ContentSection from "@/components/content-1";
|
|
import Features from "@/components/features-12";
|
|
import { FeaturedPostsGrid } from "@/components/featured-posts-grid";
|
|
import { getPosts } from "@/lib/wp-api";
|
|
import { HeroHeader } from "@/components/header";
|
|
import HeroSection from "@/components/hero-section";
|
|
|
|
const FEATURED_CATEGORY_ID = 3;
|
|
const FEATURED_POSTS_COUNT = 4;
|
|
|
|
export default async function Home() {
|
|
let featuredPosts: Awaited<ReturnType<typeof getPosts>>["posts"] = [];
|
|
try {
|
|
const result = await getPosts({
|
|
categoryId: FEATURED_CATEGORY_ID,
|
|
perPage: FEATURED_POSTS_COUNT,
|
|
orderby: "date",
|
|
order: "desc",
|
|
});
|
|
featuredPosts = result.posts;
|
|
} catch {
|
|
// بدون پست هم صفحه رندر میشود
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<HeroSection />
|
|
<Features />
|
|
<ContentSection />
|
|
<FeaturedPostsGrid posts={featuredPosts} />
|
|
</>
|
|
);
|
|
}
|