Conditionally pre-render /recents image

This commit is contained in:
Sam Becker 2025-06-28 13:44:35 -05:00
parent 722f18cc0f
commit c189e567b8

View File

@ -9,6 +9,7 @@ import { getIBMPlexMono } from '@/app/font';
import { ImageResponse } from 'next/og'; import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
import { getAppText } from '@/i18n/state/server'; import { getAppText } from '@/i18n/state/server';
import { SHOW_RECENTS } from '@/app/config';
export const dynamic = 'force-static'; export const dynamic = 'force-static';
@ -18,10 +19,12 @@ export async function GET() {
{ fontFamily, fonts }, { fontFamily, fonts },
headers, headers,
] = await Promise.all([ ] = await Promise.all([
getPhotosCached({ SHOW_RECENTS
limit: MAX_PHOTOS_TO_SHOW_PER_CATEGORY, ? getPhotosCached({
recent: true, limit: MAX_PHOTOS_TO_SHOW_PER_CATEGORY,
}), recent: true,
})
: [],
getIBMPlexMono(), getIBMPlexMono(),
getImageResponseCacheControlHeaders(), getImageResponseCacheControlHeaders(),
]); ]);