fix: og image generation
This commit is contained in:
@@ -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,
|
||||
}: {
|
||||
|
||||
Reference in New Issue
Block a user