From 037072618b5499aba0204864f6a541672db5c791 Mon Sep 17 00:00:00 2001 From: gosangam Date: Thu, 7 May 2026 19:40:55 +0530 Subject: [PATCH] feat: add metadata generator for remaining books --- app/books/bbd/page.tsx | 6 ++++++ app/books/bg/page.tsx | 6 ++++++ app/books/bk/page.tsx | 6 ++++++ app/books/bs/page.tsx | 6 ++++++ app/books/cbhc/page.tsx | 6 ++++++ app/books/cc/[lila]/[chapter]/page.tsx | 16 ++++++++++++++++ app/books/cc/[lila]/page.tsx | 17 +++++++++++++++++ app/books/cc/page.tsx | 6 ++++++ app/books/ds/page.tsx | 6 ++++++ app/books/ej/page.tsx | 6 ++++++ app/books/ek/page.tsx | 6 ++++++ app/books/gg/page.tsx | 6 ++++++ app/books/hkh/page.tsx | 6 ++++++ app/books/iso/page.tsx | 6 ++++++ app/books/kb/[volume]/page.tsx | 13 +++++++++++++ app/books/kb/page.tsx | 6 ++++++ app/books/lcl/page.tsx | 6 ++++++ app/books/lob/page.tsx | 6 ++++++ app/books/mg/page.tsx | 6 ++++++ app/books/mm/page.tsx | 6 ++++++ app/books/mog/page.tsx | 6 ++++++ app/books/nbs/page.tsx | 6 ++++++ app/books/nod/page.tsx | 6 ++++++ app/books/noi/page.tsx | 6 ++++++ app/books/ochkm/page.tsx | 6 ++++++ app/books/owk/page.tsx | 6 ++++++ app/books/page.tsx | 11 +++++++++++ app/books/pk/page.tsx | 6 ++++++ app/books/poy/page.tsx | 6 ++++++ app/books/pqpa/page.tsx | 6 ++++++ app/books/rv/page.tsx | 6 ++++++ app/books/sb/[canto]/[chapter]/page.tsx | 14 ++++++++++++++ app/books/sb/[canto]/page.tsx | 13 +++++++++++++ app/books/sb/page.tsx | 6 ++++++ app/books/sb1962/page.tsx | 6 ++++++ app/books/ssr/page.tsx | 6 ++++++ app/books/sva/page.tsx | 6 ++++++ app/books/tlc/page.tsx | 6 ++++++ app/books/tlk/page.tsx | 6 ++++++ app/books/tqk/page.tsx | 6 ++++++ app/books/ttp/page.tsx | 6 ++++++ app/books/va/page.tsx | 6 ++++++ app/journals/[slug]/page.tsx | 14 ++++++++++++++ app/magazines/[slug]/page.tsx | 14 ++++++++++++++ app/other-documents/[slug]/page.tsx | 14 ++++++++++++++ 45 files changed, 342 insertions(+) diff --git a/app/books/bbd/page.tsx b/app/books/bbd/page.tsx index 78bde8c4..de54184e 100644 --- a/app/books/bbd/page.tsx +++ b/app/books/bbd/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBbdMeta, getBbdIntroSegments } from "@/lib/bbd"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("bbd"); +} + export default async function BbdPage() { const meta = await getBbdMeta(); if (!meta) notFound(); diff --git a/app/books/bg/page.tsx b/app/books/bg/page.tsx index 33bdce81..c0c7aa93 100644 --- a/app/books/bg/page.tsx +++ b/app/books/bg/page.tsx @@ -1,10 +1,16 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../extracted-verse-count"; +export function generateMetadata(): Metadata { + return ogForBook("bg"); +} + type ChapterInfo = { number: number; title: string; diff --git a/app/books/bk/page.tsx b/app/books/bk/page.tsx index dc6eac44..94b23d16 100644 --- a/app/books/bk/page.tsx +++ b/app/books/bk/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBkMeta } from "@/lib/bk"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("bk"); +} + export default async function BkPage() { const meta = await getBkMeta(); if (!meta) notFound(); diff --git a/app/books/bs/page.tsx b/app/books/bs/page.tsx index 5686f0c2..fbe5f68c 100644 --- a/app/books/bs/page.tsx +++ b/app/books/bs/page.tsx @@ -1,14 +1,20 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../extracted-verse-count"; import fs from "fs"; import path from "path"; +export function generateMetadata(): Metadata { + return ogForBook("bs"); +} + type BsMeta = { book: string; title: string; diff --git a/app/books/cbhc/page.tsx b/app/books/cbhc/page.tsx index fb58282e..858e5777 100644 --- a/app/books/cbhc/page.tsx +++ b/app/books/cbhc/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getCbhcMeta } from "@/lib/cbhc"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("cbhc"); +} + export default async function CbhcPage() { const meta = await getCbhcMeta(); if (!meta) notFound(); diff --git a/app/books/cc/[lila]/[chapter]/page.tsx b/app/books/cc/[lila]/[chapter]/page.tsx index 8b0a966d..903ed062 100644 --- a/app/books/cc/[lila]/[chapter]/page.tsx +++ b/app/books/cc/[lila]/[chapter]/page.tsx @@ -1,6 +1,22 @@ +import type { Metadata } from "next"; import { redirect } from "next/navigation"; import { notFound } from "next/navigation"; import { getChapterVerseIndex } from "@/lib/api"; +import { CC_LILAS } from "@/lib/constants"; +import { buildOgMeta } from "@/lib/og"; + +export async function generateMetadata({ + params, +}: { + params: Promise<{ lila: string; chapter: string }>; +}): Promise { + const { lila, chapter } = await params; + const lilaName = CC_LILAS[lila] || lila; + return buildOgMeta({ + title: "Śrī Caitanya-caritāmṛta", + detail: `${lilaName}, Chapter ${chapter}`, + }); +} export default async function CcChapterPage({ params, diff --git a/app/books/cc/[lila]/page.tsx b/app/books/cc/[lila]/page.tsx index 289a1fd3..bb6211aa 100644 --- a/app/books/cc/[lila]/page.tsx +++ b/app/books/cc/[lila]/page.tsx @@ -1,9 +1,26 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { PageHeader } from "@/components/page-header"; import { notFound } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../../extracted-verse-count"; import { getBookMeta } from "@/lib/api"; +import { buildOgMeta } from "@/lib/og"; +import { BOOK_NAMES, CC_LILAS } from "@/lib/constants"; + +export async function generateMetadata({ + params, +}: { + 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, + }); +} type ChapterInfo = { number: number; diff --git a/app/books/cc/page.tsx b/app/books/cc/page.tsx index 325cc8f7..336cb325 100644 --- a/app/books/cc/page.tsx +++ b/app/books/cc/page.tsx @@ -1,5 +1,7 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; @@ -19,6 +21,10 @@ type LilaInfo = { chapters: ChapterInfo[]; }; +export function generateMetadata(): Metadata { + return ogForBook("cc"); +} + export default async function CcPage() { const meta = await getBookMeta("cc"); if (!meta) { diff --git a/app/books/ds/page.tsx b/app/books/ds/page.tsx index 3e86f7da..841efa38 100644 --- a/app/books/ds/page.tsx +++ b/app/books/ds/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getDsMeta, getDsIntroSegments } from "@/lib/ds"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("ds"); +} + export default async function DsPage() { const meta = await getDsMeta(); if (!meta) notFound(); diff --git a/app/books/ej/page.tsx b/app/books/ej/page.tsx index 96771460..f6d8cc1d 100644 --- a/app/books/ej/page.tsx +++ b/app/books/ej/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getEjMeta, getEjIntroSegments } from "@/lib/ej"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("ej"); +} + export default async function EjPage() { const meta = await getEjMeta(); if (!meta) notFound(); diff --git a/app/books/ek/page.tsx b/app/books/ek/page.tsx index 0f660948..d5fe520b 100644 --- a/app/books/ek/page.tsx +++ b/app/books/ek/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getEkMeta, getEkIntroSegments } from "@/lib/ek"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("ek"); +} + export default async function EkPage() { const meta = await getEkMeta(); if (!meta) notFound(); diff --git a/app/books/gg/page.tsx b/app/books/gg/page.tsx index 849ec4c2..db054189 100644 --- a/app/books/gg/page.tsx +++ b/app/books/gg/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getGgMeta, getGgIntroSegments } from "@/lib/gg"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("gg"); +} + export default async function GgPage() { const meta = await getGgMeta(); if (!meta) notFound(); diff --git a/app/books/hkh/page.tsx b/app/books/hkh/page.tsx index 41e51b5a..a4861446 100644 --- a/app/books/hkh/page.tsx +++ b/app/books/hkh/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getHkhMeta, getHkhIntroSegments } from "@/lib/hkh"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("hkh"); +} + export default async function HkhPage() { const meta = await getHkhMeta(); if (!meta) notFound(); diff --git a/app/books/iso/page.tsx b/app/books/iso/page.tsx index 97ffc277..6495c711 100644 --- a/app/books/iso/page.tsx +++ b/app/books/iso/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getIsoMeta, getIsoIntroSegments } from "@/lib/iso"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("iso"); +} + export default async function IsoPage() { const meta = await getIsoMeta(); if (!meta) notFound(); diff --git a/app/books/kb/[volume]/page.tsx b/app/books/kb/[volume]/page.tsx index bffb43fe..da65ae6b 100644 --- a/app/books/kb/[volume]/page.tsx +++ b/app/books/kb/[volume]/page.tsx @@ -1,9 +1,22 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta, getProseChapters } from "@/lib/api"; +import { buildOgMeta } from "@/lib/og"; +import { BOOK_NAMES } from "@/lib/constants"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export async function generateMetadata({ + params, +}: { + params: Promise<{ volume: string }>; +}): Promise { + const { volume } = await params; + const title = BOOK_NAMES["kb"] || "KB"; + return buildOgMeta({ title, detail: `Volume ${volume}` }); +} + export default async function KbVolumePage({ params, }: { diff --git a/app/books/kb/page.tsx b/app/books/kb/page.tsx index 2b1def29..0432ffb6 100644 --- a/app/books/kb/page.tsx +++ b/app/books/kb/page.tsx @@ -1,6 +1,8 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; @@ -10,6 +12,10 @@ type VolumeInfo = { totalChapters: number; }; +export function generateMetadata(): Metadata { + return ogForBook("kb"); +} + export default async function KbPage() { const meta = await getBookMeta("kb"); if (!meta) notFound(); diff --git a/app/books/lcl/page.tsx b/app/books/lcl/page.tsx index a0f1fc09..189b7e20 100644 --- a/app/books/lcl/page.tsx +++ b/app/books/lcl/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getLclMeta, getLclIntroSegments } from "@/lib/lcl"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("lcl"); +} + export default async function LclPage() { const meta = await getLclMeta(); if (!meta) notFound(); diff --git a/app/books/lob/page.tsx b/app/books/lob/page.tsx index 1e311d9b..fc974ca7 100644 --- a/app/books/lob/page.tsx +++ b/app/books/lob/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getLobMeta, getLobIntroSegments } from "@/lib/lob"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("lob"); +} + export default async function LobPage() { const meta = await getLobMeta(); if (!meta) notFound(); diff --git a/app/books/mg/page.tsx b/app/books/mg/page.tsx index 1a1a57cc..8d941904 100644 --- a/app/books/mg/page.tsx +++ b/app/books/mg/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getMgMeta, getMgIntroSegments } from "@/lib/mg"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("mg"); +} + export default async function MgPage() { const meta = await getMgMeta(); if (!meta) notFound(); diff --git a/app/books/mm/page.tsx b/app/books/mm/page.tsx index 73681422..ab754f36 100644 --- a/app/books/mm/page.tsx +++ b/app/books/mm/page.tsx @@ -1,8 +1,10 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../extracted-verse-count"; @@ -64,6 +66,10 @@ function getLocalIntroSegments(): MmIntroSegment[] { return results.sort((a, b) => a.order - b.order); } +export function generateMetadata(): Metadata { + return ogForBook("mm"); +} + export default async function MmPage() { const meta = await getMetaWithFallback(); if (!meta) notFound(); diff --git a/app/books/mog/page.tsx b/app/books/mog/page.tsx index 58155c03..0b9e7210 100644 --- a/app/books/mog/page.tsx +++ b/app/books/mog/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getMogMeta, getMogIntroSegments } from "@/lib/mog"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("mog"); +} + export default async function MogPage() { const meta = await getMogMeta(); if (!meta) notFound(); diff --git a/app/books/nbs/page.tsx b/app/books/nbs/page.tsx index 80852c65..f3fd8fdd 100644 --- a/app/books/nbs/page.tsx +++ b/app/books/nbs/page.tsx @@ -1,14 +1,20 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../extracted-verse-count"; import fs from "fs"; import path from "path"; +export function generateMetadata(): Metadata { + return ogForBook("nbs"); +} + type NbsMeta = { book: string; title: string; diff --git a/app/books/nod/page.tsx b/app/books/nod/page.tsx index 22cf7bd0..304100ca 100644 --- a/app/books/nod/page.tsx +++ b/app/books/nod/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getNodMeta, getNodIntroSegments } from "@/lib/nod"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("nod"); +} + const PART_LABELS: Record = { 1: "Part One", 2: "Part Two", diff --git a/app/books/noi/page.tsx b/app/books/noi/page.tsx index c387af29..98dd1d5f 100644 --- a/app/books/noi/page.tsx +++ b/app/books/noi/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getNoiMeta, getNoiIntroSegments } from "@/lib/noi"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("noi"); +} + export default async function NoiPage() { const meta = await getNoiMeta(); if (!meta) notFound(); diff --git a/app/books/ochkm/page.tsx b/app/books/ochkm/page.tsx index e8bec0bb..48d3c4f9 100644 --- a/app/books/ochkm/page.tsx +++ b/app/books/ochkm/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getOchkmMeta, getOchkmIntroSegments } from "@/lib/ochkm"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("ochkm"); +} + export default async function OchkmPage() { const meta = await getOchkmMeta(); if (!meta) notFound(); diff --git a/app/books/owk/page.tsx b/app/books/owk/page.tsx index d34bb7e1..c24d5625 100644 --- a/app/books/owk/page.tsx +++ b/app/books/owk/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getOwkMeta, getOwkIntroSegments } from "@/lib/owk"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("owk"); +} + export default async function OwkPage() { const meta = await getOwkMeta(); if (!meta) notFound(); diff --git a/app/books/page.tsx b/app/books/page.tsx index 84059dcf..ba4b44d5 100644 --- a/app/books/page.tsx +++ b/app/books/page.tsx @@ -1,8 +1,19 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { PageHeader } from "@/components/page-header"; import { getAllBooks, type BookMeta } from "@/lib/api"; +import { buildOgMeta } from "@/lib/og"; import { BooksGrid, type BookInfo } from "./books-grid"; +export function generateMetadata(): Metadata { + return buildOgMeta({ + title: "Books", + detail: "Books by Śrīla Prabhupāda", + quote: + "Bhagavad-gītā, Śrīmad-Bhāgavatam, Caitanya-caritāmṛta, and 30+ other books with Devanagari, transliteration, synonyms, translations & purports.", + }); +} + type ChapterEntry = { totalVerses: number }; type CantoEntry = { totalChapters: number; chapters: ChapterEntry[] }; type LilaEntry = { totalChapters: number; chapters: ChapterEntry[] }; diff --git a/app/books/pk/page.tsx b/app/books/pk/page.tsx index 45eb1804..55e5d75c 100644 --- a/app/books/pk/page.tsx +++ b/app/books/pk/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getPkMeta } from "@/lib/pk"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("pk"); +} + export default async function PkPage() { const meta = await getPkMeta(); if (!meta) notFound(); diff --git a/app/books/poy/page.tsx b/app/books/poy/page.tsx index 94c51dd7..44cf5cf5 100644 --- a/app/books/poy/page.tsx +++ b/app/books/poy/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getPoyMeta, getPoyIntroSegments } from "@/lib/poy"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("poy"); +} + export default async function PoyPage() { const meta = await getPoyMeta(); if (!meta) notFound(); diff --git a/app/books/pqpa/page.tsx b/app/books/pqpa/page.tsx index a486fa87..90880334 100644 --- a/app/books/pqpa/page.tsx +++ b/app/books/pqpa/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getPqpaMeta, getPqpaIntroSegments } from "@/lib/pqpa"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("pqpa"); +} + export default async function PqpaPage() { const meta = await getPqpaMeta(); if (!meta) notFound(); diff --git a/app/books/rv/page.tsx b/app/books/rv/page.tsx index c56afc44..f8218701 100644 --- a/app/books/rv/page.tsx +++ b/app/books/rv/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getRvMeta, getRvIntroSegments } from "@/lib/rv"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("rv"); +} + export default async function RvPage() { const meta = await getRvMeta(); if (!meta) notFound(); diff --git a/app/books/sb/[canto]/[chapter]/page.tsx b/app/books/sb/[canto]/[chapter]/page.tsx index 5003a70a..521df740 100644 --- a/app/books/sb/[canto]/[chapter]/page.tsx +++ b/app/books/sb/[canto]/[chapter]/page.tsx @@ -1,6 +1,20 @@ +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"; + +export async function generateMetadata({ + params, +}: { + params: Promise<{ canto: string; chapter: string }>; +}): Promise { + const { canto, chapter } = await params; + return buildOgMeta({ + title: "Śrīmad-Bhāgavatam", + detail: `Canto ${canto}, Chapter ${chapter}`, + }); +} export default async function SbChapterPage({ params, diff --git a/app/books/sb/[canto]/page.tsx b/app/books/sb/[canto]/page.tsx index 0da3b6de..4545affe 100644 --- a/app/books/sb/[canto]/page.tsx +++ b/app/books/sb/[canto]/page.tsx @@ -1,9 +1,22 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { PageHeader } from "@/components/page-header"; import { notFound } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../../extracted-verse-count"; import { getBookMeta } from "@/lib/api"; +import { buildOgMeta } from "@/lib/og"; +import { BOOK_NAMES } from "@/lib/constants"; + +export async function generateMetadata({ + params, +}: { + params: Promise<{ canto: string }>; +}): Promise { + const { canto } = await params; + const title = BOOK_NAMES["sb"] || "Śrīmad-Bhāgavatam"; + return buildOgMeta({ title, detail: `Canto ${canto}` }); +} type ChapterInfo = { number: number; diff --git a/app/books/sb/page.tsx b/app/books/sb/page.tsx index 1903a814..28e8ee91 100644 --- a/app/books/sb/page.tsx +++ b/app/books/sb/page.tsx @@ -1,11 +1,17 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { ExtractedVerseCount } from "../extracted-verse-count"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { notFound } from "next/navigation"; +export function generateMetadata(): Metadata { + return ogForBook("sb"); +} + type ChapterInfo = { number: number; title: string; diff --git a/app/books/sb1962/page.tsx b/app/books/sb1962/page.tsx index a0d95421..9f765ff3 100644 --- a/app/books/sb1962/page.tsx +++ b/app/books/sb1962/page.tsx @@ -1,10 +1,16 @@ +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getBookMeta } from "@/lib/api"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; import { ExtractedVerseCount } from "../extracted-verse-count"; +export function generateMetadata(): Metadata { + return ogForBook("sb1962"); +} + type ChapterInfo = { number: number; title: string; diff --git a/app/books/ssr/page.tsx b/app/books/ssr/page.tsx index f6797d22..338c3a97 100644 --- a/app/books/ssr/page.tsx +++ b/app/books/ssr/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getSsrMeta, getSsrIntroSegments } from "@/lib/ssr"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("ssr"); +} + export default async function SsrPage() { const meta = await getSsrMeta(); if (!meta) notFound(); diff --git a/app/books/sva/page.tsx b/app/books/sva/page.tsx index 75f491d9..a776f13f 100644 --- a/app/books/sva/page.tsx +++ b/app/books/sva/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getSvaMeta, getSvaIntroSegments } from "@/lib/sva"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("sva"); +} + export default async function SvaPage() { const meta = await getSvaMeta(); if (!meta) notFound(); diff --git a/app/books/tlc/page.tsx b/app/books/tlc/page.tsx index 740318a9..b83cc86d 100644 --- a/app/books/tlc/page.tsx +++ b/app/books/tlc/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getTlcMeta, getTlcIntroSegments } from "@/lib/tlc"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("tlc"); +} + const PART_LABELS: Record = { 1: "Part I", 2: "Part II", diff --git a/app/books/tlk/page.tsx b/app/books/tlk/page.tsx index c8bcb2bb..643f33af 100644 --- a/app/books/tlk/page.tsx +++ b/app/books/tlk/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getTlkMeta, getTlkIntroSegments } from "@/lib/tlk"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("tlk"); +} + export default async function TlkPage() { const meta = await getTlkMeta(); if (!meta) notFound(); diff --git a/app/books/tqk/page.tsx b/app/books/tqk/page.tsx index 4fade4ab..29f23875 100644 --- a/app/books/tqk/page.tsx +++ b/app/books/tqk/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getTqkMeta, getTqkIntroSegments } from "@/lib/tqk"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("tqk"); +} + export default async function TqkPage() { const meta = await getTqkMeta(); if (!meta) notFound(); diff --git a/app/books/ttp/page.tsx b/app/books/ttp/page.tsx index b07e6c47..beafbd51 100644 --- a/app/books/ttp/page.tsx +++ b/app/books/ttp/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getTtpMeta } from "@/lib/ttp"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("ttp"); +} + export default async function TtpPage() { const meta = await getTtpMeta(); if (!meta) notFound(); diff --git a/app/books/va/page.tsx b/app/books/va/page.tsx index c6667fea..3b60a08a 100644 --- a/app/books/va/page.tsx +++ b/app/books/va/page.tsx @@ -1,11 +1,17 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getVaMeta } from "@/lib/va"; +import { ogForBook } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export function generateMetadata(): Metadata { + return ogForBook("va"); +} + export default async function VaPage() { const meta = await getVaMeta(); if (!meta) notFound(); diff --git a/app/journals/[slug]/page.tsx b/app/journals/[slug]/page.tsx index aed2e1ee..26d79630 100644 --- a/app/journals/[slug]/page.tsx +++ b/app/journals/[slug]/page.tsx @@ -1,5 +1,6 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { @@ -7,9 +8,22 @@ import { slugToBookCode, type JournalChapterEntry, } from "@/lib/journals"; +import { ogForJournal } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export async function generateMetadata({ + params, +}: { + params: Promise<{ slug: string }>; +}): Promise { + const { slug } = await params; + const bookCode = slugToBookCode(slug); + const meta = await getJournalMeta(bookCode); + const title = meta?.title ?? slug; + return ogForJournal(title); +} + export default async function JournalIndexPage({ params, }: { diff --git a/app/magazines/[slug]/page.tsx b/app/magazines/[slug]/page.tsx index 828487ac..67e686a0 100644 --- a/app/magazines/[slug]/page.tsx +++ b/app/magazines/[slug]/page.tsx @@ -1,5 +1,6 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { @@ -7,9 +8,22 @@ import { slugToBookCode, type MagazineChapterEntry, } from "@/lib/magazines"; +import { ogForMagazine } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export async function generateMetadata({ + params, +}: { + params: Promise<{ slug: string }>; +}): Promise { + const { slug } = await params; + const bookCode = slugToBookCode(slug); + const meta = await getMagazineMeta(bookCode); + const title = meta?.title ?? slug; + return ogForMagazine(title); +} + export default async function MagazineIndexPage({ params, }: { diff --git a/app/other-documents/[slug]/page.tsx b/app/other-documents/[slug]/page.tsx index 931bffe0..2eb417d8 100644 --- a/app/other-documents/[slug]/page.tsx +++ b/app/other-documents/[slug]/page.tsx @@ -1,11 +1,25 @@ export const dynamic = "force-dynamic"; +import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getOtherDocumentMeta, slugToBookCode } from "@/lib/other-documents"; +import { ogForOtherDocument } from "@/lib/og"; import { PageHeader } from "@/components/page-header"; import { Card, CardContent } from "@/components/ui/card"; +export async function generateMetadata({ + params, +}: { + params: Promise<{ slug: string }>; +}): Promise { + const { slug } = await params; + const bookCode = slugToBookCode(slug); + const meta = await getOtherDocumentMeta(bookCode); + const title = meta?.title ?? slug; + return ogForOtherDocument(title); +} + export default async function OtherDocumentIndexPage({ params, }: {