fix: og image generation

This commit is contained in:
gosangam
2026-05-06 01:19:06 +05:30
parent 0a82a12580
commit b81b18632d
13 changed files with 464 additions and 179 deletions
+14
View File
@@ -1,9 +1,23 @@
export const dynamic = "force-dynamic";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { getLettersByLocation } from "@/lib/letters";
import { ogForLettersByLocation } from "@/lib/og";
import { FilterYearBrowser } from "../../filter-year-browser";
export async function generateMetadata({
params,
}: {
params: Promise<{ name: string }>;
}): Promise<Metadata> {
const { name: encodedName } = await params;
const name = decodeURIComponent(encodedName);
const letters = await getLettersByLocation(name);
if (letters.length === 0) return {};
return ogForLettersByLocation(name, letters.length);
}
export default async function LettersByLocationPage({
params,
}: {
+11
View File
@@ -1,7 +1,9 @@
export const dynamic = "force-dynamic";
import type { Metadata } from "next";
import Link from "next/link";
import { PageHeader } from "@/components/page-header";
import { buildOgMeta } from "@/lib/og";
import {
getLetterYears,
getLetterRecipients,
@@ -11,6 +13,15 @@ import {
import { LettersNav } from "./letters-nav";
import { LettersBrowser } from "./letters-browser";
export function generateMetadata(): Metadata {
return buildOgMeta({
title: "Letters",
detail: "6,800+ letters (1947–1977)",
quote:
"Personal correspondence by Śrīla Prabhupāda — guiding disciples, Godbrothers, and well-wishers in the science of Kṛṣṇa consciousness.",
});
}
export default async function LettersPage({
searchParams,
}: {
+14
View File
@@ -1,9 +1,23 @@
export const dynamic = "force-dynamic";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { getLettersByRecipient } from "@/lib/letters";
import { ogForLettersByRecipient } from "@/lib/og";
import { FilterYearBrowser } from "../../filter-year-browser";
export async function generateMetadata({
params,
}: {
params: Promise<{ name: string }>;
}): Promise<Metadata> {
const { name: encodedName } = await params;
const name = decodeURIComponent(encodedName);
const letters = await getLettersByRecipient(name);
if (letters.length === 0) return {};
return ogForLettersByRecipient(name, letters.length);
}
export default async function LettersByRecipientPage({
params,
}: {
+14
View File
@@ -1,9 +1,23 @@
export const dynamic = "force-dynamic";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { getLettersByYear } from "@/lib/letters";
import { ogForLettersByYear } from "@/lib/og";
import { YearMonthBrowser } from "./year-month-browser";
export async function generateMetadata({
params,
}: {
params: Promise<{ year: string }>;
}): Promise<Metadata> {
const { year: yearStr } = await params;
const year = parseInt(yearStr, 10);
if (isNaN(year)) return {};
const letters = await getLettersByYear(year);
return ogForLettersByYear(year, letters.length);
}
export default async function LettersByYearPage({
params,
}: {