44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
|
|
import { GoogleAdsense } from "@/components/public/google-adsense";
|
|
import { StructuredGuideShell } from "@/components/public/structured-guide";
|
|
import { getCachedPublicGuide } from "@/lib/cache/public";
|
|
import { siteUrl } from "@/lib/site-url";
|
|
|
|
type Params = Promise<{ character: string }>;
|
|
|
|
export const instant = false;
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Params;
|
|
}): Promise<Metadata> {
|
|
const guide = await getCachedPublicGuide((await params).character);
|
|
return guide
|
|
? {
|
|
title: `${guide.name}`,
|
|
description: guide.overview,
|
|
alternates: { canonical: `${siteUrl}/${encodeURIComponent(guide.slug)}` },
|
|
openGraph: { images: [guide.coverUrl] },
|
|
twitter: { images: [guide.coverUrl] },
|
|
}
|
|
: { title: "ไม่พบไกด์" };
|
|
}
|
|
|
|
export default async function GuideOverviewPage({
|
|
params,
|
|
}: {
|
|
params: Params;
|
|
}) {
|
|
const guide = await getCachedPublicGuide((await params).character);
|
|
if (!guide) notFound();
|
|
return (
|
|
<>
|
|
<GoogleAdsense />
|
|
<StructuredGuideShell guide={guide} />
|
|
</>
|
|
);
|
|
}
|