Post Archive v1: a first pass at a functional post-archive
This commit is contained in:
@@ -5,8 +5,10 @@ import { type BlogPost } from '../../db/queries';
|
||||
|
||||
export function Home({ searchParams }: { searchParams: Record<string, string> }) {
|
||||
const currentPage = parseInt(searchParams.page || "1", 10);
|
||||
const totalPages = Math.ceil(getNumOfPosts() / 10);
|
||||
const posts = getRecentPosts(10, ); // Get the 10 most recent posts
|
||||
const postsPerPage = 10;
|
||||
const totalPages = Math.ceil(getNumOfPosts() / postsPerPage);
|
||||
const offset = (currentPage - 1) * postsPerPage;
|
||||
const posts = getRecentPosts(postsPerPage, offset); // Get posts for the current page
|
||||
|
||||
return (
|
||||
<main>
|
||||
|
||||
Reference in New Issue
Block a user