30 lines
964 B
TypeScript
30 lines
964 B
TypeScript
import { Metadata } from 'next';
|
|
import { notFound } from 'next/navigation';
|
|
|
|
import { Author, Tag } from '@/lib/types/taxonomy';
|
|
import Article from '@/components/Article';
|
|
import { getMetaHome } from '@/lib/readers/meta/posts';
|
|
import generatePageMetaData from '@/lib/next/generatePageMetaData';
|
|
import { getAuthorBySlug } from '@/lib/readers/taxonomy/authors';
|
|
import { getTagBySlug } from '@/lib/readers/taxonomy/tags';
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const article = await getMetaHome();
|
|
|
|
if (!article) return { title: 'Not Found' };
|
|
|
|
return generatePageMetaData(article);
|
|
}
|
|
|
|
export default async function MetaHome() {
|
|
const article = await getMetaHome();
|
|
if (!article) notFound();
|
|
|
|
const author = await getAuthorBySlug(article.meta.author);
|
|
const tags = await Promise.all(
|
|
article.meta.tags.map((slug: string) => getTagBySlug(slug))
|
|
);
|
|
|
|
return <Article article={article} tags={tags} author={author} />;
|
|
}
|