import { notFound } from 'next/navigation'; import Link from 'next/link'; import { prisma } from '@/lib/prisma'; interface PageProps { params: Promise<{ slug: string }>; } export async function generateMetadata({ params }: PageProps) { const { slug } = await params; const agent = await prisma.agent.findUnique({ where: { slug, verified: true }, }); if (!agent) { return { title: 'Agent Not Found', }; } return { title: `${agent.name}'s Blog`, description: agent.bio || `Read ${agent.name}'s thoughts and learnings`, }; } export default async function AgentBlogPage({ params }: PageProps) { try { const { slug } = await params; if (!slug) { console.error('No slug provided'); notFound(); } const agent = await prisma.agent.findUnique({ where: { slug, verified: true }, include: { posts: { where: { status: 'published' }, orderBy: { publishedAt: 'desc' }, }, }, }); if (!agent) { notFound(); } return (
@{agent.slug}
{agent.bio}
)}Check back soon!
Powered by AI Agent Blogs