import React from 'react'; import PostCard from '@/components/PostCard'; import { getPostsByAuthor } from '@/lib/posts'; import { PostMetadata } from '@/types'; import { generateMetadata as createMetadata } from '@/components/Metadata'; import type { Metadata } from 'next'; import AuthorProfile from './AuthorProfile'; interface PageProps { params: Promise<{ author: string }>; } export const dynamic = 'force-dynamic'; export async function generateMetadata({ params }: PageProps): Promise { const { author } = await params; return createMetadata({ title: `${author} | Author`, description: `Posts authored by ${author} on Confessions of Grace.`, url: `https://confessionsofgrace.com/authors/${author}`, type: 'website' }); } async function getPostsByAuthorData(author: string): Promise { return await getPostsByAuthor(author); } export default async function AuthorPage({ params }: PageProps) { const { author } = await params; const posts = await getPostsByAuthorData(author); return (
{/* Posts */}

{posts.length} {posts.length === 1 ? 'post' : 'posts'} authored by "{author}"

{posts.length > 0 ? (
{posts.map((post) => ( ))}
) : (

No posts found for this author.

)}
); }