My personal site. theclashfruit.me
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: list blog posts

+19 -3
+19 -3
app/(main)/blog/page.tsx
··· 1 - export default function Blog() { 1 + import { db } from '@/lib/db/drizzle'; 2 + import { postsTable } from '@/lib/db/schema'; 3 + import Link from 'next/link'; 4 + 5 + export default async function Blog() { 6 + const posts = await db 7 + .select() 8 + .from(postsTable) 9 + .orderBy(postsTable.publishedAt); 10 + 2 11 return ( 3 12 <> 4 - <p>Blog</p> 13 + <h2>Blog Posts</h2> 5 14 6 - <ul></ul> 15 + <ul> 16 + {posts.map((p) => ( 17 + <li key={p.id}> 18 + <Link href={`/post/${p.slug}`}>{p.title}</Link> ( 19 + {p.publishedAt.toLocaleDateString('en-GB')}) 20 + </li> 21 + ))} 22 + </ul> 7 23 </> 8 24 ); 9 25 }