export const dynamic = "force-dynamic"; import type { Metadata } from "next"; import Link from "next/link"; import { PageHeader } from "@/components/page-header"; import { Card, CardHeader, CardTitle, CardDescription, CardContent, } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { getAllMagazines, bookCodeToSlug } from "@/lib/magazines"; import { buildOgMeta } from "@/lib/og"; export function generateMetadata(): Metadata { return buildOgMeta({ title: "Magazines", detail: "Back to Godhead & other periodicals", quote: "Back to Godhead — the magazine founded by Śrīla Prabhupāda in 1944 to present the timeless science of Kṛṣṇa consciousness.", }); } export default async function MagazinesPage() { const magazines = await getAllMagazines(); // Group magazines by flag const grouped: Record = {}; for (const mag of magazines) { const key = mag.flag ?? "Other"; if (!grouped[key]) grouped[key] = []; grouped[key].push(mag); } // Define display order for groups const groupOrder = ["Pre 1978", "Other"]; const groupLabels: Record = { "Pre 1978": "Pre 1978 Editions", Other: "Other Editions", }; const sortedGroups = Object.keys(grouped).sort( (a, b) => groupOrder.indexOf(a) - groupOrder.indexOf(b), ); // If there's only one group, don't show group headings const showGroupHeadings = sortedGroups.length > 1; return (
← Home

Magazines

Back to Godhead and other periodicals by Śrīla Prabhupāda

{sortedGroups.map((group) => (
{showGroupHeadings && (

{groupLabels[group] ?? group}

)}
{grouped[group].map((mag) => ( {mag.title} {mag.description && ( {mag.description} )}
{mag.flag && ( {mag.flag} )} {mag.year && ( Since {mag.year} )} {mag.totalIssues > 0 && ( {mag.totalIssues} issues )}
))}
))}
); }