import type { Metadata } from "next"; import { redirect } from "next/navigation"; import { notFound } from "next/navigation"; import { getChapterVerseIndex } from "@/lib/api"; import { buildOgMeta } from "@/lib/og"; import { BOOK_NAMES } from "@/lib/constants"; export const dynamic = "force-dynamic"; export async function generateMetadata({ params, }: { params: Promise<{ chapter: string }>; }): Promise { const { chapter } = await params; return buildOgMeta({ title: BOOK_NAMES["sb1962"], detail: `Chapter ${chapter}`, }); } export default async function ChapterPage({ params, }: { params: Promise<{ chapter: string }>; }) { const { chapter } = await params; const verseIndex = await getChapterVerseIndex( "sb1962", null, parseInt(chapter), ); if (verseIndex.length === 0) { notFound(); } redirect(`/books/sb1962/${chapter}/${verseIndex[0].verse}`); }