Blog works

This commit is contained in:
Timothy Pidashev
2024-06-05 18:41:29 -07:00
parent 4c97f4f52d
commit f96629a6b4
9 changed files with 1495 additions and 117 deletions

21
src/app/blog/page.jsx Normal file
View File

@@ -0,0 +1,21 @@
import Link from "next/link";
import { getAllBlogSlugs, getBlogBySlug } from "@/lib/mdx";
export default async function BlogsPage() {
const slugs = await getAllBlogSlugs();
const blogs = await Promise.all(slugs.map(({ slug }) => getBlogBySlug(slug)));
return (
<main>
{blogs.map((blog) => (
<article key={blog.slug} className="grid grid-cols-4 text-3xl">
<h1>{blog.frontmatter.title}</h1>
<p>{blog.frontmatter.author}</p>
<p>{blog.frontmatter.publishDate}</p>
<Link href={`/blog/${blog.slug}`}>Read More</Link>
</article>
))}
</main>
);
}