diff --git a/src/app/(static)/grid/page.tsx b/src/app/(static)/grid/page.tsx index 73af56ec..39f7b2dd 100644 --- a/src/app/(static)/grid/page.tsx +++ b/src/app/(static)/grid/page.tsx @@ -8,7 +8,8 @@ import { getPhotos, getPhotosCount, getUniqueTags } from '@/services/postgres'; import PhotoTag from '@/tag/PhotoTag'; import { Metadata } from 'next'; -export const runtime = 'edge'; +// Revalidate every 12 hours +export const revalidate = 43_200; export async function generateMetadata(): Promise { const photos = await getPhotos(); diff --git a/src/app/(static)/p/[photoId]/layout.tsx b/src/app/(static)/p/[photoId]/layout.tsx index daa2200a..25e815cf 100644 --- a/src/app/(static)/p/[photoId]/layout.tsx +++ b/src/app/(static)/p/[photoId]/layout.tsx @@ -6,6 +6,7 @@ import { import { Metadata } from 'next'; import { getPhoto, + getPhotos, getPhotosTakenAfterPhotoInclusive, getPhotosTakenBeforePhoto, } from '@/services/postgres'; @@ -13,7 +14,15 @@ import { redirect } from 'next/navigation'; import { absolutePathForPhoto, absolutePathForPhotoImage } from '@/site/paths'; import PhotoDetailPage from '@/photo/PhotoDetailPage'; -export const runtime = 'edge'; +// Revalidate every 12 hours +export const revalidate = 43_200; + +export async function generateStaticParams() { + const photos = await getPhotos(); + return photos.map(photo => ({ + slug: photo.id, + })); +} export async function generateMetadata({ params: { photoId },