import type { Metadata } from "next";
import Link from "next/link";
import { PageHeader } from "@/components/layout/page-header";
import { JsonLd } from "@/components/seo/json-ld";
import { bookJsonLd } from "@/lib/jsonld";
import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { ExtractedVerseCount } from "../extracted-verse-count";
import { getBookMeta, getProseChapters } 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;
totalVerses: number;
};
type CantoInfo = {
number: number;
title: string;
totalChapters: number;
chapters: ChapterInfo[];
};
export default async function SbPage() {
const [meta, introSegments] = await Promise.all([
getBookMeta("sb"),
getProseChapters("sb", 0, "intro-segment"),
]);
if (!meta) notFound();
const intro = meta as {
book: string;
title: string;
author: string;
totalCantos: number;
cantos: CantoInfo[];
};
return (
← Books
{intro.title}
{intro.author}
{introSegments.length > 0 && (
Front Matter
{introSegments.map((seg) => (
-
{seg.title}
))}
)}
{intro.cantos.map((canto) => {
const totalVerses = canto.chapters.reduce(
(sum, ch) => sum + ch.totalVerses,
0,
);
return (
-
Canto {canto.number}
{canto.title}
{canto.totalChapters} chapters ·{" "}
);
})}
);
}