Post Archive v1: a first pass at a functional post-archive

This commit is contained in:
2026-01-08 18:31:57 -08:00
parent 1b66fc8a90
commit 960f7ff4d0
6 changed files with 355 additions and 72 deletions

View File

@@ -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>