diff --git a/app/(app)/books/cc/[lila]/page.tsx b/app/(app)/books/cc/[lila]/page.tsx index 83dfb1d5..7851a735 100644 --- a/app/(app)/books/cc/[lila]/page.tsx +++ b/app/(app)/books/cc/[lila]/page.tsx @@ -3,8 +3,9 @@ import Link from "next/link"; import { PageHeader } from "@/components/layout/page-header"; import { notFound } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; +import { FindInPage } from "@/components/layout/find-in-page"; import { ExtractedVerseCount } from "../../extracted-verse-count"; -import { getBookMeta } from "@/lib/api"; +import { getBookMeta, getProseChapter } from "@/lib/api"; import { buildOgMeta } from "@/lib/og"; import { BOOK_NAMES, CC_LILAS } from "@/lib/constants"; @@ -14,12 +15,15 @@ export async function generateMetadata({ params: Promise<{ lila: string }>; }): Promise { const { lila } = await params; - const lilaName = CC_LILAS[lila] || lila; const bookTitle = BOOK_NAMES["cc"] || "Śrī Caitanya-caritāmṛta"; - return buildOgMeta({ - title: bookTitle, - detail: lilaName, - }); + // A non-līlā segment (front-flap, preface, introduction) is front matter. + if (!CC_LILAS[lila]) { + const segment = await getProseChapter("cc", 0, lila); + if (segment) { + return buildOgMeta({ title: bookTitle, detail: segment.title }); + } + } + return buildOgMeta({ title: bookTitle, detail: CC_LILAS[lila] || lila }); } type ChapterInfo = { @@ -47,7 +51,48 @@ export default async function LilaPage({ const lilas = meta.lilas as LilaInfo[]; const lilaInfo = lilas.find((l) => l.key === lila); - if (!lilaInfo) notFound(); + + // Front matter — the param is not a līlā key, so resolve it as a prose + // intro-segment (front-flap, preface, introduction). + if (!lilaInfo) { + const segment = await getProseChapter("cc", 0, lila); + if (!segment) notFound(); + + return ( +
+ + + ← Śrī Caitanya-caritāmṛta + +
+

+ {segment.title} +

+ +
+
+ +
+ + +
+ {segment.paragraphs.map((paragraph, i) => ( +
+ ))} +
+ + +
+
+ ); + } const totalVerses = lilaInfo.chapters.reduce( (sum, ch) => sum + ch.totalVerses, diff --git a/app/(app)/books/cc/page.tsx b/app/(app)/books/cc/page.tsx index 3aa72b66..499eea37 100644 --- a/app/(app)/books/cc/page.tsx +++ b/app/(app)/books/cc/page.tsx @@ -1,6 +1,6 @@ import type { Metadata } from "next"; import Link from "next/link"; -import { getBookMeta } from "@/lib/api"; +import { getBookMeta, getProseChapters } from "@/lib/api"; import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/layout/page-header"; import { Card, CardContent } from "@/components/ui/card"; @@ -26,7 +26,10 @@ export function generateMetadata(): Metadata { } export default async function CcPage() { - const meta = await getBookMeta("cc"); + const [meta, introSegments] = await Promise.all([ + getBookMeta("cc"), + getProseChapters("cc", 0, "intro-segment"), + ]); if (!meta) { return (
@@ -51,7 +54,33 @@ export default async function CcPage() {

{title}

{author}

-
+
+ {introSegments.length > 0 && ( +
+

+ Front Matter +

+ + +
    + {introSegments.map((seg) => ( +
  • + +

    + {seg.title} +

    + +
  • + ))} +
+
+
+
+ )} +