export const dynamic = "force-dynamic"; 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 async function generateMetadata({ params, }: { params: Promise<{ chapter: string }>; }): Promise { const { chapter } = await params; return buildOgMeta({ title: BOOK_NAMES["bg"], detail: `Chapter ${chapter}` }); } export default async function ChapterPage({ params, }: { params: Promise<{ chapter: string }>; }) { const { chapter } = await params; const verseIndex = await getChapterVerseIndex("bg", null, parseInt(chapter)); if (verseIndex.length === 0) { notFound(); } redirect(`/books/bg/${chapter}/${verseIndex[0].verse}`); }