Statically generate individual photo pages

This commit is contained in:
Sam Becker 2024-02-28 11:58:48 -06:00
parent 110692dfbb
commit 1301a77388

View File

@ -16,10 +16,13 @@ import { getPhotosNearIdCached } from '@/photo/cache';
import { getPhotoIds } from '@/services/vercel-postgres';
import { STATICALLY_OPTIMIZED } from '@/site/config';
export let revalidate: number | undefined;
export let generateStaticParams:
(() => Promise<{ params: { photoId: string } }[]>) | undefined = undefined;
(() => Promise<{ params: { photoId: string } }[]>) | undefined;
if (STATICALLY_OPTIMIZED) {
revalidate = 3600;
generateStaticParams = async () => {
const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT });
return photos.map(photoId => ({