feat: implement blog post detail page with markdown rendering, table of contents, and reading progress bar
This commit is contained in:
+3
-2
@@ -2,7 +2,7 @@ import { BlogContent } from "@/components/blog-content";
|
||||
import { getBlogPageData } from "@/data/blog";
|
||||
|
||||
type BlogPageProps = {
|
||||
searchParams?: Promise<{ page?: string | string[]; category?: string | string[] }>;
|
||||
searchParams?: Promise<{ page?: string | string[]; category?: string | string[]; search?: string | string[] }>;
|
||||
};
|
||||
|
||||
export default async function BlogPage({ searchParams }: BlogPageProps) {
|
||||
@@ -11,9 +11,10 @@ export default async function BlogPage({ searchParams }: BlogPageProps) {
|
||||
const categoryParam = Array.isArray(resolved?.category)
|
||||
? resolved?.category[0]
|
||||
: resolved?.category;
|
||||
const searchParam = Array.isArray(resolved?.search) ? resolved?.search[0] : resolved?.search;
|
||||
const page = Number(pageParam ?? "1");
|
||||
const currentPage = Number.isFinite(page) && page > 0 ? Math.floor(page) : 1;
|
||||
const data = await getBlogPageData(currentPage, 12, categoryParam);
|
||||
const data = await getBlogPageData(currentPage, 12, categoryParam, searchParam);
|
||||
|
||||
return <BlogContent data={data} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user