Check urls for pre-rendered og image /recents

This commit is contained in:
Sam Becker 2025-08-05 09:12:47 -05:00
parent 3a45838997
commit af4b7574c3

View File

@ -10,6 +10,7 @@ import { ImageResponse } from 'next/og';
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
import { getAppText } from '@/i18n/state/server';
import { SHOW_RECENTS } from '@/app/config';
import { isNextImageReadyBasedOnPhotos } from '@/photo';
export const dynamic = 'force-static';
@ -35,10 +36,14 @@ export async function GET() {
const { width, height } = IMAGE_OG_DIMENSION_SMALL;
// Make sure next/image can be reached from absolute urls,
// which may not exist on first pre-render
const isNextImageReady = await isNextImageReadyBasedOnPhotos(photos);
return new ImageResponse(
<RecentsImageResponse {...{
title,
photos,
photos: isNextImageReady ? photos : [],
width,
height,
fontFamily,