Build a Blog
Render blog posts with rich content and SEO.
Updated
On this page
Build a Blog
// app/blog/page.tsx
import dash from "@/lib/dash"
export default async function BlogPage() {
const [{ posts }, { categories }] = await Promise.all([
dash.blog.list({ limit: 12 }),
dash.blog.listCategories(),
])
return (
<div>
<h1>Blog</h1>
<div className="flex gap-2 mb-6">
{categories.map(cat => (
<a key={cat.id} href={`/blog?category=${cat.slug}`}>{cat.name}</a>
))}
</div>
<div className="grid md:grid-cols-3 gap-6">
{posts.map(post => (
<a key={post.id} href={`/blog/${post.slug}`}>
<img src={post.featured_image} alt={post.title} />
<h2>{post.title}</h2>
<p>{post.excerpt}</p>
</a>
))}
</div>
</div>
)
}