Files
buzz-sheet/app/[character]/[page]/page.tsx
T
gunshiz 801386a8ed
CI / Verify application and manifests (push) Successful in 1m27s
CI / Build immutable images and deploy (push) Failing after 5m58s
feat : overwite buzz.sudloh.com/guide
2026-09-17 21:55:16 +07:00

38 lines
1.3 KiB
TypeScript

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