Files
buzz-sheet/app/[character]/comment/page.tsx
T
gunshiz f8ef86cb5e
CI / Verify (push) Successful in 2m39s
CI / Build immutable images and deploy (push) Successful in 2m19s
feat : add metadata for comment page
2026-10-13 00:21:37 +07:00

36 lines
1.4 KiB
TypeScript

import { Suspense } from "react";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { connection } from "next/server";
import { GuidePageShell } from "@/components/public/guide-page-shell";
import { CommentBoardContent } from "@/components/comments/comment-board-content";
import { CommentBoardSkeleton } from "@/components/comments/comment-skeleton";
import { getCachedPublicGuideSummary } from "@/lib/cache/public";
export const instant = false;
type Props = { params: Promise<{ character: string }> };
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const guide = await getCachedPublicGuideSummary((await params).character);
return guide
? {
title: `${guide.name}`,
description: guide.overview,
openGraph: { images: [guide.coverUrl] },
twitter: { images: [guide.coverUrl] },
}
: { title: "ไม่พบไกด์" };
}
export default async function GuideCommentPage({ params }: Props) {
await connection();
const guide = await getCachedPublicGuideSummary((await params).character);
if (!guide) notFound();
const target = `guide:${guide.id}`;
return (
<GuidePageShell guide={guide} sections={guide.sections} section="comment">
<Suspense fallback={<CommentBoardSkeleton />}>
<CommentBoardContent target={target} />
</Suspense>
</GuidePageShell>
);
}